# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

kind: Deployment
apiVersion: apps/v1
metadata:
  name: sample-app
spec:
  selector:
    matchLabels:
      app: sample-app
      env: base
  template:
    metadata:
      name: sample-app
      labels:
        app: sample-app
        env: base
    spec:
      containers:
      - name: sample-app
        image: sample-app
        resources:
          limits:
            memory: "128Mi"
            cpu: "250m"
        env:
        - name: VERSION
          value: base
        imagePullPolicy: Always
        readinessProbe:
          initialDelaySeconds: 2
          periodSeconds: 20
          httpGet:
            path: /healthz
            port: 8080
        ports:
        - name: sample-app
          containerPort: 8080
      securityContext:
        runAsUser: 1000
        runAsNonRoot: true

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

kind: Deployment
apiVersion: apps/v1
metadata:
  name: sample-app
spec:
  selector:
    matchLabels:
      app: sample-app
      env: base
  template:
    metadata:
      name: sample-app
      labels:
        app: sample-app
        env: base
    spec:
      containers:
      - name: sample-app
        image: sample-app
        resources:
          limits:
            memory: "128Mi"
            cpu: "250m"
        env:
        - name: VERSION
          value: base
        imagePullPolicy: Always
        livenessProbe:
          initialDelaySeconds: 10
          periodSeconds: 10
          httpGet:
            path: /healthz
            port: 8080
        readinessProbe:
          initialDelaySeconds: 2
          periodSeconds: 20
          httpGet:
            path: /healthz
            port: 8080
        ports:
        - name: sample-app
          containerPort: 8080
      securityContext:
        runAsUser: 1000
        runAsNonRoot: true

Add liveness probe to shutdown app if unhealthy
Add liveness probe to shutdown app if unhealthy
