Skip to content

Commit

Permalink
add pod securityContext container sts,deploy (#28)
Browse files Browse the repository at this point in the history
* add container securityContext container sts,deploy

* add  pod securityContext doc

* update chart version
  • Loading branch information
zabit-z authored Oct 5, 2023
1 parent 4f7ae20 commit 5ac0a63
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/helm-apps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: helm-apps
description: A Helm applications library
type: library
version: 1.2.12
version: 1.2.13
maintainers:
- name: alvnukov
url: https://github.com/alvnukov
Expand Down
2 changes: 1 addition & 1 deletion charts/helm-apps/templates/_apps-stateful.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ kind: StatefulSet
spec:
{{- /* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#statefulset-v1-apps */ -}}
{{- $specs := dict }}
{{- $_ = set $specs "Maps" (list "apps-helpers.podTemplate" "apps-specs.selector" "persistentVolumeClaimRetentionPolicy" "updateStrategy") }}
{{- $_ = set $specs "Maps" (list "securityContext" "apps-helpers.podTemplate" "apps-specs.selector" "persistentVolumeClaimRetentionPolicy" "updateStrategy") }}
{{- $_ = set $specs "Numbers" (list "replicas" "minReadySeconds" "revisionHistoryLimit" "progressDeadlineSeconds") }}
{{- $_ = set $specs "Strings" (list "apps-specs.serviceName" "podManagementPolicy") }}
{{- $_ = set $specs "Lists" (list "apps-specs.volumeClaimTemplates") }}
Expand Down
2 changes: 1 addition & 1 deletion charts/helm-apps/templates/_apps-stateless.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ kind: Deployment
spec:
{{- $specs := dict }}
{{- $_ = set $specs "Numbers" (list "minReadySeconds" "progressDeadlineSeconds" "revisionHistoryLimit" "replicas") }}
{{- $_ = set $specs "Maps" (list "strategy" "apps-helpers.podTemplate" "apps-specs.selector") }}
{{- $_ = set $specs "Maps" (list "securityContext" "strategy" "apps-helpers.podTemplate" "apps-specs.selector") }}
{{- include "apps-utils.generateSpecs" (list $ . $specs) | indent 2 }}

{{- $_ = unset . "__annotations__" }}
Expand Down
15 changes: 13 additions & 2 deletions tests/.helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ apps-configmaps:
data:
nginx.conf: |
configline1
configline2
configline2
## Имя чарта. Ниже перечисляются CronJob'ы для развертывания.
# Указано в .helm/requirements.yaml в репозитории приложения в ключах dependencies.name или dependencies.alias.
Expand Down Expand Up @@ -679,6 +679,12 @@ apps-stateful:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
annotations: |
testAnnotation: "testVal"
# Pod securityContext пробрасываются как есть https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
# securityContext: |
# runAsUser: 1000
# runAsGroup: 3000
# fsGroup: 2000

## Дополнительные лейблы для всех ресурсов, создаваемых чартом.
# По умолчанию уже генерируется стандартный набор лейблов, поэтому указывать дополнительные обычно не требуется.
# Пробрасываются как есть в metadata.labels всех ресурсов.
Expand Down Expand Up @@ -1024,6 +1030,11 @@ apps-stateless:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
annotations: |
testAnnotation: "testVal"
# Pod securityContext пробрасываются как есть https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
# securityContext: |
# runAsUser: 1000
# runAsGroup: 3000
# fsGroup: 2000
## Дополнительные лейблы для всех ресурсов, создаваемых чартом.
# По умолчанию уже генерируется стандартный набор лейблов, поэтому указывать дополнительные обычно не требуется.
# Пробрасываются как есть в metadata.labels всех ресурсов.
Expand Down Expand Up @@ -1906,7 +1917,7 @@ apps-services:
port: 80
selector: |
app: test-app
test-env-yaml:
__GroupVars__:
type: apps-stateless
Expand Down

0 comments on commit 5ac0a63

Please sign in to comment.