manifests/appgroup/deploy-appgroup-controller.yaml (60 lines of code) (raw):
# first: create namespace and service account
# Warning: But be careful while deleting the namespace
apiVersion: v1
kind: Namespace
metadata:
name: network-aware-controllers
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: appgroup-controller
namespace: network-aware-controllers
---
# second: rbac
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: appgroup-controller
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups: ["appgroup.diktyo.x-k8s.io"]
resources: ["appgroups"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: appgroup-controller
subjects:
- kind: ServiceAccount
name: appgroup-controller
namespace: network-aware-controllers
roleRef:
kind: ClusterRole
name: appgroup-controller
apiGroup: rbac.authorization.k8s.io
---
# third: deployment
# Please check the repo for further info: https://github.com/diktyo-io/appgroup-controller
kind: Deployment
apiVersion: apps/v1
metadata:
name: appgroup-controller
namespace: network-aware-controllers
labels:
app: appgroup-controller
spec:
replicas: 1
selector:
matchLabels:
app: appgroup-controller
template:
metadata:
labels:
app: appgroup-controller
spec:
serviceAccountName: appgroup-controller
containers:
- name: appgroup-controller
image: localhost:5000/appgroup-controller/controller:latest
command:
- /bin/controller
imagePullPolicy: IfNotPresent