AlexRogalskiy/java-patterns

View on GitHub
k8s/backend/deployment.yaml

Summary

Maintainability
Test Coverage
apiVersion: v1
kind: ConfigMap
metadata:
  name: backend-java-patterns-configmap
  namespace: webapp
  labels:
    app.kubernetes.io/name: backend-java-patterns
    app.kubernetes.io/instance: styled-java-patterns
    app.kubernetes.io/version: v1
    app.kubernetes.io/component: function
    app.kubernetes.io/part-of: serverless
    app.kubernetes.io/managed-by: tilt
data:
  SERVER_PORT: '8000'
  APP_NAME: styled-java-patterns
---
apiVersion: v1
kind: Service
metadata:
  name: backend-java-patterns
  namespace: webapp
  labels:
    app.kubernetes.io/name: backend-java-patterns
    app.kubernetes.io/instance: styled-java-patterns
    app.kubernetes.io/version: v1
    app.kubernetes.io/component: function
    app.kubernetes.io/part-of: serverless
    app.kubernetes.io/managed-by: tilt
spec:
  type: ClusterIP
  clusterIP: None
  sessionAffinity: None
  ports:
  - name: http
    protocol: TCP
    port: 8000
    targetPort: http
  selector:
    app.kubernetes.io/name: backend-java-patterns
    app.kubernetes.io/version: v1
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-java-patterns-v1
  namespace: webapp
  labels:
    app.kubernetes.io/name: backend-java-patterns
    app.kubernetes.io/instance: styled-java-patterns
    app.kubernetes.io/version: v1
    app.kubernetes.io/component: function
    app.kubernetes.io/part-of: documentation
    app.kubernetes.io/managed-by: tilt
spec:
  replicas: 1
  minReadySeconds: 60
  revisionHistoryLimit: 5
  progressDeadlineSeconds: 120
  strategy:
    rollingUpdate:
      maxSurge: 10%
      maxUnavailable: 0
    type: RollingUpdate
  selector:
    matchLabels:
      app.kubernetes.io/name: backend-java-patterns
      app.kubernetes.io/version: v1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: backend-java-patterns
        app.kubernetes.io/version: v1
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      terminationGracePeriodSeconds: 30
#      tolerations:
#        - key: "node-priority"
#          operator: "Equal"
#          value: "infra"
#          effect: "NoExecute"
#      nodeSelector:
#        node-priority: infra
      containers:
        - name: backend-java-patterns
          image: styled-java-patterns
          imagePullPolicy: IfNotPresent
          terminationMessagePath: /etc/logs/termination.log
          terminationMessagePolicy: File
          ports:
            - name: http
              containerPort: 8000
              protocol: TCP
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: USER_AGENT
              value: "k8s-agent $(WATCH_NAMESPACE)/$(POD_NAME)"
            - name: LOG_DIR
              value: "/tmp/logs"
          volumeMounts:
            - name: data
              mountPath: "/data"
            - name: data-tmp
              mountPath: "/tmp"
          resources:
            requests:
              cpu: 1
              memory: "2G"
              ephemeral-storage: "2G"
            limits:
              cpu: 2
              memory: "3G"
              ephemeral-storage: "3G"
          securityContext:
            allowPrivilegeEscalation: false
            privileged: false
            readOnlyRootFilesystem: false
            runAsNonRoot: false
      volumes:
        - name: data
          emptyDir: {}
        - name: data-tmp
          emptyDir: {}