Add standard Kubernetes labels to controller-manager deployment#1989
Conversation
Testing Verification ✅All testing checkboxes from the PR description have been verified on a live OpenShift cluster. 1. ✅ Verified labels are applied to deploymentDeployed the operator using $ oc get deployment openshift-adp-controller-manager -n openshift-adp -o yaml | grep -A 4 "labels:"
labels:
app.kubernetes.io/component: controller-manager
app.kubernetes.io/name: oadp-operator
app.kubernetes.io/part-of: oadp
control-plane: controller-manager2. ✅ Verified labels are present on running podsPod selector with the new label works correctly: $ oc get pods -n openshift-adp -l app.kubernetes.io/name=oadp-operator
NAME READY STATUS RESTARTS AGE
openshift-adp-controller-manager-749866fbbf-5j2xg 1/1 Running 0 5m
$ oc get pods -n openshift-adp -l app.kubernetes.io/name=oadp-operator --show-labels
NAME READY STATUS RESTARTS AGE LABELS
openshift-adp-controller-manager-749866fbbf-5j2xg 1/1 Running 0 5m app.kubernetes.io/component=controller-manager,app.kubernetes.io/name=oadp-operator,app.kubernetes.io/part-of=oadp,control-plane=controller-manager,pod-template-hash=749866fbbf3. ✅ Verified labels are present in CSV after bundle regenerationCSV contains the labels in both deployment metadata and pod template: deployments:
- label:
app.kubernetes.io/component: controller-manager
app.kubernetes.io/name: oadp-operator
app.kubernetes.io/part-of: oadp
control-plane: controller-manager
spec:
template:
metadata:
labels:
app.kubernetes.io/component: controller-manager
app.kubernetes.io/name: oadp-operator
app.kubernetes.io/part-of: oadp
control-plane: controller-managerNetworkPolicy Use CaseThese labels enable precise NetworkPolicy targeting. Example: apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: oadp-controller-egress
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: oadp-operator
app.kubernetes.io/component: controller-manager
# ... egress rulesThis selector will only match the OADP controller-manager pods, avoiding the issue mentioned in #1988 where the generic |
Add three standard Kubernetes labels to the openshift-adp-controller-manager deployment to enable more specific pod selection in NetworkPolicies: - app.kubernetes.io/name: oadp-operator - app.kubernetes.io/component: controller-manager - app.kubernetes.io/part-of: oadp-operator The current label 'control-plane: controller-manager' is too generic and could match unintended pods when used in NetworkPolicy selectors. These labels follow the recommended Kubernetes labeling conventions and match the existing standard used in config/prometheus/monitor.yaml. Fixes: openshift#1988 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
9c5e238 to
7706183
Compare
|
looks like sir health check isn't working |
|
/retest |
1 similar comment
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kaovilai, shubham-pampattiwar, weshayutin 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 |
|
@shubham-pampattiwar: 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. |
Summary
This PR adds standard Kubernetes labels to the
openshift-adp-controller-managerdeployment to enable more specific NetworkPolicy targeting.Changes
Adds the following labels to both the Deployment metadata and Pod template:
app.kubernetes.io/name: oadp-operatorapp.kubernetes.io/component: controller-managerapp.kubernetes.io/part-of: oadpMotivation
The current generic label
control-plane: controller-managercould inadvertently match unintended pods when used in NetworkPolicy selectors. These more specific labels follow Kubernetes recommended practices and allow for precise pod targeting.Files Changed
config/manager/manager.yaml- Added labels to deployment templatebundle/manifests/oadp-operator.clusterserviceversion.yaml- Regenerated withmake bundleTesting
Fixes #1988
🤖 Generated with Claude Code