apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert -c -f aagm.yml
    kompose.version: 1.26.1 (HEAD)
  creationTimestamp: null
  labels:
    io.kompose.service: aagm
  name: aagm
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: aagm
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert -c -f aagm.yml
        kompose.version: 1.26.1 (HEAD)
      creationTimestamp: null
      labels:
        io.kompose.service: aagm
    spec:
      securityContext:
        runAsGroup: 101
      containers:
        - env:
            - name: NOSTROMO_DB_HOST
              value: <hostname, address of the mysql/mariadb>
            - name: NOSTROMO_DB_NAME
              value: aagm
            - name: NOSTROMO_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: database-secret
                  key: mysql-password
            - name: NOSTROMO_DB_USER
              value: aagm
          image: 'dicosgmbh/dagm'
          name: aagm
          ports:
            - containerPort: 8080
            - containerPort: 10443
          volumeMounts:
            - mountPath: /opt/aagm
              name: aagm-claim0
              readOnly: false
            - mountPath: /opt/aagm/cryptor.key
              name: aagm-cryptor
              subPath: cryptor.key
              readOnly: false
            - mountPath: /opt/aagm/aagm.lic
              name: aagm-cryptor
              subPath: license
              readOnly: false
            - mountPath: /opt/aagm/ssl-cert-aagm.key
              name: aagm-cryptor
              subPath: privateKey
              readOnly: false
            - mountPath: /opt/aagm/ssl-cert-aagm.pem
              name: aagm-cryptor
              subPath: cert
              readOnly: false
          resources:
            limits:
              cpu: 1
              memory: 3Gi
            requests:
              cpu: 500m
              memory: 1536Mi
      restartPolicy: Always
      volumes:
        - name: aagm-claim0
          persistentVolumeClaim:
            claimName: aagm-claim0
        - name: aagm-cryptor
          secret: 
            secretName: aagm-secrets
        
---
apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: aagm
  name: aagm
spec:
  ports:
    - name: "80"
      port: 80
      targetPort: 8080
    - name: "443"
      port: 443
      targetPort: 10443
  selector:
    io.kompose.service: aagm
  type: LoadBalancer
status:
  loadBalancer: {}
  
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    io.kompose.service: aagm-claim0
  name: aagm-claim0
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 15Gi

---
apiVersion: v1
kind: Secret
metadata:
  name: database-secret
  labels:
    io.kompose.service: aagm
type: Opaque
data:
  mysql-password: "<base64 of the password for the database>"

---
apiVersion: v1
kind: Secret
metadata:
  name: aagm-secrets
  labels:
    io.kompose.service: aagm
type: Opaque
stringData:
  cert: "<clear text of the certificate>"
data:
  cryptor.key: "<base64 of a secret, it can be the base64 of a binary>"
  privateKey: "<base64 of the private key (without password)>"
  license: "<base64 of your AAGM license>"

---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
  name: aagm
  namespace: buw00-aagm
  labels:
    io.kompose.service: aagm
  managedFields:
    - manager: Mozilla
      operation: Update
      apiVersion: route.openshift.io/v1
    - manager: openshift-router
      operation: Update
      apiVersion: route.openshift.io/v1
      subresource: status
spec:
  host: <whatever hostname needed>
  to:
    kind: Service
    name: aagm
    weight: 100
  port:
    targetPort: '443'
  tls:
    termination: reencrypt
    destinationCACertificate: "<clear text of the certificate>"
    insecureEdgeTerminationPolicy: Redirect
  wildcardPolicy: None
status:
  ingress:
    - host: <whatever hostname needed>
      routerName: default
      conditions:
        - type: Admitted
          status: 'True'
      wildcardPolicy: None