2.5 KiB · text History f38ff4e
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: mutants
  name: mutantops-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mutantops-operator
  template:
    metadata:
      labels:
        app: mutantops-operator
    spec:
      serviceAccountName: mutantops-operator
      containers:
      - name: mutantops-operator
        image: ghcr.io/neiam/mutant-operator:latest
        imagePullPolicy: Always
        env:
        - name: WATCH_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: OPERATOR_NAME
          value: "mutantops-operator"
        # The HTTP API stays off until this is set. Create the secret with:
        #   kubectl -n mutants create secret generic mutantops-api \
        #     --from-literal=token="$(openssl rand -hex 32)"
        - name: MUTANT_API_TOKEN
          valueFrom:
            secretKeyRef:
              name: mutantops-api
              key: token
              optional: true
        ports:
        - name: http
          containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: mutantops-api
  namespace: mutants
spec:
  selector:
    app: mutantops-operator
  ports:
  - name: http
    port: 80
    targetPort: http

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: mutantops-operator
  namespace: mutants
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: mutantops-operator
# Only what the operator uses: generated Deployments, MutantDeployments
# (read), Mutations and their status, and each Mutation's generated Secret
# (get/create only; garbage collection deletes it with the Mutation).
rules:
- apiGroups: ["apps"]
  resources: ["deployments"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["neiam.org"]
  resources: ["mutantdeployments"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["neiam.org"]
  resources: ["mutations"]
  verbs: ["get", "list", "watch", "create", "patch", "delete"]
- apiGroups: ["neiam.org"]
  resources: ["mutations/status"]
  verbs: ["get", "patch", "update"]
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["get", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: mutantops-operator
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: mutantops-operator
subjects:
  - kind: ServiceAccount
    name: mutantops-operator
    namespace: mutants