# kubernetes/backstage.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backstage
  namespace: backstage
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backstage
  template:
    metadata:
      labels:
        app: backstage
    spec:
      containers:
        - name: backstage
          image: roadiehq/community-backstage-image
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 7000
          env:
            - name: POSTGRES_USER
              value: backstage
            - name: POSTGRES_PASSWORD
              value: backstage
            - name: POSTGRES_DB
              value: backstage
            - name: POSTGRES_SERVICE_HOST
              value: postgres13.postgres
            - name: POSTGRES_SERVICE_PORT
              value: "5432"
            - name: GITEA_TOKEN
              value: 
            - name: APP_CONFIG_auth_environment
              value: development
            - name: APP_CONFIG_provider_github_development_clientID
              value: "Ov23linGjyUcqg1CpmlF"
            - name: APP_CONFIG_provider_github_development_clientSecret
              value: "3cc49adb5168df96662e0ad00db74ed1913849ce"
          volumeMounts:
            - mountPath: /usr/src/app/app-config.yaml
              subPath: app-config.yaml
              name: app-config
      volumes:
      - name: app-config
        configMap:
          name: app-config
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: backstage-pv
spec:
  storageClassName: ""
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  mountOptions:
    - hard
    - nfsvers=4.1
  nfs:
    server: 192.168.2.110
    path: /mnt/nfs_share/backstage
    readOnly: false
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: backstage-pvc
  namespace: backstage
spec:
  storageClassName: ""
  volumeName: backstage-pv
  accessModes:
    - ReadWriteMany
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  name: backstage
  namespace: backstage
spec:
  type: NodePort
  selector:
    app: backstage
  ports:
    - name: http
      port: 80
      targetPort: 7000
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: backstage-tls
  namespace: backstage
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`backstage-lp.allarddcs.nl`)
    kind: Rule
    services:
    - name: backstage
      port: 80
  tls:
    secretName: backstage-lp.allarddcs.nl-tls

