Skip to content
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

✨ Initialize hub with aws irsa #465

Conversation

jaswalkiranavtar
Copy link
Contributor

Summary

Related issue(s)

Fixes # open-cluster-management-io/ocm#514

@openshift-ci openshift-ci bot requested review from qiujian16 and ycyaoxdu January 15, 2025 21:43
klog.Errorf("unable to load hub cluster kubeconfig: %v", err)
return nil, err
}
hubClusterArn := rawConfig.Contexts[rawConfig.CurrentContext].Cluster
Copy link
Member

@qiujian16 qiujian16 Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the arn is the cluster name? is it alway true on EKS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding another option flag called --hub-cluster-arn which can be used in tests as well as in case the hubclusterArn is missing in kubeconfig.

@jaswalkiranavtar jaswalkiranavtar force-pushed the initialize-hub-with-aws-irsa branch from b4689d5 to 06dd0f0 Compare January 17, 2025 18:09
@jaswalkiranavtar
Copy link
Contributor Author

Merge this PR first: open-cluster-management-io/ocm#810

And update the go.mod which latest commit sha of ocm and then merge this.

@@ -78,6 +81,9 @@ func NewCmd(clusteradmFlags *genericclioptionsclusteradm.ClusteradmFlags, stream
_ = clusterManagerSet.SetAnnotation("singleton-name", "singletonSet", []string{})
o.Helm.AddFlags(singletonSet)
cmd.Flags().AddFlagSet(singletonSet)
cmd.Flags().StringArrayVar(&o.registrationAuth, "registration-auth", []string{}, "The type of authentication to use for registering and authenticating with hub, this flag can be repeated to specify multiple authentication types.")
cmd.Flags().StringVar(&o.hubClusterArn, "hub-cluster-arn", "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you would need to validate this value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thr validation for this is already added to cluster-manager spec and the validation error is already propagated back to the clusteradm consumer even now.

Is that sufficient?

@@ -78,6 +81,9 @@ func NewCmd(clusteradmFlags *genericclioptionsclusteradm.ClusteradmFlags, stream
_ = clusterManagerSet.SetAnnotation("singleton-name", "singletonSet", []string{})
o.Helm.AddFlags(singletonSet)
cmd.Flags().AddFlagSet(singletonSet)
cmd.Flags().StringArrayVar(&o.registrationAuth, "registration-auth", []string{}, "The type of authentication to use for registering and authenticating with hub, this flag can be repeated to specify multiple authentication types.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is better to validate the flag, only valid auth drvier is allowed. In the message, also should give the allowed value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -353,3 +359,27 @@ func (o *Options) deploySingletonControlplane(kubeClient kubernetes.Interface) e
}
return nil
}

func getRegistrationDrivers(o *Options) ([]operatorv1.RegistrationDriverHub, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we make it simpler? we should validate and return error when a driver name is not allowed in advance.

for _, driver := range o.registrationAuth:
    registrationDriver :=  operatorv1.RegistrationDriverHub{AuthType: driver}
   if driver == "awisra" {
      ...
   }
   registrationDrivers = append(registrationDrivers, registrationDriver)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jaswalkiranavtar
Copy link
Contributor Author

Also commented the e2e test with a TODO

@jaswalkiranavtar jaswalkiranavtar force-pushed the initialize-hub-with-aws-irsa branch from f5fa2b6 to b435511 Compare January 20, 2025 17:23
@jaswalkiranavtar jaswalkiranavtar force-pushed the initialize-hub-with-aws-irsa branch from b435511 to 81d5c1e Compare January 20, 2025 17:23
@qiujian16
Copy link
Member

/approve
/lgtm

Copy link

openshift-ci bot commented Jan 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaswalkiranavtar, qiujian16

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit a756dd6 into open-cluster-management-io:main Jan 21, 2025
9 checks passed
ramekris3163 pushed a commit to guidewire-oss/clusteradm that referenced this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants