-
Notifications
You must be signed in to change notification settings - Fork 634
✨ Rosa roles config implementations #5667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Rosa roles config implementations #5667
Conversation
d9ab817
to
ae8dbe6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
ae8dbe6
to
1fa491b
Compare
bf7d5c6
to
4ae9bc3
Compare
/test pull-cluster-api-provider-aws-test |
/assign @damdo @nrb @richardcase |
rosaRoleConfig := &expinfrav1.ROSARoleConfig{} | ||
// Get role configuration from either RosaRoleConfig or direct fields | ||
if rosaScope.ControlPlane.Spec.RosaRoleConfigRef != nil { | ||
// Get configuration from RosaRoleConfig | ||
|
||
key := client.ObjectKey{ | ||
Name: rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name, | ||
Namespace: rosaScope.ControlPlane.Namespace, | ||
} | ||
|
||
if err := r.Client.Get(ctx, key, rosaRoleConfig); err != nil { | ||
if apierrors.IsNotFound(err) { | ||
conditions.MarkFalse(rosaScope.ControlPlane, | ||
rosacontrolplanev1.ROSARoleConfigReadyCondition, | ||
rosacontrolplanev1.ROSARoleConfigNotFoundReason, | ||
clusterv1.ConditionSeverityError, | ||
"RosaRoleConfig %s/%s not found", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name) | ||
rosaScope.Error(err, fmt.Sprintf("RosaRoleConfig %s/%s not found: %s", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name, err.Error())) | ||
return ctrl.Result{RequeueAfter: time.Second * 60}, nil | ||
} | ||
rosaScope.Error(err, fmt.Sprintf("failed to get RosaRoleConfig %s/%s: %s", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name, err.Error())) | ||
return ctrl.Result{RequeueAfter: time.Second * 60}, nil | ||
} | ||
|
||
// Check if RosaRoleConfig is ready | ||
if !conditions.IsTrue(rosaRoleConfig, expinfrav1.RosaRoleConfigReadyCondition) { | ||
conditions.MarkFalse(rosaScope.ControlPlane, | ||
rosacontrolplanev1.ROSARoleConfigReadyCondition, | ||
rosacontrolplanev1.ROSARoleConfigNotReadyReason, | ||
clusterv1.ConditionSeverityWarning, | ||
"RosaRoleConfig %s/%s is not ready", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name) | ||
rosaScope.Error(err, fmt.Sprintf("RosaRoleConfig %s/%s is not ready", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name)) | ||
|
||
return ctrl.Result{RequeueAfter: time.Second * 60}, nil | ||
} | ||
|
||
conditions.MarkTrue(rosaScope.ControlPlane, rosacontrolplanev1.ROSARoleConfigReadyCondition) | ||
} else { | ||
rosaRoleConfig.Status.OIDCID = rosaScope.ControlPlane.Spec.OIDCID | ||
rosaRoleConfig.Status.AccountRolesRef.InstallerRoleARN = rosaScope.ControlPlane.Spec.InstallerRoleARN | ||
rosaRoleConfig.Status.AccountRolesRef.SupportRoleARN = rosaScope.ControlPlane.Spec.SupportRoleARN | ||
rosaRoleConfig.Status.AccountRolesRef.WorkerRoleARN = rosaScope.ControlPlane.Spec.WorkerRoleARN | ||
rosaRoleConfig.Status.OperatorRolesRef = rosaScope.ControlPlane.Spec.RolesRef | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could maybe extract this into a specific reconcileRosaRoleConfig
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
clusterv1.ConditionSeverityError, | ||
"RosaRoleConfig %s/%s not found", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name) | ||
rosaScope.Error(err, fmt.Sprintf("RosaRoleConfig %s/%s not found: %s", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name, err.Error())) | ||
return ctrl.Result{RequeueAfter: time.Second * 60}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have these RequeueAfter 60s functions all over the place?
Wouldn't erroring normally and retry soon after be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@serngawy These ones are still here I see, any thoughts?
// UnManaged OIDC Provider type | ||
UnManaged OidcProviderType = "UnManaged" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Unmanaged
might be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
credentialsSecretRef: | ||
name: rosa-creds-secret | ||
rosaRoleConfigRef: | ||
name: "${CLUSTER_NAME}-role-config" No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a missing EndOfFile here
err = r.setUpRuntime(ctx, scope) | ||
if err != nil { | ||
return ctrl.Result{}, fmt.Errorf("failed to set up runtime: %w", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be cleaner to have all these invocations that only return errors as inlined err checks
err = r.setUpRuntime(ctx, scope) | |
if err != nil { | |
return ctrl.Result{}, fmt.Errorf("failed to set up runtime: %w", err) | |
} | |
if err := r.setUpRuntime(ctx, scope); err != nil { | |
return ctrl.Result{}, fmt.Errorf("failed to set up runtime: %w", err) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
63d8809
to
658a1d2
Compare
/label tide/merge-method-squash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing some of my comments, still some things left to be addressed but we are looking good! TY
clusterv1.ConditionSeverityError, | ||
"RosaRoleConfig %s/%s not found", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name) | ||
rosaScope.Error(err, fmt.Sprintf("RosaRoleConfig %s/%s not found: %s", rosaScope.ControlPlane.Namespace, rosaScope.ControlPlane.Spec.RosaRoleConfigRef.Name, err.Error())) | ||
return ctrl.Result{RequeueAfter: time.Second * 60}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@serngawy These ones are still here I see, any thoughts?
658a1d2
to
c1c0047
Compare
Signed-off-by: serngawy <[email protected]>
Thanks @damdo , fixed all the err inline nil check AND removed the RequeueAfter 60 (just forget remove it with others) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Let's see what others think
LGTM label has been added. Git tree hash: d89f75256d7de8148a3dccb2b6a17b1083baef51
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: richardcase The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Add RosaRoleConfig API and CRD. * Enable partial reconcile of Rosa Operator Roles * Review fixes * Add integration tests * Add more tests * Fix comments Signed-off-by: serngawy <[email protected]> --------- Signed-off-by: serngawy <[email protected]> Co-authored-by: rknaur <[email protected]>
* Add RosaRoleConfig API and CRD. * Enable partial reconcile of Rosa Operator Roles * Review fixes * Add integration tests * Add more tests * Fix comments Signed-off-by: serngawy <[email protected]> --------- Signed-off-by: serngawy <[email protected]> Co-authored-by: rknaur <[email protected]>
/cherry-pick release-2.9 |
@serngawy: #5667 failed to apply on top of branch "release-2.9":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/cherry-pick release-2.9 |
@serngawy: new pull request created: #5696 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
* Add RosaRoleConfig API and CRD. * Enable partial reconcile of Rosa Operator Roles * Review fixes * Add integration tests * Add more tests * Fix comments Signed-off-by: serngawy <[email protected]> --------- Signed-off-by: serngawy <[email protected]> Co-authored-by: rknaur <[email protected]>
This PR is based on PR 5499 fixing all the comments
Based on proposal #5451
Adding RosaRoleConfig API with implementation. that should create account roles, operator roles, OIDC config and OIDC provider necessary to create ROSA HCP cluster.
Moving RosaMachinePoolAutoScaling definition to ROSAControlPlane to avoid circular dependency.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Checklist:
Release note: