Files
library-charts/library/common-test/tests/webhooks/data_test.yaml
Kjeld Schouten 093ce5a52f feat: add webhook rendering support (#491)
**Description**
We currently have multiple charts with custom webhooks.
This leads to a relatively high risk of them having different format and
different fixes applied.

We should instead ensure webhooks are rendered via common

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Co-authored-by: Stavros kois <s.kois@outlook.com>
2023-07-17 11:52:23 +02:00

216 lines
6.3 KiB
YAML

suite: webhook data test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should create the webhook
set:
k1: some-name
k2: v1
k3: v1beta1
k4: /some-path
k5: 5000
k6: "Y2FidWx0dXJl"
k7: https://some-url
k8: Fail
k9: Exact
k10: None
k11: IfNeeded
k12: CREATE
k13: UPDATE
k14: ""
k15: some-group
k16: v1
k17: v1beta
k18: pods
k19: configmaps
k20: mutating
webhook:
my-webhook1:
enabled: true
type: "{{ .Values.k20 }}"
webhooks:
- name: "{{ .Values.k1 }}"
failurePolicy: "{{ .Values.k8 }}"
matchPolicy: "{{ .Values.k9 }}"
sideEffects: "{{ .Values.k10 }}"
reinvocationPolicy: "{{ .Values.k11 }}"
timeoutSeconds: 28
admissionReviewVersions: &admissionReviewVersions
- "{{ .Values.k2 }}"
- "{{ .Values.k3 }}"
clientConfig:
caBundle: "{{ .Values.k6 }}"
service:
name: "{{ .Values.k1 }}"
namespace: "{{ .Release.Namespace }}"
path: "{{ .Values.k4 }}"
port: "{{ .Values.k5 }}"
rules: &rules
- operations:
- "{{ .Values.k12 }}"
- "{{ .Values.k13 }}"
apiGroups:
- "{{ .Values.k14 }}"
- "{{ .Values.k15 }}"
apiVersions:
- "{{ .Values.k16 }}"
- "{{ .Values.k17 }}"
resources:
- "{{ .Values.k18 }}"
- "{{ .Values.k19 }}"
- name: "{{ .Values.k1 }}"
failurePolicy: "{{ .Values.k8 }}"
matchPolicy: "{{ .Values.k9 }}"
sideEffects: "{{ .Values.k10 }}"
reinvocationPolicy: "{{ .Values.k11 }}"
timeoutSeconds: 28
admissionReviewVersions: *admissionReviewVersions
clientConfig:
caBundle: "{{ .Values.k6 }}"
url: "{{ .Values.k7 }}"
rules: *rules
my-webhook2:
enabled: true
type: validating
webhooks:
- name: some-other-name
failurePolicy: Ignore
matchPolicy: Equivalent
sideEffects: None
timeoutSeconds: 20
admissionReviewVersions:
- v2
- v2beta
clientConfig:
caBundle: S2WidxffdXJ3l
url: "{{ .Values.k7 }}"
rules:
- operations:
- DELETE
- PATCH
apiGroups:
- ""
- some-other-group
apiVersions:
- v1
- v2
resources:
- pods
- configmaps
scope: Namespaced
asserts:
- documentIndex: &webhookMutDoc 0
isKind:
of: MutatingWebhookConfiguration
- documentIndex: *webhookMutDoc
isAPIVersion:
of: admissionregistration.k8s.io/v1
- documentIndex: *webhookMutDoc
equal:
path: metadata.name
value: test-release-name-common-test-my-webhook1
- documentIndex: *webhookMutDoc
equal:
path: webhooks[0]
value:
name: some-name
failurePolicy: Fail
matchPolicy: Exact
reinvocationPolicy: IfNeeded
sideEffects: None
timeoutSeconds: 28
admissionReviewVersions:
- v1
- v1beta1
clientConfig:
caBundle: Y2FidWx0dXJl
service:
name: some-name
namespace: test-release-namespace
path: /some-path
port: 5000
rules:
- operations:
- CREATE
- UPDATE
apiGroups:
- ""
- some-group
apiVersions:
- v1
- v1beta
resources:
- pods
- configmaps
- documentIndex: *webhookMutDoc
equal:
path: webhooks[1]
value:
name: some-name
failurePolicy: Fail
matchPolicy: Exact
reinvocationPolicy: IfNeeded
sideEffects: None
timeoutSeconds: 28
admissionReviewVersions:
- v1
- v1beta1
clientConfig:
caBundle: Y2FidWx0dXJl
url: https://some-url
rules:
- operations:
- CREATE
- UPDATE
apiGroups:
- ""
- some-group
apiVersions:
- v1
- v1beta
resources:
- pods
- configmaps
- documentIndex: &WebhookValDoc 1
isKind:
of: ValidatingWebhookConfiguration
- documentIndex: *WebhookValDoc
isAPIVersion:
of: admissionregistration.k8s.io/v1
- documentIndex: *WebhookValDoc
equal:
path: metadata.name
value: test-release-name-common-test-my-webhook2
- documentIndex: *WebhookValDoc
equal:
path: webhooks[0]
value:
name: some-other-name
failurePolicy: Ignore
matchPolicy: Equivalent
sideEffects: None
timeoutSeconds: 20
admissionReviewVersions:
- v2
- v2beta
clientConfig:
caBundle: S2WidxffdXJ3l
url: https://some-url
rules:
- operations:
- DELETE
- PATCH
apiGroups:
- ""
- some-other-group
apiVersions:
- v1
- v2
resources:
- pods
- configmaps
scope: Namespaced