---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: crier
  namespace: default
  labels:
    app: crier
spec:
  replicas: 1
  selector:
    matchLabels:
      app: crier
  template:
    metadata:
      labels:
        app: crier
    spec:
      serviceAccountName: crier
      terminationGracePeriodSeconds: 30
      containers:
      - name: crier
        image: us-central1-docker.pkg.dev/gob-prow/prow-images/crier:v20250423-91b28ca9b
        args:
        - --blob-storage-workers=1
        - --config-path=/etc/config/config.yaml
        - --cookiefile=/etc/cookies/cookies
        - --gerrit-workers=1
        - --pubsub-workers=1
        - --github-endpoint=http://ghproxy
        - --github-endpoint=https://api.github.com
        - --github-app-id=$(GITHUB_APP_ID)
        - --github-app-private-key-path=/etc/github/cert
        - --github-workers=6
        - --job-config-path=/etc/job-config
        - --kubernetes-blob-storage-workers=1
        env:
        # Use KUBECONFIG envvar rather than --kubeconfig flag in order to provide multiple configs to merge.
        - name: KUBECONFIG
          value: "/etc/kubeconfig/config-20240403:/etc/build-openshift-eng/kubeconfig:/etc/build-cloud-kubernetes-node-management-team/kubeconfig:/etc/build-kpt-config-sync/kubeconfig:/etc/build-compute-image-import/kubeconfig:/etc/build-blueprints/kubeconfig:/etc/build-elcarro/kubeconfig:/etc/gke-gcloud-auth-plugin-based/kubeconfigs.yaml"
        - name: GITHUB_APP_ID
          valueFrom:
            secretKeyRef:
              name: ghapp-token
              key: appid
        ports:
        - name: metrics
          containerPort: 9090
        volumeMounts:
        - mountPath: /etc/build-openshift-eng
          name: build-openshift-eng
          readOnly: true
        - mountPath: /etc/build-cloud-kubernetes-node-management-team
          name: build-cloud-kubernetes-node-management-team
          readOnly: true
        - mountPath: /etc/build-kpt-config-sync
          name: build-kpt-config-sync
          readOnly: true
        - mountPath: /etc/build-compute-image-import
          name: build-compute-image-import
          readOnly: true
        - mountPath: /etc/build-blueprints
          name: build-blueprints
          readOnly: true
        - mountPath: /etc/build-elcarro
          name: build-elcarro
          readOnly: true
        - name: cookies
          mountPath: /etc/cookies
          readOnly: true
        - name: config
          mountPath: /etc/config
          readOnly: true
        - name: job-config
          mountPath: /etc/job-config
          readOnly: true
        - name: kubeconfig
          mountPath: /etc/kubeconfig
          readOnly: true
        - name: ghapp-token
          mountPath: /etc/github
          readOnly: true
        - mountPath: /etc/gke-gcloud-auth-plugin-based
          name: kubeconfigs
          readOnly: true
      volumes:
      - name: build-openshift-eng
        secret:
          defaultMode: 420
          secretName: kubeconfig-build-openshift-eng
      - name: build-cloud-kubernetes-node-management-team
        secret:
          defaultMode: 420
          secretName: kubeconfig-build-cloud-kubernetes-node-management-team
      - name: build-kpt-config-sync
        secret:
          defaultMode: 420
          secretName: kubeconfig-build-kpt-config-sync
      - name: build-compute-image-import
        secret:
          defaultMode: 420
          secretName: kubeconfig-build-compute-image-import
      - name: build-blueprints
        secret:
          defaultMode: 420
          secretName: kubeconfig-build-blueprints
      - name: build-elcarro
        secret:
          defaultMode: 420
          secretName: kubeconfig-build-elcarro
      - name: cookies
        secret:
          defaultMode: 420
          secretName: http-cookiefile
      - name: config
        configMap:
          name: config
      - name: job-config
        configMap:
          name: job-config
      - name: kubeconfig
        secret:
          defaultMode: 420
          secretName: kubeconfig
      - name: ghapp-token
        secret:
          secretName: ghapp-token
      - name: kubeconfigs
        configMap:
          name: kubeconfigs
---
kind: ServiceAccount
apiVersion: v1
metadata:
  name: crier
  namespace: default
  annotations:
    "iam.gke.io/gcp-service-account": "oss-prow@oss-prow.iam.gserviceaccount.com"
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: crier
  # namespace: not-namespaced, todo: fix (prowjobs live in one namespace)
rules:
- apiGroups:
    - "prow.k8s.io"
  resources:
    - "prowjobs"
  verbs:
    - "get"
    - "watch"
    - "list"
    - "patch"
- apiGroups:
    - ""
  resources:
    - "pods"
    - "events"
  verbs:
    - "get"
    - "list"
- apiGroups:
    - ""
  resources:
    - "pods"
  verbs:
    - "patch"
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: crier
  namespace: default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: "crier"
subjects:
- kind: ServiceAccount
  name: "crier"
  namespace: "default"
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: crier
  namespace: default
  name: crier
spec:
  ports:
  - name: metrics
    port: 9090
  selector:
    app: crier
