This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
универсальный_helm-чарт [2026/01/30 11:13] val |
универсальный_helm-чарт [2026/03/16 11:38] (current) val |
||
|---|---|---|---|
| Line 75: | Line 75: | ||
| <code> | <code> | ||
| ... | ... | ||
| - | kube1:~/webd-k8s# curl http://pywebd.corpX.un | + | server# curl http://pywebd.corpX.un |
| </code> | </code> | ||
| * Добавляем tls, общий env.yaml, комментарии, tpl, [], quote | * Добавляем tls, общий env.yaml, комментарии, tpl, [], quote | ||
| Line 358: | Line 358: | ||
| kube1:~/webd-k8s# helm template my-pywebd uni-webd-chart/ -f apps/pywebd/values.yaml -f env.yaml | kube1:~/webd-k8s# helm template my-pywebd uni-webd-chart/ -f apps/pywebd/values.yaml -f env.yaml | ||
| - | kube1:~/webd-k8s# helm template my-pywebd uni-webd-chart/ -f apps/pywebd/values.yaml -f env.yaml | + | kube1:~/webd-k8s# helm upgrade -i my-pywebd uni-webd-chart/ -f env.yaml -f apps/pywebd/values.yaml -n my-ns --create-namespace |
| </code> | </code> | ||
| Line 405: | Line 405: | ||
| * [[Контроллер ArgoCD#Развертывание множества приложений через ApplicationSet]] | * [[Контроллер ArgoCD#Развертывание множества приложений через ApplicationSet]] | ||
| * Добавляем apwebd | * Добавляем apwebd | ||
| + | |||
| + | ===== Добавляем lifecycle.postStart и Gateway API ===== | ||
| + | |||
| + | <code> | ||
| + | kube1:~/webd-k8s# cat apps/htwebd/values.yaml | ||
| + | </code><code> | ||
| + | hostname: htwebd | ||
| + | |||
| + | replicaCount: 2 | ||
| + | image: | ||
| + | repository: httpd | ||
| + | |||
| + | lifecycle: | ||
| + | postStart: | ||
| + | - /bin/sh | ||
| + | - -c | ||
| + | - cd /usr/local/apache2/htdocs/ && echo \"<h1>Hello from htwebd on $(hostname) ver1.1</h1>\" > index.html | ||
| + | </code><code> | ||
| + | kube1:~/webd-k8s# cat uni-webd-chart/templates/my-webd-deployment.yaml | ||
| + | </code><code> | ||
| + | ... | ||
| + | image: ... | ||
| + | {{- with .Values.lifecycle.postStart }} | ||
| + | lifecycle: | ||
| + | postStart: | ||
| + | exec: | ||
| + | command: | ||
| + | {{- range . }} | ||
| + | - "{{ . }}" | ||
| + | {{- end }} | ||
| + | {{- end }} | ||
| + | ... | ||
| + | </code><code> | ||
| + | kube1:~/webd-k8s# cp -v my-httproute.yaml uni-webd-chart/templates/ | ||
| + | kube1:~/webd-k8s# cp -v my-gateway.yaml uni-webd-chart/templates/ | ||
| + | |||
| + | kube1:~/webd-k8s# cat uni-webd-chart/values.yaml | ||
| + | </code><code> | ||
| + | ... | ||
| + | gateway: | ||
| + | enabled: false | ||
| + | className: traefik | ||
| + | httpPort: 8000 | ||
| + | httpsPort: 8443 | ||
| + | hostTemplate: "{{ .Values.hostname }}.{{ .Values.domain }}" | ||
| + | # secretName: webd-tls | ||
| + | ... | ||
| + | </code><code> | ||
| + | kube1:~/webd-k8s# cat apps/htwebd/values.yaml | ||
| + | </code><code> | ||
| + | ... | ||
| + | gateway: | ||
| + | enabled: true | ||
| + | secretName: htwebd-tls | ||
| + | |||
| + | certificate: | ||
| + | enabled: true | ||
| + | secretName: htwebd-tls | ||
| + | </code><code> | ||
| + | kube1:~/webd-k8s# cat uni-webd-chart/templates/my-gateway.yaml | ||
| + | </code><code> | ||
| + | {{- if .Values.gateway.enabled -}} | ||
| + | apiVersion: gateway.networking.k8s.io/v1 | ||
| + | kind: Gateway | ||
| + | metadata: | ||
| + | name: {{ .Release.Name }}-gateway | ||
| + | spec: | ||
| + | gatewayClassName: {{ .Values.gateway.className }} | ||
| + | listeners: | ||
| + | - name: http | ||
| + | port: {{ .Values.gateway.httpPort }} | ||
| + | protocol: HTTP | ||
| + | - name: https | ||
| + | hostname: {{ tpl .Values.gateway.hostTemplate $ }} | ||
| + | protocol: HTTPS | ||
| + | port: {{ .Values.gateway.httpsPort }} | ||
| + | tls: | ||
| + | mode: Terminate | ||
| + | certificateRefs: | ||
| + | - kind: Secret | ||
| + | name: {{ .Values.gateway.secretName }} | ||
| + | {{- end }} | ||
| + | </code><code> | ||
| + | kube1:~/webd-k8s# cat uni-webd-chart/templates/my-httproute.yaml | ||
| + | </code><code> | ||
| + | {{- if .Values.gateway.enabled -}} | ||
| + | apiVersion: gateway.networking.k8s.io/v1 | ||
| + | kind: HTTPRoute | ||
| + | metadata: | ||
| + | name: {{ .Release.Name }}-httproute | ||
| + | spec: | ||
| + | hostnames: | ||
| + | - {{ tpl .Values.gateway.hostTemplate $ }} | ||
| + | parentRefs: | ||
| + | - name: {{ .Release.Name }}-gateway | ||
| + | rules: | ||
| + | - matches: | ||
| + | - path: | ||
| + | type: Exact | ||
| + | value: / | ||
| + | backendRefs: | ||
| + | - name: {{ .Release.Name }}-svc | ||
| + | port: {{ .Values.service.port }} | ||
| + | {{- end }} | ||
| + | </code><code> | ||
| + | kube1:~/webd-k8s# helm upgrade -i my-htwebd uni-webd-chart/ -f env.yaml -f apps/htwebd/values.yaml -n my-ns --create-namespace | ||
| + | </code> | ||
| ===== Подготовка к вебинару ===== | ===== Подготовка к вебинару ===== | ||