apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nats-operator
  name: nats-operator
  namespace: __NAMESPACE__
spec:
  replicas: 1
  selector:
    matchLabels:
      name: nats-operator
  template:
    metadata:
      labels:
        name: nats-operator
    spec:
      containers:
      - name: nats-operator
        # "gcr.io/project-id/nats-operator" is used to make it easy to support both local (Minikube, ...) and GKE deployments.
        # To deploy to GKE, "project-id" must be replaced by the correct project ID, and the Cloud Build API must be enabled.
        image: gcr.io/project-id/nats-operator
        # "IfNotPresent" is used to prevent Minikube from trying to pull from the registry (and failing) in the first place.
        imagePullPolicy: IfNotPresent
        args:
        - /nats-operator
        - -feature-gates=ClusterScoped=__FEATURE_GATE_CLUSTER_SCOPED__
        ports:
        - name: readyz
          containerPort: 8080
        env:
        - name: MY_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        resources:
          requests:
            memory: 64Mi
            cpu: 100m
          limits:
            memory: 64Mi
            cpu: 100m
        readinessProbe:
          httpGet:
            path: /readyz
            port: readyz
          initialDelaySeconds: 15
          timeoutSeconds: 3
      serviceAccountName: nats-operator
