hí ộ
This commit is contained in:
6
templates/charts/generic-http-service-v3/Chart.yaml
Normal file
6
templates/charts/generic-http-service-v3/Chart.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: generic-http-service
|
||||
description: One HTTP workload with stable logical-service discovery.
|
||||
type: application
|
||||
version: 3.0.0
|
||||
appVersion: "3"
|
||||
@@ -0,0 +1,97 @@
|
||||
{{- $s := .Values.spec -}}
|
||||
{{- $p := .Values.platform -}}
|
||||
{{- $needsBind := false -}}
|
||||
{{- range $s.runtime.ports }}{{- if lt (int .containerPort) 1024 }}{{- $needsBind = true }}{{- end }}{{- end -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $p.workloadName }}
|
||||
namespace: {{ $p.namespace }}
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 4 }}
|
||||
annotations:
|
||||
{{- toYaml $p.annotations | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ $s.replicas }}
|
||||
{{- with (default (dict) $p.rollout).progressDeadlineSeconds }}
|
||||
progressDeadlineSeconds: {{ . }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- toYaml $p.selector | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 8 }}
|
||||
annotations:
|
||||
{{- toYaml $p.annotations | nindent 8 }}
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
{{- if $s.runtime.runAsRoot }}
|
||||
securityContext:
|
||||
runAsNonRoot: false
|
||||
{{- end }}
|
||||
{{- with (default (dict) $p.scheduling).nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with (default (dict) $p.scheduling).tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $p.volumeAttachments }}
|
||||
volumes:
|
||||
{{- range . }}
|
||||
- name: {{ .name }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .claimName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: app
|
||||
image: {{ $s.runtime.resolvedImage | quote }}
|
||||
{{- with $s.runtime.command }}
|
||||
command:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $s.runtime.args }}
|
||||
args:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- toYaml $s.runtime.ports | nindent 12 }}
|
||||
{{- if $s.env }}
|
||||
env:
|
||||
{{- range $name, $value := $s.env }}
|
||||
- name: {{ $name }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
env: []
|
||||
{{- end }}
|
||||
{{- with $p.volumeAttachments }}
|
||||
volumeMounts:
|
||||
{{- range . }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .mountPath | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml $p.resources | nindent 12 }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
{{- $add := list }}
|
||||
{{- if $needsBind }}{{- $add = append $add "NET_BIND_SERVICE" }}{{- end }}
|
||||
{{- if $s.runtime.runAsRoot }}
|
||||
{{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }}
|
||||
{{- end }}
|
||||
{{- with $add }}
|
||||
capabilities:
|
||||
add:
|
||||
{{- toYaml . | nindent 16 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: {{ $s.healthCheck.path | quote }}
|
||||
port: {{ $s.healthCheck.port }}
|
||||
initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- $s := .Values.spec -}}
|
||||
{{- $p := .Values.platform -}}
|
||||
{{- if $s.exposure.public -}}
|
||||
{{- $i := $p.ingress -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $p.workloadName }}
|
||||
namespace: {{ $p.namespace }}
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 4 }}
|
||||
annotations:
|
||||
{{- toYaml $p.annotations | nindent 4 }}
|
||||
cert-manager.io/cluster-issuer: {{ $i.clusterIssuer | quote }}
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
|
||||
spec:
|
||||
ingressClassName: {{ $i.className | quote }}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ $i.host | quote }}
|
||||
secretName: {{ $p.workloadName }}-tls
|
||||
rules:
|
||||
- host: {{ $i.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $s.exposure.path | quote }}
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $p.serviceName }}
|
||||
port:
|
||||
number: {{ $p.servicePort }}
|
||||
{{- end }}
|
||||
19
templates/charts/generic-http-service-v3/templates/pvc.yaml
Normal file
19
templates/charts/generic-http-service-v3/templates/pvc.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- $p := .Values.platform -}}
|
||||
{{- range $p.volumeAttachments }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .claimName }}
|
||||
namespace: {{ $p.namespace }}
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 4 }}
|
||||
spec:
|
||||
storageClassName: {{ .storageClassName | quote }}
|
||||
accessModes:
|
||||
{{- toYaml .accessModes | nindent 4 }}
|
||||
volumeMode: {{ .volumeMode }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .size | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- $s := .Values.spec -}}
|
||||
{{- $p := .Values.platform -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $p.serviceName }}
|
||||
namespace: {{ $p.namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- toYaml $p.selector | nindent 4 }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ $p.servicePort }}
|
||||
targetPort: {{ (index $s.runtime.ports 0).name }}
|
||||
3
templates/charts/generic-http-service-v3/values.yaml
Normal file
3
templates/charts/generic-http-service-v3/values.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
# The gateway supplies both roots. The chart never derives identity or endpoints itself.
|
||||
spec: {}
|
||||
platform: {}
|
||||
Reference in New Issue
Block a user