Skip to content

Add checksums and basic test #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o errtrace

HELM="${HELM:-helm}"

cd "tests/values"

for file in *yaml; do
echo "helm $file"
${HELM} template ../../ -f "${file}" --include-crds --namespace test-namespace > "../outputs/${file}"
done
2 changes: 2 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ spec:
{{ .Values.vxlanController.metadataKey }}: "true"
{{- end }}
annotations:
checksum/config: {{ include (print .Template.BasePath "/sftp-config.yaml") . | sha256sum }}
checksum/keys: {{ include (print .Template.BasePath "/authorized-keys-config.yaml") . | sha256sum }}
{{- if .Values.vxlanController.enabled }}
{{ .Values.vxlanController.annotationKey }}: |
{{ .Values.vxlanController.network }}
Expand Down
107 changes: 107 additions & 0 deletions tests/outputs/empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
# Source: sftp-server/templates/sftp-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: release-name-sftp-server-users
data:
users.conf: |
sftp:::
---
# Source: sftp-server/templates/data-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: release-name-sftp-server-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "20Gi"
---
# Source: sftp-server/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: release-name-sftp-server
labels:
app.kubernetes.io/name: sftp-server
helm.sh/chart: sftp-server-0.3.2
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 22
targetPort: ssh
protocol: TCP
name: ssh
selector:
app.kubernetes.io/name: sftp-server
app.kubernetes.io/instance: release-name
---
# Source: sftp-server/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-sftp-server
labels:
app.kubernetes.io/name: sftp-server
helm.sh/chart: sftp-server-0.3.2
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: sftp-server
app.kubernetes.io/instance: release-name
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: sftp-server
app.kubernetes.io/instance: release-name
annotations:
checksum/config: c59a65a89dc772d7099b3ba9ce2e7c06f991b0dcaa13288c1c85ed81a9c62ddc
checksum/keys: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
spec:
initContainers:
containers:
- name: sftp-server
image: "quay.io/openvnf/sftp:alpine-3.7"
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
add: ["NET_ADMIN"]
ports:
- name: ssh
containerPort: 22
protocol: TCP
volumeMounts:
- name: sftp-config
mountPath: /etc/sftp/
- name: data
mountPath: /home/sftp/
livenessProbe:
tcpSocket:
port: 22
readinessProbe:
tcpSocket:
port: 22
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
volumes:
- name: sftp-config
configMap:
name: release-name-sftp-server-users
- name: data
persistentVolumeClaim:
claimName: release-name-sftp-server-data
1 change: 1 addition & 0 deletions tests/values/empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---