diff --git a/templates/NOTES.txt b/templates/NOTES.txt index cee67c0..db1c870 100644 --- a/templates/NOTES.txt +++ b/templates/NOTES.txt @@ -1,20 +1,20 @@ 1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} +{{- if .Values.web.ingress.enabled }} +{{- range $host := .Values.web.ingress.hosts }} {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} -{{- else if contains "NodePort" .Values.service.type }} +{{- else if contains "NodePort" .Values.web.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "glitchtip.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} +{{- else if contains "LoadBalancer" .Values.web.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "glitchtip.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "glitchtip.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} + echo http://$SERVICE_IP:{{ .Values.web.service.port }} +{{- else if contains "ClusterIP" .Values.web.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "glitchtip.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 diff --git a/templates/deployment-beat.yaml b/templates/beat/deployment-beat.yaml similarity index 94% rename from templates/deployment-beat.yaml rename to templates/beat/deployment-beat.yaml index 1f17584..e6d05f8 100644 --- a/templates/deployment-beat.yaml +++ b/templates/beat/deployment-beat.yaml @@ -4,11 +4,13 @@ metadata: name: {{ include "glitchtip.fullname" . }}-beat labels: {{- include "glitchtip.labels" . | nindent 4 }} + app.kubernetes.io/component: beat spec: replicas: 1 selector: matchLabels: {{- include "glitchtip.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: beat template: metadata: annotations: @@ -17,6 +19,7 @@ spec: tag: "{{ .Values.image.tag }}" labels: {{- include "glitchtip.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: beat spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -38,10 +41,6 @@ spec: cpu: 1m memory: 32Mi env: - - name: DEBUG - value: "False" - - name: STATIC_URL - value: / - name: SERVER_ROLE value: "beat" {{- if .Values.redisURL }} diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml index 07b2921..747e8a8 100644 --- a/templates/serviceaccount.yaml +++ b/templates/serviceaccount.yaml @@ -4,5 +4,9 @@ kind: ServiceAccount metadata: name: {{ include "glitchtip.serviceAccountName" . }} labels: -{{ include "glitchtip.labels" . | nindent 4 }} -{{- end -}} + {{- include "glitchtip.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/templates/tests/test-connection.yaml b/templates/tests/test-connection.yaml index 2288891..bee5224 100644 --- a/templates/tests/test-connection.yaml +++ b/templates/tests/test-connection.yaml @@ -5,11 +5,11 @@ metadata: labels: {{ include "glitchtip.labels" . | nindent 4 }} annotations: - "helm.sh/hook": test-success + "helm.sh/hook": test spec: containers: - name: wget image: busybox command: ['wget'] - args: ['{{ include "glitchtip.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "glitchtip.fullname" . }}:{{ .Values.web.service.port }}'] restartPolicy: Never diff --git a/templates/deployment.yaml b/templates/web/deployment.yaml similarity index 92% rename from templates/deployment.yaml rename to templates/web/deployment.yaml index 097e367..94fbdcd 100644 --- a/templates/deployment.yaml +++ b/templates/web/deployment.yaml @@ -1,15 +1,18 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "glitchtip.fullname" . }} + name: {{ include "glitchtip.fullname" . }}-web labels: {{- include "glitchtip.labels" . | nindent 4 }} + app.kubernetes.io/component: web spec: + {{- if not .Values.web.autoscaling.enabled }} replicas: {{ .Values.web.replicaCount }} + {{- end }} selector: matchLabels: {{- include "glitchtip.selectorLabels" . | nindent 6 }} - role: web + app.kubernetes.io/component: web template: metadata: annotations: @@ -18,7 +21,7 @@ spec: tag: "{{ .Values.image.tag }}" labels: {{- include "glitchtip.selectorLabels" . | nindent 8 }} - role: web + app.kubernetes.io/component: web spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -31,7 +34,7 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http @@ -54,10 +57,6 @@ spec: resources: {{- toYaml .Values.web.resources | nindent 12 }} env: - - name: DEBUG - value: "False" - - name: STATIC_URL - value: / {{- if .Values.redisURL }} - name: REDIS_URL value: {{ .Values.redisURL }} diff --git a/templates/web-hpa.yaml b/templates/web/hpa.yaml similarity index 94% rename from templates/web-hpa.yaml rename to templates/web/hpa.yaml index d737434..f8c15b9 100644 --- a/templates/web-hpa.yaml +++ b/templates/web/hpa.yaml @@ -9,7 +9,7 @@ spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ template "glitchtip.fullname" . }} + name: {{ template "glitchtip.fullname" . }}-web minReplicas: {{ .Values.web.autoscaling.minReplicas }} maxReplicas: {{ .Values.web.autoscaling.maxReplicas }} metrics: diff --git a/templates/ingress.yaml b/templates/web/ingress.yaml similarity index 65% rename from templates/ingress.yaml rename to templates/web/ingress.yaml index 44cef26..d274e7e 100644 --- a/templates/ingress.yaml +++ b/templates/web/ingress.yaml @@ -1,6 +1,6 @@ -{{- if .Values.ingress.enabled -}} +{{- if .Values.web.ingress.enabled -}} {{- $fullName := include "glitchtip.fullname" . -}} -{{- $svcPort := .Values.service.port -}} +{{- $svcPort := .Values.web.service.port -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} @@ -11,14 +11,14 @@ metadata: name: {{ $fullName }} labels: {{- include "glitchtip.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} + {{- with .Values.web.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if .Values.ingress.tls }} + {{- if .Values.web.ingress.tls }} tls: - {{- range .Values.ingress.tls }} + {{- range .Values.web.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} @@ -27,13 +27,15 @@ spec: {{- end }} {{- end }} rules: - {{- range .Values.ingress.hosts }} + {{- range .Values.web.ingress.hosts }} - host: {{ .host | quote }} http: paths: - - pathType: ImplementationSpecific + {{- range .paths }} + - path: {{ .path }} backend: - serviceName: {{ $fullName }} + serviceName: {{ $fullName }}-web servicePort: {{ $svcPort }} + {{- end }} {{- end }} {{- end }} diff --git a/templates/pdb.yaml b/templates/web/pdb.yaml similarity index 80% rename from templates/pdb.yaml rename to templates/web/pdb.yaml index 781536f..c6b2d60 100644 --- a/templates/pdb.yaml +++ b/templates/web/pdb.yaml @@ -3,7 +3,7 @@ apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: - name: {{ include "glitchtip.fullname" . }} + name: {{ include "glitchtip.fullname" . }}-web labels: {{- include "glitchtip.labels" . | nindent 4 }} spec: @@ -11,6 +11,6 @@ spec: selector: matchLabels: {{- include "glitchtip.selectorLabels" . | nindent 6 }} - role: web + app.kubernetes.io/component: web {{- end -}} {{- end -}} diff --git a/templates/service.yaml b/templates/web/service.yaml similarity index 59% rename from templates/service.yaml rename to templates/web/service.yaml index a8c4adc..f3394c7 100644 --- a/templates/service.yaml +++ b/templates/web/service.yaml @@ -1,16 +1,16 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "glitchtip.fullname" . }} + name: {{ include "glitchtip.fullname" . }}-web labels: {{- include "glitchtip.labels" . | nindent 4 }} spec: - type: {{ .Values.service.type }} + type: {{ .Values.web.service.type }} ports: - - port: {{ .Values.service.port }} + - port: {{ .Values.web.service.port }} targetPort: http protocol: TCP name: http selector: {{- include "glitchtip.selectorLabels" . | nindent 4 }} - role: web \ No newline at end of file + app.kubernetes.io/component: web \ No newline at end of file diff --git a/templates/deployment-worker.yaml b/templates/worker/deployment.yaml similarity index 95% rename from templates/deployment-worker.yaml rename to templates/worker/deployment.yaml index f55c8c0..3d43c7e 100644 --- a/templates/deployment-worker.yaml +++ b/templates/worker/deployment.yaml @@ -4,11 +4,13 @@ metadata: name: {{ include "glitchtip.fullname" . }}-worker labels: {{- include "glitchtip.labels" . | nindent 4 }} + app.kubernetes.io/component: worker spec: replicas: {{ .Values.worker.replicaCount }} selector: matchLabels: {{- include "glitchtip.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: worker template: metadata: annotations: @@ -17,6 +19,7 @@ spec: tag: "{{ .Values.image.tag }}" labels: {{- include "glitchtip.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: worker spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -33,10 +36,6 @@ spec: resources: {{- toYaml .Values.worker.resources | nindent 12 }} env: - - name: DEBUG - value: "False" - - name: STATIC_URL - value: / - name: SERVER_ROLE value: "worker" {{- if .Values.redisURL }} diff --git a/templates/worker-hpa.yaml b/templates/worker/hpa.yaml similarity index 100% rename from templates/worker-hpa.yaml rename to templates/worker/hpa.yaml diff --git a/values.yaml b/values.yaml index dc36b1a..ec22247 100644 --- a/values.yaml +++ b/values.yaml @@ -31,7 +31,7 @@ web: # targetMemoryUtilizationPercentage: 80 # budget: - # minAvailable: 1 + # minAvailable: 1 resources: {} # limits: @@ -51,6 +51,23 @@ web: failureThreshold: 10 initialDelaySeconds: 5 timeoutSeconds: 2 + service: + type: ClusterIP + port: 80 + + ingress: + enabled: false + annotations: + {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local worker: replicaCount: 1 @@ -79,24 +96,6 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - annotations: - {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - redis: enabled: true master: