# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "texture.fullname" . }}-texture
  labels:
  {{- include "texture.labels" . | nindent 4 }}
data:
  CHART_STORM_KILOMETER: {{ .Values.texture.chartStormKilometer | quote }}
  HATRED: {{ .Values.texture.hatred | quote }}
  OXFORD: {{ .Values.texture.oxford | quote }}
  RACE_PEARL_DEFIANT: {{ .Values.texture.racePearlDefiant | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "texture.fullname" . }}-texture
  labels:
  {{- include "texture.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: texture
spec:
  replicas: {{ .Values.texture.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: texture
      app.kubernetes.io/name: buffet
    {{- include "texture.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: texture
        app.kubernetes.io/name: buffet
      {{- include "texture.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 0e8f0172625d1dd4338c1c3142bff9eca2a8649354aa75263e197520f6f6159b
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "texture.fullname" . }}-texture
        image: {{ .Values.texture.texture.image.repository }}:{{ .Values.texture.texture.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.texture.texture.imagePullPolicy }}
        name: texture
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.texture.texture.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.texture.texture.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "texture.fullname" . }}-texture
  labels:
  {{- include "texture.labels" . | nindent 4 }}
spec:
  type: {{ .Values.texture.type }}
  selector:
    app.kubernetes.io/instance: texture
    app.kubernetes.io/name: buffet
  {{- include "texture.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.texture.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
texture:
  chartStormKilometer: rhubarb
  hatred: share
  oxford: frontier
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  racePearlDefiant: editor
  replicas: 1
  texture:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
