Skip to content

Commit

Permalink
Support to skip credentials propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
eromanova committed Dec 23, 2024
1 parent f73e398 commit 659f691
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/managedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ type ManagedClusterSpec struct {
Template string `json:"template"`
// Name reference to the related Credentials object.
Credential string `json:"credential,omitempty"`
// PropagateCredentials indicates whether credentials should be propagated
// for use by CCM (Cloud Controller Manager).
// +kubebuilder:default:=true
PropagateCredentials bool `json:"propagateCredentials,omitempty"`
// Services is a list of services created via ServiceTemplates
// that could be installed on the target cluster.
Services []ServiceSpec `json:"services,omitempty"`
Expand Down
8 changes: 5 additions & 3 deletions internal/controller/managedcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ func (r *ManagedClusterReconciler) updateCluster(ctx context.Context, mc *hmc.Ma
return ctrl.Result{RequeueAfter: DefaultRequeueInterval}, nil
}

if err := r.reconcileCredentialPropagation(ctx, mc); err != nil {
l.Error(err, "failed to reconcile credentials propagation")
return ctrl.Result{}, err
if mc.Spec.PropagateCredentials {
if err := r.reconcileCredentialPropagation(ctx, mc); err != nil {
l.Error(err, "failed to reconcile credentials propagation")
return ctrl.Result{}, err
}
}

return ctrl.Result{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ spec:
description: DryRun specifies whether the template should be applied
after validation or only validated.
type: boolean
propagateCredentials:
default: true
description: |-
PropagateCredentials indicates whether credentials should be propagated
for use by CCM (Cloud Controller Manager).
type: boolean
services:
description: |-
Services is a list of services created via ServiceTemplates
Expand Down

0 comments on commit 659f691

Please sign in to comment.