Skip to content

Commit

Permalink
Merge pull request #433 from anchore/enterprise-topologySpreadConstra…
Browse files Browse the repository at this point in the history
…ints

enterprise: adding support for topologySpreadConstraints
  • Loading branch information
HN23 authored Jan 17, 2025
2 parents 0e4d729 + d95a110 commit fdf265c
Show file tree
Hide file tree
Showing 15 changed files with 683 additions and 218 deletions.
2 changes: 1 addition & 1 deletion stable/enterprise/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: enterprise
version: "3.3.2"
version: "3.3.3"
appVersion: "5.13.1"
kubeVersion: 1.23.x - 1.31.x || 1.23.x-x - 1.31.x-x
description: |
Expand Down
429 changes: 221 additions & 208 deletions stable/enterprise/README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions stable/enterprise/templates/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ nodeSelector: {{- toYaml . | nindent 2 }}
{{- with (default .Values.affinity (index .Values (print $component)).affinity) }}
affinity: {{- toYaml . | nindent 2 }}
{{- end }}
{{- with (default .Values.topologySpreadConstraints (index .Values (print $component)).topologySpreadConstraints) }}
topologySpreadConstraints: {{- toYaml . | nindent 2 }}
{{- end }}
{{- with (default .Values.tolerations (index .Values (print $component)).tolerations) }}
tolerations: {{- toYaml . | nindent 2 }}
{{- end }}
Expand Down
38 changes: 37 additions & 1 deletion stable/enterprise/tests/analyzer_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,4 +437,40 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-analyzer.myothersuffix.svc.cluster.local
value: test-release-enterprise-analyzer.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
template: analyzer_deployment.yaml
set:
analyzer:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
39 changes: 38 additions & 1 deletion stable/enterprise/tests/api_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,41 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-api.myothersuffix.svc.cluster.local
value: test-release-enterprise-api.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
documentIndex: 0
template: api_deployment.yaml
set:
api:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
39 changes: 38 additions & 1 deletion stable/enterprise/tests/catalog_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,4 +547,41 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-catalog.myothersuffix.svc.cluster.local
value: test-release-enterprise-catalog.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
documentIndex: 0
template: catalog_deployment.yaml
set:
catalog:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
27 changes: 27 additions & 0 deletions stable/enterprise/tests/common_helpers_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1008,3 +1008,30 @@ tests:
content:
nodePort: 9999
count: 1

- it: should render global topologySpreadConstraints
templates: *test_templates
documentIndex: 0
set:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
37 changes: 37 additions & 0 deletions stable/enterprise/tests/datasyncer_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,40 @@ tests:
app.kubernetes.io/name: test-release-enterprise
app.kubernetes.io/component: datasyncer
count: 1

- it: should render component topologySpreadConstraints
documentIndex: 0
template: datasyncer_deployment.yaml
set:
dataSyncer:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
39 changes: 38 additions & 1 deletion stable/enterprise/tests/notifications_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,41 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-notifications.myothersuffix.svc.cluster.local
value: test-release-enterprise-notifications.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
documentIndex: 0
template: notifications_deployment.yaml
set:
notifications:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
39 changes: 38 additions & 1 deletion stable/enterprise/tests/policyengine_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -506,4 +506,41 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-policy.myothersuffix.svc.cluster.local
value: test-release-enterprise-policy.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
documentIndex: 0
template: policyengine_deployment.yaml
set:
policyEngine:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
39 changes: 38 additions & 1 deletion stable/enterprise/tests/reports_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,41 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-reports.myothersuffix.svc.cluster.local
value: test-release-enterprise-reports.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
documentIndex: 0
template: reports_deployment.yaml
set:
reports:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foo
matchLabelKeys:
- pod-template-hash
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: foobar
matchLabelKeys:
- pod-template-hash
Loading

0 comments on commit fdf265c

Please sign in to comment.