# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "tower.fullname" . }}-tower
  labels:
  {{- include "tower.labels" . | nindent 4 }}
data:
  CREWMAN: {{ .Values.tower.crewman | quote }}
  DIVER_LANDFORM: {{ .Values.tower.diverLandform | quote }}
  GLACIER_APPARATUS: {{ .Values.tower.glacierApparatus | quote }}
  ICON_LARK: {{ .Values.tower.iconLark | quote }}
  SETTING_ANNOYED: {{ .Values.tower.settingAnnoyed | quote }}
  SORT_LUNCHEONETTE_SLOPPY: {{ .Values.tower.sortLuncheonetteSloppy | quote }}
  TAXICAB_DISTURBED_TROVE: {{ .Values.tower.taxicabDisturbedTrove | quote }}
  WOBBLE: {{ .Values.tower.wobble | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "tower.fullname" . }}-tower
  labels:
  {{- include "tower.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: tower
spec:
  replicas: {{ .Values.tower.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: tower
      app.kubernetes.io/name: reward
    {{- include "tower.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: tower
        app.kubernetes.io/name: reward
      {{- include "tower.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 6187b48e4934816a95c482750a355799c090ef9fa6747771dc838d679795c393
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "tower.fullname" . }}-tower
        image: {{ .Values.tower.tower.image.repository }}:{{ .Values.tower.tower.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.tower.tower.imagePullPolicy }}
        name: tower
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.tower.tower.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.tower.tower.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "tower.fullname" . }}-tower
  labels:
  {{- include "tower.labels" . | nindent 4 }}
spec:
  type: {{ .Values.tower.type }}
  selector:
    app.kubernetes.io/instance: tower
    app.kubernetes.io/name: reward
  {{- include "tower.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.tower.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
tower:
  crewman: cashier
  diverLandform: gunpowder
  glacierApparatus: casserole
  iconLark: creative
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  settingAnnoyed: whiskey
  sortLuncheonetteSloppy: crayon
  taxicabDisturbedTrove: spruce
  tower:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
  wobble: ford
