diff --git a/.github/ISSUE_TEMPLATE/BUG.yaml b/.github/ISSUE_TEMPLATE/BUG.yaml new file mode 100644 index 000000000..ba5d4db4b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG.yaml @@ -0,0 +1,87 @@ +name: "🐛 Bug Report" +description: "Submit a bug report to help us improve" +title: "Bug: " +labels: [bug] +assignees: ["narmidm","bharath-avesha","YachikaRalhan","Rahul-D78","rahulsawra98","gourishkb","mridulgain","richiesebastian"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out our bug report form 🙏 + - type: textarea + id: description + validations: + required: true + attributes: + label: "📜 Description" + description: "A clear and concise description of what the bug is." + placeholder: "It bugs out when ..." + - type: textarea + id: steps-to-reproduce + validations: + required: true + attributes: + label: "👟 Reproduction steps" + description: "How do you trigger this bug? Please walk us through it step by step." + placeholder: "1. When I ..." + - type: textarea + id: expected-behavior + validations: + required: true + attributes: + label: "👍 Expected behavior" + description: "What did you think would happen?" + placeholder: "It should ..." + - type: textarea + id: actual-behavior + validations: + required: true + attributes: + label: "👎 Actual Behavior" + description: "What did actually happen? Add screenshots, if applicable." + placeholder: "It actually ..." + - type: textarea + id: logs + attributes: + label: "🐚 Relevant log output" + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: textarea + id: version + attributes: + label: Version + description: What version of our software are you running? + placeholder: "I used ...." + - type: dropdown + id: os + attributes: + label: "🖥️ What operating system are you seeing the problem on?" + multiple: true + options: + - Linux + - MacOS + - Windows + - type: textarea + id: solution + validations: + required: false + attributes: + label: "✅ Proposed Solution" + description: "Any thoughts as to potential solutions or ideas to go about finding one. Please include links to any research." + placeholder: "To fix this, I found ..." + - type: checkboxes + id: no-duplicate-issues + attributes: + label: "👀 Have you spent some time to check if this issue has been raised before?" + description: "Have you researched on internet for a similar issue or checked our older issues for a similar bug?" + options: + - label: "I checked and didn't find any similar issue" + required: true + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: I have read the [https://github.com/kubeslice/worker-operator/blob/master/code_of_conduct.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true diff --git a/.github/ISSUE_TEMPLATE/FEATURE.yaml b/.github/ISSUE_TEMPLATE/FEATURE.yaml new file mode 100644 index 000000000..0da449734 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE.yaml @@ -0,0 +1,57 @@ +name: 🚀 Feature +description: "Submit a proposal for a new feature" +title: "Feature: " +labels: [feature] +assignees: ["narmidm","bharath-avesha","YachikaRalhan","Rahul-D78","rahulsawra98","gourishkb","mridulgain","richiesebastian"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out our feature request form 🙏 + - type: textarea + id: feature-description + validations: + required: true + attributes: + label: "🔖 Feature description" + description: "A clear and concise description of what the feature is." + placeholder: "You should add ..." + - type: textarea + id: pitch + validations: + required: true + attributes: + label: "🎤 Pitch" + description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable." + placeholder: "In my use-case, ..." + - type: textarea + id: solution + validations: + required: true + attributes: + label: "✌️ Solution" + description: "A clear and concise description of what you want to happen." + placeholder: "I want this feature to, ..." + - type: textarea + id: alternative + validations: + required: false + attributes: + label: "🔄️ Alternative" + description: "A clear and concise description of any alternative solutions or features you've considered." + placeholder: "I tried, ..." + - type: checkboxes + id: no-duplicate-issues + attributes: + label: "👀 Have you spent some time to check if this issue has been raised before?" + description: "Have you researched on internet for a similar issue or checked our older issues for a similar bug?" + options: + - label: "I checked and didn't find similar issue" + required: true + - type: checkboxes + id: read-code-of-conduct + attributes: + label: "🏢 Have you read the Code of Conduct?" + options: + - label: "I have read the [Code of Conduct](https://github.com/kubeslice/worker-operator/blob/master/code_of_conduct.md)" + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..500c76362 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,51 @@ + + +# Description + + +Fixes # + +## How Has This Been Tested? + + +## Checklist: + +* [ ] The title of the PR states what changed and the related issues number (used for the release note). +* [ ] Does this PR requires documentation updates? +* [ ] I've updated documentation as required by this PR. +* [ ] I have ran `go fmt` +* [ ] I have updated the helm chart as required by this PR. +* [ ] I have performed a self-review of my own code. +* [ ] I have commented my code, particularly in hard-to-understand areas. +* [ ] I have tested it for all user roles. +* [ ] I have added all the required unit test cases. +* [ ] I have verified the E2E test cases with new code changes. +* [ ] I have added all the required E2E test cases. + +## Does this PR introduce a breaking change? + + +```release-note + +``` diff --git a/AUTHORS b/AUTHORS index fcfecd61c..43cf1913e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,9 +1,51 @@ # Names should be added to this file as -# Name or Organization +# Name or Organization # The email address is not required for organizations. # You can update this list using the following command: # -# $ (head -n10 AUTHORS && git shortlog -se | sed -E 's/^\s+[0-9]+\t//') | tee AUTHORS - +# (head -n10 AUTHORS && git shortlog -se | sed -E 's/^\s+[0-9]+\t//') | tee AUTHORS +# # Please keep the list sorted. +Aakash +Aakash +Aakash +Bharath Horatti +Gourish Biradar +Jayadeep KM <6793260+kmjayadeep@users.noreply.github.com> +Jayadeep KM +Jayadeep KM +Md Imran +Mohammed Ahmed +Mridul Gain +Nishant Singh <89241026+NishantSingh10@users.noreply.github.com> +Nishant Singh +Rahul +Rahul Kumar <57394571+Rahul-D78@users.noreply.github.com> +Rahul Kumar +Rahul Sawra +Rahul-D78 +Richie Sebastian <104349170+richiesebastian@users.noreply.github.com> +Venkatesh Poola +Venkatesh2102 <103932891+Venkatesh2102@users.noreply.github.com> +Yachika <36668209+YachikaRalhan@users.noreply.github.com> +Yachika Ralhan +YachikaRalhan +YachikaRalhan +YachikaRalhan +bharath-avesha <99859949+bharath-avesha@users.noreply.github.com> +gourishkb <104021126+gourishkb@users.noreply.github.com> +gourishkb +kon3m +kumar.bavanasi +nishantsingh +pnavali <75800004+pnavali@users.noreply.github.com> +rahulii +rahulsawra98 <104886535+rahulsawra98@users.noreply.github.com> +rahulsawra98 +richiesebastian <104349170+richiesebastian@users.noreply.github.com> +sai v +saivenkatesh1909 <99859187+saivenkatesh1909@users.noreply.github.com> +srinivas-avesha <99861290+srinivas-avesha@users.noreply.github.com> +uma-kt <105046156+uma-kt@users.noreply.github.com> +veenamj-avesha <104770800+veenamj-avesha@users.noreply.github.com> diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000000000..422eb9f52 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,67 @@ +# This is a comment. +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# @global-owner1 and @global-owner2 will be requested for +# review when someone opens a pull request. +#* @global-owner1 @global-owner2 + +# Order is important; the last matching pattern takes the most +# precedence. When someone opens a pull request that only +# modifies JS files, only @js-owner and not the global +# owner(s) will be requested for a review. +#*.js @js-owner #This is an inline comment. + +# You can also use email addresses if you prefer. They'll be +# used to look up users just like we do for commit author +# emails. +#*.go docs@example.com + +# Teams can be specified as code owners as well. Teams should +# be identified in the format @org/team-name. Teams must have +# explicit write access to the repository. In this example, +# the octocats team in the octo-org organization owns all .txt files. +#*.txt @octo-org/octocats + +# In this example, @doctocat owns any files in the build/logs +# directory at the root of the repository and any of its +# subdirectories. +#/build/logs/ @doctocat + +# The `docs/*` pattern will match files like +# `docs/getting-started.md` but not further nested files like +# `docs/build-app/troubleshooting.md`. +#docs/* docs@example.com + +# In this example, @octocat owns any file in an apps directory +# anywhere in your repository. +#apps/ @octocat + +# In this example, @doctocat owns any file in the `/docs` +# directory in the root of your repository and any of its +# subdirectories. +#/docs/ @doctocat + +# In this example, any change inside the `/scripts` directory +# will require approval from @doctocat or @octocat. +#/scripts/ @doctocat @octocat + +# In this example, @octocat owns any file in a `/logs` directory such as +# `/build/logs`, `/scripts/logs`, and `/deeply/nested/logs`. Any changes +# in a `/logs` directory will require approval from @octocat. +#**/logs @octocat + +# In this example, @octocat owns any file in the `/apps` +# directory in the root of your repository except for the `/apps/github` +# subdirectory, as its owners are left empty. +#/apps/ @octocat +#/apps/github + +# In this example, @octocat owns any file in the `/apps` +# directory in the root of your repository except for the `/apps/github` +# subdirectory, as this subdirectory has its own owner @doctocat +#/apps/ @octocat +#/apps/github @doctocat + +* @narmidm @bharath-avesha @YachikaRalhan @Rahul-D78 @rahulsawra98 @gourishkb @mridulgain diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 000000000..8d2d72245 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,8 @@ +# KubeSlice Worker-Operator Maintainers +The maintainers are generally available in Slack at https://kubernetes.slack.com in channel #kubeslice + +Md Imran imran@avesha.io +Eric Peterson eric@avesha.io +Prabhu Navali prabhu@avesha.io +Bharath Horatti bharath@avesha.io +Richie Sebastian richie@avesha.io diff --git a/pkg/hub/controllers/vpnkeyrotation/reconciler.go b/pkg/hub/controllers/vpnkeyrotation/reconciler.go index d2469b043..701e7f5d3 100644 --- a/pkg/hub/controllers/vpnkeyrotation/reconciler.go +++ b/pkg/hub/controllers/vpnkeyrotation/reconciler.go @@ -412,9 +412,7 @@ func (r *Reconciler) syncCurrentRotationState(ctx context.Context, } } if len(syncedRotationState) != len(vpnKeyRotation.Status.CurrentRotationState) || len(keysToDeleteFromStatus) > 0 { - log.Info("syncing current rotation state for the gateways", - "from", vpnKeyRotation.Status.CurrentRotationState, - "to", syncedRotationState) + // Merge the new syncedRotationState with the existing state for gw, obj := range syncedRotationState { currentRotationState[gw] = obj @@ -425,7 +423,9 @@ func (r *Reconciler) syncCurrentRotationState(ctx context.Context, delete(currentRotationState, key) } } - + log.Info("syncing current rotation state for the gateways", + "from", vpnKeyRotation.Status.CurrentRotationState, + "to", currentRotationState) vpnKeyRotation.Status.CurrentRotationState = currentRotationState requeue = true return r.Status().Update(ctx, vpnKeyRotation) diff --git a/pkg/hub/controllers/vpnkeyrotation/vpnrotation_ctrl_test.go b/pkg/hub/controllers/vpnkeyrotation/vpnrotation_ctrl_test.go index 8b349dd40..febd85290 100644 --- a/pkg/hub/controllers/vpnkeyrotation/vpnrotation_ctrl_test.go +++ b/pkg/hub/controllers/vpnkeyrotation/vpnrotation_ctrl_test.go @@ -75,6 +75,7 @@ var _ = Describe("Hub VPN Key Rotation", func() { ClusterGatewayMapping: map[string][]string{ CLUSTER_NAME: {gws[0]}, }, + Clusters: []string{ClusterName}, CertificateCreationTime: &metav1.Time{Time: time.Now()}, }, } @@ -177,6 +178,7 @@ var _ = Describe("Hub VPN Key Rotation", func() { ClusterGatewayMapping: map[string][]string{ CLUSTER_NAME: gws, }, + Clusters: []string{ClusterName}, CertificateCreationTime: &metav1.Time{Time: time.Now()}, CertificateExpiryTime: &metav1.Time{Time: time.Now().AddDate(0, 0, 30)}, RotationInterval: 30, @@ -515,6 +517,7 @@ var _ = Describe("Hub VPN Key Rotation", func() { ClusterGatewayMapping: map[string][]string{ CLUSTER_NAME: {gws[0]}, }, + Clusters: []string{ClusterName}, CertificateCreationTime: &metav1.Time{Time: time.Now()}, CertificateExpiryTime: &metav1.Time{Time: time.Now().AddDate(0, 0, 30)}, RotationInterval: 30, @@ -742,6 +745,7 @@ var _ = Describe("Hub VPN Key Rotation", func() { ClusterGatewayMapping: map[string][]string{ "worker-1": gws, }, + Clusters: []string{ClusterName}, CertificateCreationTime: &metav1.Time{Time: time.Now()}, }, } diff --git a/pkg/hub/controllers/vpnkeyrotation/vpnrotation_suite_test.go b/pkg/hub/controllers/vpnkeyrotation/vpnrotation_suite_test.go index ad9d2017b..987030fc3 100644 --- a/pkg/hub/controllers/vpnkeyrotation/vpnrotation_suite_test.go +++ b/pkg/hub/controllers/vpnkeyrotation/vpnrotation_suite_test.go @@ -18,6 +18,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/envtest" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" + "sigs.k8s.io/controller-runtime/pkg/predicate" hubv1alpha1 "github.com/kubeslice/apis/pkg/controller/v1alpha1" spokev1alpha1 "github.com/kubeslice/apis/pkg/worker/v1alpha1" @@ -152,6 +153,9 @@ var _ = BeforeSuite(func() { err = builder. ControllerManagedBy(k8sManager). For(&hubv1alpha1.VpnKeyRotation{}). + WithEventFilter(predicate.NewPredicateFuncs(func(object client.Object) bool { + return shouldProcessVpnKeyRotation(object) + })). Complete(rotationReconciler) if err != nil { os.Exit(1) @@ -203,3 +207,13 @@ var _ = AfterSuite(func() { err := testEnv.Stop() Expect(err).NotTo(HaveOccurred()) }) + +func shouldProcessVpnKeyRotation(object client.Object) bool { + vpn := object.(*hubv1alpha1.VpnKeyRotation) + for _, v := range vpn.Spec.Clusters { + if v == ClusterName { + return true + } + } + return false +} diff --git a/pkg/hub/manager/manager.go b/pkg/hub/manager/manager.go index 1eea368dc..e6f15e90e 100644 --- a/pkg/hub/manager/manager.go +++ b/pkg/hub/manager/manager.go @@ -214,6 +214,9 @@ func Start(meshClient client.Client, hubClient client.Client, ctx context.Contex ControllerManagedBy(mgr). For(&hubv1alpha1.VpnKeyRotation{}). WithEventFilter(predicate.GenerationChangedPredicate{}). + WithEventFilter(predicate.NewPredicateFuncs(func(object client.Object) bool { + return shouldProcessVpnKeyRotation(object) + })). Complete(vpnKeyRotationReconciler) if err != nil { log.Error(err, "could not create vpn key rotation controller") @@ -225,3 +228,13 @@ func Start(meshClient client.Client, hubClient client.Client, ctx context.Contex os.Exit(1) } } + +func shouldProcessVpnKeyRotation(object client.Object) bool { + vpn := object.(*hubv1alpha1.VpnKeyRotation) + for _, v := range vpn.Spec.Clusters { + if v == ClusterName { + return true + } + } + return false +}