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

✨ Completing aws registration on spoke #788

Conversation

jaswalkiranavtar
Copy link
Contributor

@jaswalkiranavtar jaswalkiranavtar commented Jan 6, 2025

Summary

This PR has enhancement to complete the registration on spoke and save hub kubeconfig in a secret on spoke

Related issue(s)

Fixes #514

@openshift-ci openshift-ci bot requested review from dongbeiqing91 and elgnay January 6, 2025 22:33
@suvaanshkumar suvaanshkumar force-pushed the spoke-agent-registration-completion branch 12 times, most recently from b1cffe9 to 5e288e7 Compare January 7, 2025 20:50
@suvaanshkumar suvaanshkumar force-pushed the spoke-agent-registration-completion branch 2 times, most recently from c755023 to 1b1d1da Compare January 7, 2025 22:15
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 53.06122% with 23 lines in your changes missing coverage. Please review.

Project coverage is 63.80%. Comparing base (037aa3c) to head (cb0df69).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pkg/registration/register/aws_irsa/aws.go 0.00% 12 Missing ⚠️
pkg/registration/spoke/spokeagent.go 16.66% 4 Missing and 1 partial ⚠️
...lers/klusterletcontroller/klusterlet_controller.go 57.14% 3 Missing ⚠️
pkg/registration/register/aws_irsa/aws_irsa.go 91.30% 2 Missing ⚠️
pkg/registration/register/aws_irsa/options.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #788      +/-   ##
==========================================
+ Coverage   63.78%   63.80%   +0.02%     
==========================================
  Files         192      192              
  Lines       18606    18642      +36     
==========================================
+ Hits        11868    11895      +27     
- Misses       5759     5770      +11     
+ Partials      979      977       -2     
Flag Coverage Δ
unit 63.80% <53.06%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@suvaanshkumar suvaanshkumar force-pushed the spoke-agent-registration-completion branch from 1b1d1da to 387a974 Compare January 7, 2025 22:48
@qiujian16
Copy link
Member

need to run make fmt-imports


func GetAwsRegion(clusterArn string) string {
clusterStringParts := strings.Split(clusterArn, ":")
return clusterStringParts[3]
Copy link
Member

Choose a reason for hiding this comment

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

do we ensure that the slice size is 4?

Copy link
Contributor

Choose a reason for hiding this comment

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

The hub cluster arn shoudl be of the format arn:aws:eks:::cluster/ so the length should be fine.

approved := false

for _, condition := range v1Managedcluster.Status.Conditions {
Copy link
Member

Choose a reason for hiding this comment

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

you could use meta.FindStatusCondition here.

return secret, nil
}

func GetFilledAWSHubKubeConfigSecret(kubeClient kubernetes.Interface, secretNamespace, secretName string) (*corev1.Secret, error) {
Copy link
Member

Choose a reason for hiding this comment

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

if it is only to check the hubkubeconfig key, you might want to call it GetHubKubeConfigFromSecret

// }
// return nil
//}, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred())
// ensure that generated hub-kubeconfig-secret is correct
Copy link
Member

Choose a reason for hiding this comment

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

let's also comment that the kubeconfig secret here in integration test for AWS won't be able to connect to hub server, since it is not in the eks environment. So we only validate the format of the hub-kubeconfig.

@suvaanshkumar suvaanshkumar force-pushed the spoke-agent-registration-completion branch 6 times, most recently from 3912c02 to 875ec73 Compare January 8, 2025 22:18
@suvaanshkumar suvaanshkumar force-pushed the spoke-agent-registration-completion branch from 875ec73 to 22a64b5 Compare January 8, 2025 22:19
@@ -117,3 +168,12 @@ var _ = ginkgo.Describe("Joining Process for aws flow", func() {
})

})

func contains(slice []string, value string) bool {
Copy link
Member

@qiujian16 qiujian16 Jan 9, 2025

Choose a reason for hiding this comment

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

nit: alternatively, you could use

stringSet := sets.New[string](slice...)
return stringSet.Has(value)
....

@qiujian16
Copy link
Member

/approve

only 1 minor comment, feel free to tag when it is resolved.

@openshift-ci openshift-ci bot added the approved label Jan 9, 2025
@jaswalkiranavtar
Copy link
Contributor Author

@mikeshng We have addressed qiujian's final comment. Could you please help merge it.

@jaswalkiranavtar jaswalkiranavtar force-pushed the spoke-agent-registration-completion branch from 49ebc19 to cb0df69 Compare January 9, 2025 18:24
Copy link
Member

@mikeshng mikeshng left a comment

Choose a reason for hiding this comment

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

/lgtm

Confirmed the sets lib comment from reviewer has been addressed.

Copy link
Contributor

openshift-ci bot commented Jan 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaswalkiranavtar, mikeshng, 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 0acf030 into open-cluster-management-io:main Jan 9, 2025
14 checks passed
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.

Natively support OCM on EKS
4 participants