From 8295a28f6d6e14f5adb62138271de393015061e9 Mon Sep 17 00:00:00 2001 From: Ritu Sood Date: Tue, 6 Aug 2019 19:35:42 -0700 Subject: Use controller runtime and operator sdk Changing the framework to use controller runtime and operator sdk. This allows to add CRD controllers for Network, Provider Network etc in the same operator. Binary renamed to nfn-operator (Network funtion networking). Change-Id: Ic25a3c3f5f1418fc0614f3aede48b41d9c1156cd Signed-off-by: Ritu Sood --- deploy/operator.yaml | 42 ++++++++++++++++++++++++++ deploy/operator_roles.yaml | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 deploy/operator.yaml create mode 100644 deploy/operator_roles.yaml (limited to 'deploy') diff --git a/deploy/operator.yaml b/deploy/operator.yaml new file mode 100644 index 0000000..a1edde8 --- /dev/null +++ b/deploy/operator.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nfn-operator +spec: + replicas: 1 + selector: + matchLabels: + name: nfn-operator + template: + metadata: + labels: + name: nfn-operator + spec: + serviceAccountName: k8s-nfn-sa + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: nfnType + operator: In + values: + - operator + containers: + - name: nfn-operator + # Replace this with the built image name + image: rtsood/nfn-operator:latest + command: + - nfn-operator + imagePullPolicy: IfNotPresent + env: + - name: HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "nfn-operator" diff --git a/deploy/operator_roles.yaml b/deploy/operator_roles.yaml new file mode 100644 index 0000000..2bd49ac --- /dev/null +++ b/deploy/operator_roles.yaml @@ -0,0 +1,75 @@ + +--- + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: k8s-nfn-sa + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + creationTimestamp: null + name: k8s-nfn-cr +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create +- apiGroups: + - apps + resourceNames: + - nfn-operator + resources: + - deployments/finalizers + verbs: + - update +- apiGroups: + - k8s.plugin.opnfv.org + resources: + - '*' + - providernetworks + verbs: + - '*' + +--- + +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: k8s-nfn-crb +subjects: +- kind: Group + name: system:serviceaccounts + apiGroup: rbac.authorization.k8s.io +roleRef: + kind: ClusterRole + name: k8s-nfn-cr + apiGroup: rbac.authorization.k8s.io + -- cgit