# Copyright 2022 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.

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: gke-prober
  name: gke-prober
  namespace: gke-prober-system # kpt-set: ${namespace}
spec:
  strategy:
    rollingUpdate:
      maxUnavailable: 0
  replicas: 1
  selector:
    matchLabels:
      k8s-app: gke-prober
  template:
    metadata:
      labels:
        k8s-app: gke-prober
    spec:
      serviceAccountName: gke-prober
      nodeSelector:
        iam.gke.io/gke-metadata-server-enabled: "true"
      containers:
      - name: gke-prober
        image: gcr.io/my-gcp-project/gke-prober:latest
        command: ["/gke-prober"]
        args:
        - -v=1
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: METRIC_PREFIX
          value: kube-prober
        - name: ENABLE_CLUSTER_PROBES
          value: "true"
        livenessProbe:
          initialDelaySeconds: 10
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 2
          httpGet:
            port: 8080
            path: /liveness
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
          limits:
            memory: "128Mi"
            cpu: "500m"