Skip to content

Commit

Permalink
Add test for nodeAffinity override
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Feurer committed Sep 6, 2023
1 parent 2d945b6 commit 33e2922
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"template": "https://github.com/projectsyn/commodore-component-template.git",
"commit": "fc8ae18a6798d5b232442630883e5ec9b8636d09",
"commit": "1062a6134febddc4e4b5479b41afe4ab0f6face0",
"checkout": "main",
"context": {
"cookiecutter": {
"name": "openshift4-operators",
"slug": "openshift4-operators",
"parameter_key": "openshift4_operators",
"test_cases": "openshift-operators-redhat openshift-operators openshift-operators-custom operator-subscription",
"test_cases": "openshift-operators-redhat openshift-operators openshift-operators-custom operator-subscription affinity-override",
"add_lib": "y",
"add_pp": "n",
"add_golden": "y",
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/release.yaml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/.github/workflows/release.yaml b/.github/workflows/release.yaml (rejected hunks)
@@ -8,7 +8,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Build changelog from PRs with labels
10 changes: 6 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
- lint_yaml
- lint_adoc
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run ${{ matrix.command }}
run: make ${{ matrix.command }}
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: snow-actions/[email protected]
with:
args: 'check'
Expand All @@ -36,11 +36,12 @@ jobs:
- openshift-operators
- openshift-operators-custom
- operator-subscription
- affinity-override
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: ${{ env.COMPONENT_NAME }}
- name: Compile component
Expand All @@ -54,11 +55,12 @@ jobs:
- openshift-operators
- openshift-operators-custom
- operator-subscription
- affinity-override
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: ${{ env.COMPONENT_NAME }}
- name: Golden diff
Expand Down
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= openshift-operators-redhat
test_instances = tests/openshift-operators-redhat.yml tests/openshift-operators.yml tests/openshift-operators-custom.yml tests/operator-subscription.yml
test_instances = tests/openshift-operators-redhat.yml tests/openshift-operators.yml tests/openshift-operators-custom.yml tests/operator-subscription.yml tests/affinity-override.yml
8 changes: 4 additions & 4 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ local sub =
affinity: {
nodeAffinity: {
requiredDuringSchedulingIgnoredDuringExecution: {
nodeSelectorTerms: [{
matchExpressions: [{
nodeSelectorTerms: [ {
matchExpressions: [ {
key: 'node-role.kubernetes.io/infra',
operator: 'Exists',
}],
}],
} ],
} ],
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
":gitSignOff",
":disableDependencyDashboard"
],
"ignorePaths": [
".github/**"
],
"postUpgradeTasks": {
"commands": [
"make gen-golden-all"
Expand Down
19 changes: 19 additions & 0 deletions tests/affinity-override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
applications:
- openshift4-operators as affinity-override

parameters:
affinity_override:
useCustomNamespace: true
subscription:
name: foo
channel: stable
spec:
installPlanApproval: Manual
config:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift.io/node-selector: node-role.kubernetes.io/infra=
labels:
name: affinity-override
openshift.io/cluster-monitoring: 'false'
openshift.io/user-monitoring: 'false'
name: affinity-override
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations: {}
labels:
name: affinity-override
name: affinity-override
namespace: affinity-override
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations: {}
labels:
name: foo
name: foo
namespace: affinity-override
spec:
channel: stable
config:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
installPlanApproval: Manual
name: foo
source: certified-operators
sourceNamespace: openshift-marketplace

0 comments on commit 33e2922

Please sign in to comment.