Part 1: Add replication source and destination controllers#12
Part 1: Add replication source and destination controllers#12Madhu-1 merged 5 commits intoRamenDR:mainfrom
Conversation
cmd/openshift/mover_scc.yaml
Outdated
| @@ -0,0 +1,39 @@ | |||
| --- | |||
There was a problem hiding this comment.
Why do we need two mover_scc? One is here, and another is in cmd/manager. i assume its a mistake?
There was a problem hiding this comment.
Yes, my mistake.
Removing this.
| instance := &volsyncv1alpha1.ReplicationDestination{} | ||
| if err := r.Get(ctx, req.NamespacedName, instance); err != nil { | ||
| if !kerrors.IsNotFound(err) { | ||
| logger.Error(err, "Failed to get Destination") |
There was a problem hiding this comment.
added a comment.
same return is used in line 95 below, client.IgnoreNotFound(err) will make the error nil.
| destination *volsyncv1alpha1.ReplicationDestination, privileged bool) (mover.Mover, error) { | ||
| var dataMover mover.Mover | ||
| for _, builder := range Catalog { | ||
| candidate, err := builder.FromDestination(client, logger, eventRecorder, destination, privileged) |
There was a problem hiding this comment.
what about the error handling here?
There was a problem hiding this comment.
Followed same pattern as here
https://github.com/backube/volsync/blob/1a7616613085863d5fcc108d06cd47827d660f24/internal/controller/mover/builder.go#L102-L111
but will add a error log here now
We should not be hitting an error in our plugin.
| // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch;create;update;patch;delete;escalate;bind | ||
| // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete;escalate;bind | ||
| // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=get;list;watch;create;update;patch;delete;escalate;bind | ||
| // +kubebuilder:rbac:groups=security.openshift.io,resources=securitycontextconstraints,resourceNames=volsync-privileged-mover,verbs=use |
There was a problem hiding this comment.
volsync-privileged-mover is not the SCC we are creating, its ceph-volsync-plugin-privileged-mover
| // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch;create;update;patch;delete;escalate;bind | ||
| // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete;escalate;bind | ||
| // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=get;list;watch;create;update;patch;delete;escalate;bind | ||
| // +kubebuilder:rbac:groups=security.openshift.io,resources=securitycontextconstraints,resourceNames=volsync-privileged-mover,verbs=use |
There was a problem hiding this comment.
made a generic scaffolding below.
forgot to remove this 😮💨
Will be removed.
| // +kubebuilder:rbac:groups=volsync.backube,resources=replicationsources/status,verbs=get;update;patch | ||
| // +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete;deletecollection | ||
| // +kubebuilder:rbac:groups=core,resources=events,verbs=create;update;patch | ||
| // +kubebuilder:rbac:groups=apps,resources=nodes,verbs=get;list;watch |
cmd/manager/main.go
Outdated
| setupLog = ctrl.Log.WithName("setup") | ||
|
|
||
| //go:embed openshift/mover_scc.yaml | ||
| CephVolsyncPluginMoverSCCYamlRaw []byte |
There was a problem hiding this comment.
no need to export this as its not used outside?
internal/mover/builder.go
Outdated
| ErrNoMoverFound = fmt.Errorf("a replication method must be specified") | ||
| ErrMultipleMoversFound = fmt.Errorf("only one replication method can be supplied") |
| var dataMover mover.Mover | ||
| for _, builder := range Catalog { | ||
| candidate, err := builder.FromSource(client, logger, eventRecorder, source, privileged) | ||
| if err == nil && candidate != nil { |
There was a problem hiding this comment.
Followed same pattern as here
https://github.com/backube/volsync/blob/1a7616613085863d5fcc108d06cd47827d660f24/internal/controller/mover/builder.go#L102-L111
but will add a error log here now
We should not be hitting an error in our plugin.
|
|
||
| // Reconcile is part of the main kubernetes reconciliation loop which aims to | ||
| // move the current state of the cluster closer to the desired state. | ||
| // TODO(user): Modify the Reconcile function to compare the state specified by |
There was a problem hiding this comment.
removed the comment
Signed-off-by: Rakshith R <rar@redhat.com>
Signed-off-by: Rakshith R <rar@redhat.com>
Signed-off-by: Rakshith R <rar@redhat.com>
Signed-off-by: Rakshith R <rar@redhat.com>
Signed-off-by: Rakshith R <rar@redhat.com>
3058f83 to
342967a
Compare
Part 1: Add replication source and destination controllers
Add manager with controller setup and openshift SCC manifest
Add mover builder package for mover catalog
Add replication source and destination controllers
use golang 1.25 for mover
e2e: modify golangci lint to auto detect golang version
Will be followed by or in parallel to the following parts in separate prs.
Part 2: Movers (reconcile job and associated resources)
Part 3: Workers (source client and destination server)
Part 4: e2e