Skip to content

Instantly share code, notes, and snippets.

@ericraio
Created December 8, 2020 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericraio/5984d90572e3e36c731bbd325f231753 to your computer and use it in GitHub Desktop.
Save ericraio/5984d90572e3e36c731bbd325f231753 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: cleanup-operator
name: cleanup-operator
namespace: cms
spec:
replicas: 1
selector:
matchLabels:
run: cleanup-operator
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
run: cleanup-operator
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "7000"
spec:
serviceAccountName: cleanup-operator
containers:
- args:
- --namespace=cms
- --legacy-mode=false
image: quay.io/lwolf/kube-cleanup-operator
imagePullPolicy: Always
name: cleanup-operator
ports:
- containerPort: 7000
resources:
requests:
cpu: 50m
memory: 50Mi
limits:
cpu: 50m
memory: 50Mi
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
...
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cleanup-operator
namespace: cms
...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cleanup-operator
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
- delete
- apiGroups: ["batch", "extensions"]
resources:
- jobs
verbs:
- delete
- get
- list
- watch
...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cleanup-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cleanup-operator
subjects:
- kind: ServiceAccount
name: cleanup-operator
namespace: cms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment