Files
library-charts/library/common-test/tests/defaults/defaults-test.yaml
Kjeld Schouten 128b52ca6d fix(common): limit default emptydir size for memory emptyDir (#604)
**Description**
Currently emptyDir ramdisks are set to have unlimited size.
This puts a limit to that, sized in accordance to
.values.resources.limits.memory

Yes this means an App consuming all space in an emptyDir can exceed the
limits, but at least it prevents attacks where host OOMs can be
triggered by oversaturating a memory-backed emptyDir

⚒️ Fixes  #602 

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 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

** 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>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
2023-11-18 12:01:16 +01:00

140 lines
3.8 KiB
YAML

suite: default test
templates:
- common.yaml
chart:
appVersion: &appVer v9.9.9
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should pass with defaults
set:
service:
main:
enabled: true
ports:
main:
enabled: true
port: 1025
workload:
main:
enabled: true
podSpec:
containers:
main:
enabled: true
asserts:
- hasDocuments:
count: 2
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: &serviceDoc 1
isKind:
of: Service
- documentIndex: *serviceDoc
isAPIVersion:
of: v1
- documentIndex: *deploymentDoc
isAPIVersion:
of: apps/v1
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
replicas: 1
revisionHistoryLimit: 3
strategy:
type: Recreate
- documentIndex: *deploymentDoc
isSubset:
path: spec.template.spec
content:
serviceAccountName: default
automountServiceAccountToken: false
runtimeClassName:
hostNetwork: false
hostPID: false
shareProcessNamespace: false
enableServiceLinks: false
restartPolicy: Always
dnsPolicy: ClusterFirst
dnsConfig:
options:
- name: ndots
value: "1"
terminationGracePeriodSeconds: 60
securityContext:
fsGroup: 568
fsGroupChangePolicy: OnRootMismatch
supplementalGroups:
- 568
sysctls: []
- documentIndex: *deploymentDoc
equal:
path: metadata.labels
value:
app: common-test-1.0.0
release: test-release-name
helm-revision: "0"
helm.sh/chart: common-test-1.0.0
app.kubernetes.io/name: common-test
app.kubernetes.io/instance: test-release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/version: *appVer
- documentIndex: *deploymentDoc
isSubset:
path: spec.template.spec
content:
volumes:
- name: devshm
emptyDir:
medium: Memory
sizeLimit: 8Gi
- name: shared
emptyDir: {}
- name: tmp
emptyDir:
medium: Memory
sizeLimit: 8Gi
- name: varlogs
emptyDir:
medium: Memory
sizeLimit: 8Gi
- name: varrun
emptyDir:
medium: Memory
sizeLimit: 8Gi
- documentIndex: *deploymentDoc
isSubset:
path: spec.template.spec.containers[0]
content:
livenessProbe:
failureThreshold: 5
httpGet:
path: /
port: 1025
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
failureThreshold: 5
httpGet:
path: /
port: 1025
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 2
timeoutSeconds: 5
startupProbe:
failureThreshold: 60
tcpSocket:
port: 1025
initialDelaySeconds: 10
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 2