AlexRogalskiy/java-patterns

View on GitHub
okteto/deployment.yaml

Summary

Maintainability
Test Coverage
apiVersion: v1
kind: ConfigMap
metadata:
  name: backend-java-patterns-configmap
  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: okteto
data:
  SERVER_PORT: '8000'
  APP_NAME: styled-java-patterns
---
apiVersion: v1
kind: Service
metadata:
  name: backend-java-patterns
  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: okteto
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: networking.k8s.io/v1
kind: Ingress
metadata:
  name: backend-java-patterns-ingress
  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: okteto
  annotations:
#   let okteto dynamically generate the ingress hostname
    dev.okteto.com/generate-host: "true"
    dev.okteto.com/private: "true"
spec:
  rules:
    - http:
        paths:
          - path: /java-patterns
            pathType: Prefix
            backend:
              service:
                name: backend-java-patterns
                port:
                  number: 8000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-java-patterns-v1
  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: okteto
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
      containers:
        - name: backend-java-patterns
          image: okteto.dev/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: 1
              memory: "3G"
              ephemeral-storage: "3G"
          securityContext:
            allowPrivilegeEscalation: false
            privileged: false
            readOnlyRootFilesystem: false
            runAsNonRoot: false
      volumes:
        - name: data
          emptyDir: {}
        - name: data-tmp
          emptyDir: {}