rancher-partner-charts/charts/kubecost/cost-analyzer/2.4.2/templates/tests/basic-health.yaml

49 lines
1.2 KiB
YAML

---
apiVersion: v1
kind: Pod
metadata:
name: basic-health
namespace: {{ .Release.Namespace }}
annotations:
{{- include "kubecost.test.annotations" . | nindent 4 }}
labels:
app: basic-health
app.kubernetes.io/name: basic-health
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
automountServiceAccountToken: false
restartPolicy: Never
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
containers:
- name: test-kubecost
image: alpine/k8s:1.26.9
securityContext:
privileged: false
capabilities:
drop:
- ALL
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
command:
- /bin/sh
args:
- -c
- >-
svc="{{ .Release.Name }}-cost-analyzer";
echo Getting current Kubecost state.;
response=$(curl -sL http://${svc}:9090/model/getConfigs);
code=$(echo ${response} | jq .code);
if [ "$code" -eq 200 ]; then
echo "Got Kubecost working configuration. Successful."
exit 0
else
echo "Failed to fetch Kubecost configuration. Response was $response"
exit 1
fi