Skip to content

Commit

Permalink
Fix Statefulset and Daemonset objects (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lowess authored Jun 23, 2023
1 parent 3befbfa commit a52ed38
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 11 deletions.
2 changes: 2 additions & 0 deletions charts/monochart/.helmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
tests/

.DS_Store
# Common VCS dirs
.git/
Expand Down
4 changes: 2 additions & 2 deletions charts/monochart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
description: A declarative helm chart for deploying common types of services on Kubernetes
name: monochart
version: 1.0.0
appVersion: 1.0.0
version: 1.0.1
appVersion: 1.0.1
home: https://github.com/Lowess/charts/tree/master/charts/monochart
icon: https://raw.githubusercontent.com/cloudposse/charts/master/incubator/monochart/logo.png
maintainers:
Expand Down
11 changes: 7 additions & 4 deletions charts/monochart/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ spec:
securityContext:
{{ toYaml . | indent 10 }}
{{- end }}
{{- $defaultService := (get .Values.service "default") }}
{{ if $defaultService }}
ports:
{{- range $name, $port := .Values.service.ports }}
{{- range $name, $port := (get $defaultService "ports") }}
{{- if $port }}
- name: {{ $name }}
containerPort: {{ $port.internal }}
protocol: {{ default "TCP" $port.protocol }}
- name: {{ $name }}
containerPort: {{ $port.internal }}
protocol: {{ default "TCP" $port.protocol }}
{{- end }}
{{- end }}
{{- end }}
volumeMounts:
Expand Down
15 changes: 11 additions & 4 deletions charts/monochart/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ spec:
{{ toYaml . | indent 8 }}
{{- end }}
spec:
{{- with .Values.statefulset.securityContext }}
securityContext:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if index .Values "serviceAccountName" }}
serviceAccountName: {{ .Values.serviceAccountName }}
{{- end }}
Expand Down Expand Up @@ -87,12 +91,15 @@ spec:
securityContext:
{{ toYaml . | indent 10 }}
{{- end }}
{{- $defaultService := (get .Values.service "default") }}
{{ if $defaultService }}
ports:
{{- range $name, $port := .Values.service.ports }}
{{- range $name, $port := (get $defaultService "ports") }}
{{- if $port }}
- name: {{ $name }}
containerPort: {{ $port.internal }}
protocol: {{ default "TCP" $port.protocol }}
- name: {{ $name }}
containerPort: {{ $port.internal }}
protocol: {{ default "TCP" $port.protocol }}
{{- end }}
{{- end }}
{{- end }}
volumeMounts:
Expand Down
20 changes: 20 additions & 0 deletions charts/monochart/tests/service_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
suite: Test monochart Service
templates:
- templates/service.yaml
values:
- values/service.yaml
release:
name: my-release

tests:
- it: should pass
release:
name: my-release

- it: assert type
asserts:
- hasDocuments:
count: 2
- containsDocument:
kind: Service
apiVersion: v1
File renamed without changes.
5 changes: 5 additions & 0 deletions charts/monochart/tests/values/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
service:
default:
enabled: true
stable:
enabled: true
17 changes: 16 additions & 1 deletion charts/monochart/values.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ deployment:
- va-verity-eks--stage-vng-public

rollout:
enabled: true
enabled: false
labels: {}
pod:
annotations: {}
Expand Down Expand Up @@ -155,6 +155,21 @@ rollout:
rootService: default
servicePort: 443

statefulset:
enabled: true
persistence:
enabled: true
useVolumeClaimTemplates: true
mountPath: /tmp
accessMode: ReadWriteOnce
size: 30Gi
storageClass: gp3
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000


service:
default:
enabled: true
Expand Down
7 changes: 7 additions & 0 deletions charts/monochart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ replicaCount: 1

# serviceAccountName: my-service-account

dockercfg:
enabled: false
# image:
# pullSecret:
# registry: https://index.docker.io/v1/
# username: example
# password: password

image:
repository: scratch
Expand Down

0 comments on commit a52ed38

Please sign in to comment.