---
apiVersion: "rbac.authorization.k8s.io/v1"
kind: "RoleBinding"
metadata:
  name: "talisman-role-binding"
roleRef:
  kind: "Role"
  apiGroup: "rbac.authorization.k8s.io"
  name: "talisman"
subjects:
- kind: "ServiceAccount"
  apiGroup: ""
  name: "talisman"
---
apiVersion: "v1"
kind: "Service"
metadata:
  labels:
    app: "talisman"
    app.kubernetes.io/name: "talisman"
    app.kubernetes.io/version: "latest"
  name: "talisman"
spec:
  ports:
  - name: "http"
    port: 80
    protocol: "TCP"
    targetPort: 8080
  - name: "https"
    port: 443
    protocol: "TCP"
    targetPort: 8080
  selector:
    app: "talisman"
  type: "ClusterIP"
---
apiVersion: "v1"
kind: "ServiceAccount"
metadata:
  labels:
    app: "talisman"
    app.kubernetes.io/name: "talisman"
    app.kubernetes.io/version: "latest"
  name: "talisman"
---
apiVersion: "rbac.authorization.k8s.io/v1"
kind: "Role"
metadata:
  name: "talisman"
rules:
- apiGroups:
  - ""
  resources:
  - "secrets"
  - "configmaps"
  - "serviceaccounts"
  verbs:
  - "*"
- apiGroups:
  - ""
  resources:
  - "persistentvolumes"
  - "persistentvolumeclaims"
  verbs:
  - "*"
- apiGroups:
  - ""
  resources:
  - "pods"
  - "services"
  - "replicationcontrollers"
  verbs:
  - "*"
- apiGroups:
  - "route.openshift.io"
  resources:
  - "routes"
  verbs:
  - "*"
- apiGroups:
  - "apps"
  resources:
  - "deployments"
  verbs:
  - "*"
- apiGroups:
  - ""
  - "image.openshift.io"
  resources:
  - "imagestreams/layers"
  verbs:
  - "get"
  - "update"
- apiGroups: [""]
  resources: ["pods/exec"]
  verbs: ["create", "get"]
---
apiVersion: "rbac.authorization.k8s.io/v1"
kind: "RoleBinding"
metadata:
  name: "talisman-cluster-role-binding"
roleRef:
  kind: "ClusterRole"
  apiGroup: "rbac.authorization.k8s.io"
  name: "view"
subjects:
- kind: "ServiceAccount"
  apiGroup: ""
  name: "talisman"
---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
  name: "talisman"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: "talisman"
  template:
    metadata:
      labels:
        app: "talisman"
    spec:
      containers:
      - env:
        - name: karavan.git-repository
          valueFrom:
            secretKeyRef:
              name: talisman
              key: git-repository
        - name: "KARAVAN_ENVIRONMENT"
          value: "dev"
        - name: "KARAVAN_CONTAINER_STATUS_INTERVAL"
          value: "disabled"
        - name: "KARAVAN_CONTAINER_STATISTICS_INTERVAL"
          value: "disabled"
        - name: "KARAVAN_CAMEL_STATUS_INTERVAL"
          value: "3s"
        - name: "KARAVAN_DEVMODE_IMAGE"
          value: "talismancloud/talisman-devmode:latest"
        - name: "KUBERNETES_NAMESPACE"
          valueFrom:
            fieldRef:
              apiVersion: ""
              fieldPath: "metadata.namespace"
        image: "talismancloud/talisman:latest"
        imagePullPolicy: "Always"
        name: "talisman"
        ports:
        - containerPort: 8080
          name: "talisman"
        resources:
          requests:
            memory: "1024Mi"
      serviceAccount: "talisman"