Skip to content

Commit

Permalink
fix(webhook): make label selectors unambiguous (cryostatio#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebaron committed Jul 31, 2024
1 parent c7ccef4 commit 25de979
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: cryostat-operator
name: cryostat-operator-cryostat-namespaced
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: cryostat-operator
name: cryostat-operator-cryostat
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ data:
resourceName: d696d7ab.redhat.com
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: cryostat-operator
name: cryostat-operator-manager-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: cryostat-operator
name: cryostat-operator-oauth-client
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
app.kubernetes.io/created-by: cryostat-operator
app.kubernetes.io/instance: webhook-service
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: service
app.kubernetes.io/name: cryostat-operator
app.kubernetes.io/part-of: cryostat-operator
name: cryostat-operator-webhook-service
spec:
Expand All @@ -16,6 +16,7 @@ spec:
protocol: TCP
targetPort: 9443
selector:
app.kubernetes.io/name: cryostat-operator
control-plane: controller-manager
status:
loadBalancer: {}
14 changes: 4 additions & 10 deletions bundle/manifests/cryostat-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring, Developer Tools
containerImage: quay.io/cryostat/cryostat-operator:4.0.0-dev
createdAt: "2024-07-08T19:33:12Z"
createdAt: "2024-07-30T21:00:58Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down Expand Up @@ -970,19 +970,22 @@ spec:
serviceAccountName: cryostat-operator-service-account
deployments:
- label:
app.kubernetes.io/name: cryostat-operator
control-plane: controller-manager
name: cryostat-operator-controller-manager
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: cryostat-operator
control-plane: controller-manager
strategy: {}
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/name: cryostat-operator
control-plane: controller-manager
spec:
containers:
Expand Down Expand Up @@ -1046,21 +1049,12 @@ spec:
capabilities:
drop:
- ALL
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
serviceAccountName: cryostat-operator-service-account
terminationGracePeriodSeconds: 10
volumes:
- name: cert
secret:
defaultMode: 420
secretName: webhook-server-cert
permissions:
- rules:
- apiGroups:
Expand Down
2 changes: 2 additions & 0 deletions bundle/manifests/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
cert-manager.io/inject-ca-from: cryostat-operator-system/cryostat-operator-serving-cert
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
labels:
app.kubernetes.io/name: cryostat-operator
name: cryostats.operator.cryostat.io
spec:
conversion:
Expand Down
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace: cryostat-operator-system
namePrefix: cryostat-operator-

# Labels to add to all resources and selectors.
#commonLabels:
# someName: someValue
commonLabels:
app.kubernetes.io/name: cryostat-operator

# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
Expand Down
30 changes: 15 additions & 15 deletions config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ patchesJson6902:
version: v1alpha1
kind: ClusterServiceVersion
name: cryostat-operator.v0.0.0
#- target:
# group: apps
# version: v1
# kind: Deployment
# name: controller-manager
# namespace: system
# patch: |-
# # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
# # Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment.
# - op: remove
# path: /spec/template/spec/containers/1/volumeMounts/0
# # Remove the "cert" volume, since OLM will create and mount a set of certs.
# # Update the indices in this path if adding or removing volumes in the manager's Deployment.
# - op: remove
# path: /spec/template/spec/volumes/0
- target:
group: apps
version: v1
kind: Deployment
name: controller-manager
namespace: system
patch: |-
# Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
# Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment.
- op: remove
path: /spec/template/spec/containers/0/volumeMounts/0
# Remove the "cert" volume, since OLM will create and mount a set of certs.
# Update the indices in this path if adding or removing volumes in the manager's Deployment.
- op: remove
path: /spec/template/spec/volumes/0

0 comments on commit 25de979

Please sign in to comment.