Skip to content
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

anchore-admission-controller: adding topologySpreadConstraints #408

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

HN23
Copy link
Member

@HN23 HN23 commented Oct 8, 2024

without setting:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: blah-anchore-admission-controller
  labels:
    app.kubernetes.io/name: anchore-admission-controller
    helm.sh/chart: anchore-admission-controller-0.6.3
    app.kubernetes.io/instance: blah
    app.kubernetes.io/version: "0.6.2"
    app.kubernetes.io/managed-by: Helm
  annotations:
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: anchore-admission-controller
      app.kubernetes.io/instance: blah
  template:
    metadata:
      labels:
        app.kubernetes.io/name: anchore-admission-controller
        helm.sh/chart: anchore-admission-controller-0.6.3
        app.kubernetes.io/instance: blah
        app.kubernetes.io/version: "0.6.2"
        app.kubernetes.io/managed-by: Helm
      annotations:
    spec:
      serviceAccountName: blah-anchore-admission-controller
      volumes:
      - name: serving-cert
        secret:
          defaultMode: 420
          secretName: anchore-admission-controller-certs
      - name: controller-config
        configMap:
          name: blah-controller-config
      - name: anchore-auth
        secret:
          secretName: blah-anchore-admission-controller
      containers:
      - name: anchore-admission-controller
        image: "anchore/kubernetes-admission-controller:v0.6.2"
        imagePullPolicy: IfNotPresent
        command:
        - "/ko-app/kubernetes-admission-controller"
        - "--audit-log-path=-"
        - "--tls-cert-file=/var/serving-cert/tls.crt"
        - "--tls-private-key-file=/var/serving-cert/tls.key"
        - "-v3"
        - "--secure-port=8443"
        ports:
        - containerPort: 8443
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8443
            scheme: HTTPS
        volumeMounts:
        - mountPath: /var/serving-cert
          name: serving-cert
          readOnly: true
        - mountPath: /config
          name: controller-config
        - mountPath: /credentials
          name: anchore-auth
        env:
        - name: CONFIG_FILE_PATH
          value: /config/config.json
        - name: CREDENTIALS_FILE_PATH
          value: /credentials/credentials.json
        resources:
            {}

setting example:

kind: Deployment
metadata:
  name: blah-anchore-admission-controller
  labels:
    app.kubernetes.io/name: anchore-admission-controller
    helm.sh/chart: anchore-admission-controller-0.6.3
    app.kubernetes.io/instance: blah
    app.kubernetes.io/version: "0.6.2"
    app.kubernetes.io/managed-by: Helm
  annotations:
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: anchore-admission-controller
      app.kubernetes.io/instance: blah
  template:
    metadata:
      labels:
        app.kubernetes.io/name: anchore-admission-controller
        helm.sh/chart: anchore-admission-controller-0.6.3
        app.kubernetes.io/instance: blah
        app.kubernetes.io/version: "0.6.2"
        app.kubernetes.io/managed-by: Helm
      annotations:
    spec:
      serviceAccountName: blah-anchore-admission-controller
      volumes:
      - name: serving-cert
        secret:
          defaultMode: 420
          secretName: anchore-admission-controller-certs
      - name: controller-config
        configMap:
          name: blah-controller-config
      - name: anchore-auth
        secret:
          secretName: blah-anchore-admission-controller
      containers:
      - name: anchore-admission-controller
        image: "anchore/kubernetes-admission-controller:v0.6.2"
        imagePullPolicy: IfNotPresent
        command:
        - "/ko-app/kubernetes-admission-controller"
        - "--audit-log-path=-"
        - "--tls-cert-file=/var/serving-cert/tls.crt"
        - "--tls-private-key-file=/var/serving-cert/tls.key"
        - "-v3"
        - "--secure-port=8443"
        ports:
        - containerPort: 8443
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8443
            scheme: HTTPS
        volumeMounts:
        - mountPath: /var/serving-cert
          name: serving-cert
          readOnly: true
        - mountPath: /config
          name: controller-config
        - mountPath: /credentials
          name: anchore-auth
        env:
        - name: CONFIG_FILE_PATH
          value: /config/config.json
        - name: CREDENTIALS_FILE_PATH
          value: /credentials/credentials.json
        resources:
            {}
      topologySpreadConstraints:
        - labelSelector:
            matchLabels:
              foo: bar
          maxSkew: 1
          topologyKey: zone
          whenUnsatisfiable: DoNotSchedule

@HN23 HN23 requested a review from blang9238 October 8, 2024 16:30
@HN23 HN23 requested a review from a team as a code owner October 8, 2024 16:30
Copy link
Contributor

@blang9238 blang9238 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@InfraInnovator InfraInnovator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@HN23 HN23 merged commit 62d0980 into main Oct 9, 2024
9 checks passed
@HN23 HN23 deleted the admission-controller-topologySpreadConstraints branch October 9, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants