From a5f40ebb35403b8c66eb6d5a3de2c45b699863d4 Mon Sep 17 00:00:00 2001 From: Ales Verbic Date: Tue, 24 Sep 2024 14:15:46 -0400 Subject: [PATCH] feat: add ingressClassName support to Ingress Signed-off-by: Ales Verbic --- .github/workflows/pr.yaml | 4 ++-- deploy_config_generator/output/kube_ingress.py | 3 +++ docs/plugin_kube_ingress.md | 1 + tests/integration/kube_basic/deploy/config.yml | 16 ++++++++++++++++ ...gress-002-test-ingress-with-class-name.yaml | 18 ++++++++++++++++++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 tests/integration/kube_basic/expected_output/kube_ingress-002-test-ingress-with-class-name.yaml diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7b5cfa8..c4e881b 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -7,8 +7,8 @@ jobs: Run-CI-Script: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.10' - uses: actions/checkout@v2 - run: scripts/ci.sh diff --git a/deploy_config_generator/output/kube_ingress.py b/deploy_config_generator/output/kube_ingress.py index b4c2d64..aa420c0 100644 --- a/deploy_config_generator/output/kube_ingress.py +++ b/deploy_config_generator/output/kube_ingress.py @@ -63,6 +63,9 @@ class OutputPlugin(kube_common.OutputPlugin): type='dict', fields=copy.deepcopy(INGRESS_BACKEND_FIELD_SPEC), ), + ingress_class_name=dict( + type='str', + ), rules=dict( type='list', subtype='dict', diff --git a/docs/plugin_kube_ingress.md b/docs/plugin_kube_ingress.md index 4a59177..8c50fd5 100644 --- a/docs/plugin_kube_ingress.md +++ b/docs/plugin_kube_ingress.md @@ -28,6 +28,7 @@ Name | Type | Required | Default | Description `spec . default_backend . service . port`|`dict`|no|| `spec . default_backend . service . port . name`|`str`|no|| `spec . default_backend . service . port . number`|`int`|no|| +`spec . ingress_class_name`|`str`|no|| `spec . rules`|`list` (of `dict`)|no|| `spec . rules . host`|`str`|no|| `spec . rules . http`|`dict`|no|| diff --git a/tests/integration/kube_basic/deploy/config.yml b/tests/integration/kube_basic/deploy/config.yml index f5730d4..992b3e6 100644 --- a/tests/integration/kube_basic/deploy/config.yml +++ b/tests/integration/kube_basic/deploy/config.yml @@ -153,6 +153,22 @@ kube_ingresses: name: test port: number: 80 + - metadata: + name: test-ingress-with-class-name + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + spec: + ingress_class_name: kong + rules: + - http: + paths: + - path: /testpath + path_type: Prefix + backend: + service: + name: test + port: + number: 80 kube_pvcs: - metadata: diff --git a/tests/integration/kube_basic/expected_output/kube_ingress-002-test-ingress-with-class-name.yaml b/tests/integration/kube_basic/expected_output/kube_ingress-002-test-ingress-with-class-name.yaml new file mode 100644 index 0000000..9c35ddf --- /dev/null +++ b/tests/integration/kube_basic/expected_output/kube_ingress-002-test-ingress-with-class-name.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + name: test-ingress-with-class-name +spec: + ingressClassName: kong + rules: + - http: + paths: + - backend: + service: + name: test + port: + number: 80 + path: /testpath + pathType: Prefix