# Copyright 2018 The Kubernetes Authors All rights reserved.
#
# 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: PersistentVolumeClaim
apiVersion: v1
metadata:
  namespace: default
  labels:
    app: ghproxy
  name: ghproxy
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: hyperdisk-balanced
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: ghproxy
  labels:
    app: ghproxy
spec:
  selector:
    matchLabels:
      app: ghproxy
  replicas: 1 # TODO(fejta): this should be HA
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: ghproxy
    spec:
      containers:
        - name: ghproxy
          image: us-docker.pkg.dev/k8s-infra-prow/images/ghproxy:v20250927-87810a762
          args:
            - --cache-dir=/cache
            - --cache-sizeGB=99
            - --push-gateway=pushgateway
            - --serve-metrics=true
          ports:
            - name: main
              containerPort: 8888
            - name: metrics
              containerPort: 9090
          volumeMounts:
            - name: cache
              mountPath: /cache
      volumes:
        - name: cache
          persistentVolumeClaim:
            claimName: ghproxy
      # run on our dedicated node
      # tolerations:
      # - key: "dedicated"
      #   operator: "Equal"
      #   value: "ghproxy"
      #   effect: "NoSchedule"
      # nodeSelector:
      #   dedicated: "ghproxy"
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: ghproxy
  namespace: default
  name: ghproxy
spec:
  ports:
    - name: main
      port: 80
      protocol: TCP
      targetPort: 8888
    - name: metrics
      port: 9090
  selector:
    app: ghproxy
  type: ClusterIP
