feat: adds labels for better discovery#139
Conversation
WalkthroughAdds dedicated label helper functions for token-related Kubernetes resources, updates the token manager to use them (removing the former commonLabels), and updates tests to use t.Context() and fake.NewClientset(). No exported APIs or core control flow logic were changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
maas-api/internal/tier/mapper_test.go(2 hunks)maas-api/internal/token/labels.go(1 hunks)maas-api/internal/token/manager.go(2 hunks)maas-api/internal/token/reviewer_test.go(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (6)
maas-api/internal/token/reviewer_test.go (2)
92-92: LGTM: Modern fake clientset constructor.The switch from
fake.NewSimpleClientset()tofake.NewClientset()aligns with current client-go best practices.
104-104: LGTM: Test context best practice.Using
t.Context()ensures the context is automatically canceled when the test completes, improving resource management and aligning with Go 1.21+ testing patterns.maas-api/internal/tier/mapper_test.go (1)
158-158: LGTM: Consistent fake clientset migration.Both test functions correctly migrate to
fake.NewClientset(), maintaining consistency with the modern client-go constructor pattern used across the test suite.Also applies to: 197-197
maas-api/internal/token/manager.go (2)
137-137: LGTM: Specialized namespace labeling.The migration from
commonLabels()tonamespaceLabels(m.tenantName, tier)provides clearer intent and ensures namespace-specific labels are applied consistently.
174-174: LGTM: Specialized service account labeling.The migration to
serviceAccountLabels(m.tenantName, userTier, username)adds username-specific labeling, enabling better resource discovery and filtering by user.maas-api/internal/token/labels.go (1)
3-11: LGTM: Namespace labels follow Kubernetes best practices.The label structure correctly uses standard
app.kubernetes.io/*labels and custommaas.opendatahub.io/*labels. Thetier-namespace: "true"marker enables easy discovery of tier namespaces.
dmytro-zaharnytskyi
left a comment
There was a problem hiding this comment.
Nothing to add other than Coderabbit comment on username, as option - replace username label with {user-id: } and move raw username to an annotation.
But from other side, we can assume that there is no invalid username exists in maas.opendatahub.io/ :)
Maybe we don't need it yet. I will remove. Speculative |
Signed-off-by: Bartosz Majsak <bartosz.majsak@gmail.com>
|
/label tide/merge-method-squash |
|
@israel-hdez: The label(s) DetailsIn 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. |
|
/label tide/merge-method-squash |
|
/lgtm |
|
/close |
|
@israel-hdez: Closed this PR. DetailsIn 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. |
|
/reopen |
|
@israel-hdez: Reopened this PR. DetailsIn 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. |
|
@bartoszmajsak: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bartoszmajsak, dmytro-zaharnytskyi, israel-hdez, jland-redhat The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Bartosz Majsak <bartosz.majsak@gmail.com>
Summary by CodeRabbit