Use more generic name "django" instead of glitchtip for template
variables
This commit is contained in:
		
							parent
							
								
									efc58de740
								
							
						
					
					
						commit
						976c6799dd
					
				
					 19 changed files with 233 additions and 201 deletions
				
			
		
							
								
								
									
										95
									
								
								templates/web/deployment.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								templates/web/deployment.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,95 @@
 | 
			
		|||
apiVersion: apps/v1
 | 
			
		||||
kind: Deployment
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "django.fullname" . }}-web
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "django.labels" . | nindent 4 }}
 | 
			
		||||
    app.kubernetes.io/component: web
 | 
			
		||||
spec:
 | 
			
		||||
  {{- if not .Values.web.autoscaling.enabled }}
 | 
			
		||||
  replicas: {{ .Values.web.replicaCount }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "django.selectorLabels" . | nindent 6 }}
 | 
			
		||||
      app.kubernetes.io/component: web
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      annotations:
 | 
			
		||||
        checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
 | 
			
		||||
        checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
 | 
			
		||||
        tag: "{{ .Values.image.tag }}"
 | 
			
		||||
      labels:
 | 
			
		||||
        {{- include "django.selectorLabels" . | nindent 8 }}
 | 
			
		||||
        app.kubernetes.io/component: web
 | 
			
		||||
    spec:
 | 
			
		||||
    {{- with .Values.imagePullSecrets }}
 | 
			
		||||
      imagePullSecrets:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
      serviceAccountName: {{ include "django.serviceAccountName" . }}
 | 
			
		||||
      securityContext:
 | 
			
		||||
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
 | 
			
		||||
      containers:
 | 
			
		||||
        - name: {{ .Chart.Name }}
 | 
			
		||||
          securityContext:
 | 
			
		||||
            {{- toYaml .Values.securityContext | nindent 12 }}
 | 
			
		||||
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.image.pullPolicy }}
 | 
			
		||||
          ports:
 | 
			
		||||
            - name: http
 | 
			
		||||
              containerPort: 8080
 | 
			
		||||
              protocol: TCP
 | 
			
		||||
          livenessProbe:
 | 
			
		||||
            failureThreshold: {{ .Values.web.livenessProbe.failureThreshold }}
 | 
			
		||||
            httpGet:
 | 
			
		||||
              path: /_health/
 | 
			
		||||
              port: 8080
 | 
			
		||||
            initialDelaySeconds: {{ .Values.web.livenessProbe.initialDelaySeconds }}
 | 
			
		||||
            timeoutSeconds: {{ .Values.web.livenessProbe.timeoutSeconds }}
 | 
			
		||||
          readinessProbe:
 | 
			
		||||
            failureThreshold: {{ .Values.web.readinessProbe.failureThreshold }}
 | 
			
		||||
            httpGet:
 | 
			
		||||
              path: /_health/
 | 
			
		||||
              port: 8080
 | 
			
		||||
            initialDelaySeconds: {{ .Values.web.readinessProbe.initialDelaySeconds }}
 | 
			
		||||
            timeoutSeconds: {{ .Values.web.readinessProbe.timeoutSeconds }}
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.web.resources | nindent 12 }}
 | 
			
		||||
          env:
 | 
			
		||||
            {{- if .Values.redisURL }}
 | 
			
		||||
            - name: REDIS_URL
 | 
			
		||||
              value: {{ .Values.redisURL }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            {{- if .Values.redis.enabled }}
 | 
			
		||||
            - name: REDIS_PASSWORD
 | 
			
		||||
              valueFrom:
 | 
			
		||||
                secretKeyRef:
 | 
			
		||||
                  key: redis-password
 | 
			
		||||
                  name: {{ include "django.fullname" . }}-redis
 | 
			
		||||
            - name: REDIS_HOST
 | 
			
		||||
              value: {{ template "django.redis.host" . }}
 | 
			
		||||
            - name: REDIS_PORT
 | 
			
		||||
              value: {{ template "django.redis.port" . }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
            - name: POD_IP
 | 
			
		||||
              valueFrom:
 | 
			
		||||
                fieldRef:
 | 
			
		||||
                  fieldPath: status.podIP
 | 
			
		||||
          envFrom:
 | 
			
		||||
            - secretRef:
 | 
			
		||||
                name: {{ include "django.fullname" . }}
 | 
			
		||||
            - configMapRef:
 | 
			
		||||
                name: {{ include "django.fullname" . }}
 | 
			
		||||
      {{- with .Values.web.nodeSelector }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
    {{- with .Values.web.affinity }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- with .Values.web.tolerations }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
							
								
								
									
										28
									
								
								templates/web/hpa.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								templates/web/hpa.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
{{- if .Values.web.autoscaling.enabled -}}
 | 
			
		||||
apiVersion: autoscaling/v2beta1
 | 
			
		||||
kind: HorizontalPodAutoscaler
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ template "django.fullname" . }}-web
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "django.labels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  scaleTargetRef:
 | 
			
		||||
    apiVersion: apps/v1
 | 
			
		||||
    kind: Deployment
 | 
			
		||||
    name: {{ template "django.fullname" . }}-web
 | 
			
		||||
  minReplicas: {{ .Values.web.autoscaling.minReplicas }}
 | 
			
		||||
  maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
 | 
			
		||||
  metrics:
 | 
			
		||||
    {{- if .Values.web.autoscaling.targetCPUUtilizationPercentage }}
 | 
			
		||||
    - type: Resource
 | 
			
		||||
      resource:
 | 
			
		||||
        name: cpu
 | 
			
		||||
        targetAverageUtilization: {{ .Values.web.autoscaling.targetCPUUtilizationPercentage }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    {{- if .Values.web.autoscaling.targetMemoryUtilizationPercentage }}
 | 
			
		||||
    - type: Resource
 | 
			
		||||
      resource:
 | 
			
		||||
        name: memory
 | 
			
		||||
        targetAverageUtilization: {{ .Values.web.autoscaling.targetMemoryUtilizationPercentage }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
							
								
								
									
										41
									
								
								templates/web/ingress.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								templates/web/ingress.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
{{- if .Values.web.ingress.enabled -}}
 | 
			
		||||
{{- $fullName := include "django.fullname" . -}}
 | 
			
		||||
{{- $svcPort := .Values.web.service.port -}}
 | 
			
		||||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
 | 
			
		||||
apiVersion: networking.k8s.io/v1beta1
 | 
			
		||||
{{- else -}}
 | 
			
		||||
apiVersion: extensions/v1beta1
 | 
			
		||||
{{- end }}
 | 
			
		||||
kind: Ingress
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ $fullName }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "django.labels" . | nindent 4 }}
 | 
			
		||||
  {{- with .Values.web.ingress.annotations }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  {{- if .Values.web.ingress.tls }}
 | 
			
		||||
  tls:
 | 
			
		||||
    {{- range .Values.web.ingress.tls }}
 | 
			
		||||
    - hosts:
 | 
			
		||||
        {{- range .hosts }}
 | 
			
		||||
        - {{ . | quote }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
      secretName: {{ .secretName }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
  rules:
 | 
			
		||||
    {{- range .Values.web.ingress.hosts }}
 | 
			
		||||
    - host: {{ .host | quote }}
 | 
			
		||||
      http:
 | 
			
		||||
        paths:
 | 
			
		||||
          {{- range .paths }}
 | 
			
		||||
          - path: {{ .path }}
 | 
			
		||||
            backend:
 | 
			
		||||
              serviceName: {{ $fullName }}-web
 | 
			
		||||
              servicePort: {{ $svcPort }}
 | 
			
		||||
          {{- end }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  {{- end }}
 | 
			
		||||
							
								
								
									
										16
									
								
								templates/web/pdb.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								templates/web/pdb.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
{{- if .Values.web.budget -}}
 | 
			
		||||
{{- if .Values.web.budget.minAvailable -}}
 | 
			
		||||
apiVersion: policy/v1beta1
 | 
			
		||||
kind: PodDisruptionBudget
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "django.fullname" . }}-web
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "django.labels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  minAvailable: {{ .Values.web.budget.minAvailable }}
 | 
			
		||||
  selector:
 | 
			
		||||
    matchLabels:
 | 
			
		||||
      {{- include "django.selectorLabels" . | nindent 6 }}
 | 
			
		||||
      app.kubernetes.io/component: web
 | 
			
		||||
{{- end -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
							
								
								
									
										16
									
								
								templates/web/service.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								templates/web/service.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
apiVersion: v1
 | 
			
		||||
kind: Service
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ include "django.fullname" . }}-web
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "django.labels" . | nindent 4 }}
 | 
			
		||||
spec:
 | 
			
		||||
  type: {{ .Values.web.service.type }}
 | 
			
		||||
  ports:
 | 
			
		||||
    - port: {{ .Values.web.service.port }}
 | 
			
		||||
      targetPort: http
 | 
			
		||||
      protocol: TCP
 | 
			
		||||
      name: http
 | 
			
		||||
  selector:
 | 
			
		||||
    {{- include "django.selectorLabels" . | nindent 4 }}
 | 
			
		||||
    app.kubernetes.io/component: web
 | 
			
		||||
		Reference in a new issue