Files
truecharts/charts/library/common-test/tests/addons/tailscale_test.yaml
T
b62e536593 feat(common): BREAKING CHANGE refactor add-on system (#31167)
**Description**

This PR updates the add-on system to allow for more end-user flexibility
It basically moves add-on container configuration to values.yaml, to
expose all container options to end users.

Fixes: #27351
Fixes: #31876

**⚙️ Type of change**

- [ ] ⚙️ 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:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 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
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning
- [ ] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

**➕ App addition**

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

- [ ] 🖼️ 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._

---------

Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: kqmaverick <kqmaverick@gmail.com>
Co-authored-by: Stavros Kois <s.kois@outlook.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
2025-03-02 16:14:39 +01:00

283 lines
7.7 KiB
YAML

suite: addon tailscale
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: addon enabled should pass
set:
resources:
limits:
nvidia.com/gpu: 1
workload:
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
service:
main:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
port: 8080
addons:
tailscale:
enabled: true
container:
env:
TS_AUTH_KEY: something
asserts:
- hasDocuments:
count: 2
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec
content:
automountServiceAccountToken: true
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec.containers[0]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
nvidia.com/gpu: 1
requests:
cpu: 10m
memory: 50Mi
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: test-release-name-common-test-tailscale
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec.containers[1]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
requests:
cpu: 10m
memory: 50Mi
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_AUTH_KEY
value: something
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec.containers[1].securityContext
content:
runAsUser: 1000
runAsGroup: 1000
runAsNonRoot: true
readOnlyRootFilesystem: true
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.volumes
content:
name: tailscalestate
emptyDir: {}
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].volumeMounts
content:
name: tailscalestate
mountPath: /var/lib/tailscale
readOnly: false
- it: addon enabled should pass with userspace to false
set:
resources:
limits:
nvidia.com/gpu: 1
workload:
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
service:
main:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
port: 8080
addons:
tailscale:
enabled: true
container:
env:
TS_AUTH_KEY: something
TS_USERSPACE: false
asserts:
- hasDocuments:
count: 2
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec.containers[0]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
nvidia.com/gpu: 1
requests:
cpu: 10m
memory: 50Mi
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: test-release-name-common-test-tailscale
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec.containers[1]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
requests:
cpu: 10m
memory: 50Mi
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_AUTH_KEY
value: something
- documentIndex: *DeploymentDocument
isSubset:
path: spec.template.spec.containers[1].securityContext
content:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
- it: addon enabled should pass with state set to hostpath
set:
persistence:
tailscalestate:
type: hostPath
hostPath: /test
workload:
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
service:
main:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
port: 8080
addons:
tailscale:
enabled: true
container:
env:
TS_AUTH_KEY: something
asserts:
- hasDocuments:
count: 2
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].name
value: test-release-name-common-test
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: test-release-name-common-test-tailscale
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.volumes
content:
name: tailscalestate
hostPath:
path: /test
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].volumeMounts
content:
name: tailscalestate
mountPath: /var/lib/tailscale
readOnly: false