Skip to content

Commit

Permalink
enterprise: adding topologySpreadConstraints tests
Browse files Browse the repository at this point in the history
Signed-off-by: Hung Nguyen <[email protected]>
  • Loading branch information
HN23 committed Jan 17, 2025
1 parent 0860dc9 commit d95a110
Show file tree
Hide file tree
Showing 11 changed files with 405 additions and 9 deletions.
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
39 changes: 38 additions & 1 deletion stable/enterprise/tests/reportsworker_resources_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,41 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: ANCHORE_ENDPOINT_HOSTNAME
value: test-release-enterprise-reportsworker.myothersuffix.svc.cluster.local
value: test-release-enterprise-reportsworker.myothersuffix.svc.cluster.local

- it: should render component topologySpreadConstraints
documentIndex: 0
template: reportsworker_deployment.yaml
set:
reportsWorker:
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 d95a110

Please sign in to comment.