-
Notifications
You must be signed in to change notification settings - Fork 32
CLOUDP-322487 - Change webhook's CR and CRB resource names to include operator name and namespace #393
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
Conversation
MCK 1.3.0 Release NotesNew FeaturesMulti-Architecture SupportWe've added comprehensive multi-architecture support for the kubernetes operator. This enhancement enables deployment on IBM Power (ppc64le) and IBM Z (s390x) architectures alongside
Bug Fixes
Other Changes
|
| {{/* This cluster role and binding is necessary to allow the operator to automatically register ValidatingWebhookConfiguration. */}} | ||
| {{- if and .Values.operator.webhook.registerConfiguration .Values.operator.webhook.installClusterRole }} | ||
| {{- if not (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "mongodb-kubernetes-operator-mongodb-webhook") }} | ||
| {{- $webhookClusterRoleName := printf "%s-%s-webhook-cr" .Values.operator.name (include "mongodb-kubernetes-operator.namespace" .) }} |
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've changed both names, because one was dynamic and one not - causing upgrade problems. Now both are just a new set of names.
Co-authored-by: Vivek Singh <[email protected]>
… operator name and namespace (mongodb#393) # Summary This pull request introduces Helm chart unit tests to the CI pipeline and ensures consistent naming for ClusterRole and ClusterRoleBinding resources in the Helm chart. The most important changes are grouped below: **Helm Chart Testing Integration:** * Added a `helm-tests` target to the `Makefile` to run Helm chart unit tests using the `helm-unittest` plugin. The target installs the plugin if necessary and runs tests in the `helm_chart` directory. * Created a `test_helm_unit` function in `.evergreen-functions.yml` to execute the new Helm unit tests as part of CI. * Added a `unit_tests_helm` task to `.evergreen.yml` and included it in the `unit_tests_task_group` to ensure Helm unit tests run with other unit tests in the CI pipeline. **Helm Chart Improvements and Testing:** * Updated `operator-roles-webhook.yaml` to dynamically generate consistent names for ClusterRole and ClusterRoleBinding resources based on the operator name and namespace, preventing naming conflicts across multiple installations. * Added a new Helm unit test suite (`webhook_clusterrole_test.yaml`) to verify that ClusterRole and ClusterRoleBinding names are consistent and unique per installation. # Example the new names: **binding** `<name>-<ns>-webhook-crb` **role** ` <name>-<ns>-webhook-cr` old names: **binding** `<name>-<ns>-webhook` **role** `mongodb-kubernetes-operator-mongodb-webhook` ## Proof of Work - green ci - helm chart unit test as part of unit test: [Link](https://spruce.mongodb.com/task/mongodb_kubernetes_unit_tests_unit_tests_helm_patch_b7211ae9f98ec21a895a77f164f74e66519f4bd4_68b6bd8e10a56d0007c1cfc5_25_09_02_09_49_06/logs?execution=0) (IMO that unit test is more for documentation than actually testing, its nice to have a view how those names are generated in the end) ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details --------- Co-authored-by: Vivek Singh <[email protected]>
Summary
This pull request introduces Helm chart unit tests to the CI pipeline and ensures consistent naming for ClusterRole and ClusterRoleBinding resources in the Helm chart. The most important changes are grouped below:
Helm Chart Testing Integration:
Added a
helm-teststarget to theMakefileto run Helm chart unit tests using thehelm-unittestplugin. The target installs the plugin if necessary and runs tests in thehelm_chartdirectory.Created a
test_helm_unitfunction in.evergreen-functions.ymlto execute the new Helm unit tests as part of CI.Added a
unit_tests_helmtask to.evergreen.ymland included it in theunit_tests_task_groupto ensure Helm unit tests run with other unit tests in the CI pipeline.Helm Chart Improvements and Testing:
Updated
operator-roles-webhook.yamlto dynamically generate consistent names for ClusterRole and ClusterRoleBinding resources based on the operator name and namespace, preventing naming conflicts across multiple installations.Added a new Helm unit test suite (
webhook_clusterrole_test.yaml) to verify that ClusterRole and ClusterRoleBinding names are consistent and unique per installation.Example
the new names:
binding
<name>-<ns>-webhook-crbrole
<name>-<ns>-webhook-crold names:
binding
<name>-<ns>-webhookrole
mongodb-kubernetes-operator-mongodb-webhookProof of Work
Checklist
skip-changeloglabel if not needed