Implement config validation - #210
Merged
Merged
Conversation
Member
Author
Example run% ramenctl validate clusters -o validate
⭐ Using config "config.yaml"
⭐ Using report "validate"
🔎 Validate config ...
✅ Config validated
🔎 Validate clusters ...
✅ Cluster "hub" validated
✅ Cluster "dr1" validated
✅ Cluster "dr2" validated
✅ Validation completedLogReportbuild:
commit: 122fe048fdec8917ada9156ce1847bf9611edd5a
version: v0.7.0-34-g122fe04
config:
clusterSet: default
clusters:
c1:
kubeconfig: /Users/nir/.config/drenv/rdr/kubeconfigs/dr1
c2:
kubeconfig: /Users/nir/.config/drenv/rdr/kubeconfigs/dr2
hub:
kubeconfig: /Users/nir/.config/drenv/rdr/kubeconfigs/hub
distro: k8s
namespaces:
argocdNamespace: argocd
ramenDRClusterNamespace: ramen-system
ramenHubNamespace: ramen-system
ramenOpsNamespace: ramen-ops
created: "2025-07-01T21:23:19.193189+03:00"
duration: 0.010914209
host:
arch: arm64
cpus: 12
os: darwin
name: validate-clusters
status: passed
steps:
- duration: 0.010905584
name: validate config
status: passed
- duration: 8.625e-06
items:
- name: hub
status: passed
- name: dr1
status: passed
- name: dr2
status: passed
name: validate clusters
status: passed |
Preparing for adding validation package for decoupling command management and accessing actual clusters. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Setting the distro must update the namespaces. It is nice when this is done internally by the config. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
This package is similar to the testing package, decoupling the command and code accessing real clusters. Unlike the testing package delegating the work to ramen/e2e, this package implement the actual validation. The first interface, Validate() is like testing.Testing.Validate(), but works with validation.Context instead of ramen/e2e/types.Context. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Like test.Command, validate.Command is accepting a backend for performing the actual work. This allows testing the command with a mock backend without access to real clusters. Testing the actual validation must be done manually and will be tested by end to end tests later. Like test.Command we implement the Context interface to decouple the command from the validation package. Like test.Command we limit the time we wait for validating the config. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
This is a mock backend that can simulate errors and cancellation for any operation. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
parikshithb
approved these changes
Jul 7, 2025
parikshithb
left a comment
Member
There was a problem hiding this comment.
Minor comment, otherwise looks great!!
Add fast tests using a mock backend, validating that the report represent the command result. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add validation package for decoupling the command from the actual validation code. The package provides a Validation interface and a Backend implementing the interface.
The validate.Command uses now the backend to implement config validation.
Fixes #203