-# Steps to setup Overlay Controller cluster\r
-\r
-###Prerequisite\r
-**Install Kubernetes**\r
-\r
-###Install dependencies\r
-**1. Install cert-manager**\r
-\r
-`$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml`\r
-\r
-**2. Create namespace for SDEWAN Overlay Controller Microservices**\r
-\r
-`$ kubectl create namespace sdewan-system`\r
-\r
-###Install CNF\r
-**Please follow the README.md under ../platform/cnf folder for installation**\r
-\r
-###Install CRD Controller\r
-**Please follow the README.md under ../platform/crd-ctrlr folder for installation**\r
-\r
-###Install Overlay Controller Microservices\r
-**Please follow the README.md under deployments folder for installation**\r
-\r
-###Configurations for Overlay Controller\r
-**1. Routing rule**\r
-\r
-**2. Local cluster registration**\r
-**Please follow the README.md under reg_cluster/ to finish the registration**\r
+# Steps to setup Overlay Controller cluster
+
+###Prerequisite
+**Install Kubernetes**
+
+###Install dependencies
+**1. Install cert-manager**
+
+`$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml`
+
+**2. Create namespace for SDEWAN Overlay Controller Microservices**
+
+`$ kubectl create namespace sdewan-system`
+
+###Install CNF
+**Please follow the README.md under ../platform/cnf folder for installation**
+
+###Install CRD Controller
+**Please follow the README.md under ../platform/crd-ctrlr folder for installation**
+
+###Install Overlay Controller Microservices
+**Please follow the README.md under deployments folder for installation**
+
+###Configurations for Overlay Controller
+**1. Routing rule**
+
+**2. Local cluster registration**
+**Please follow the README.md under reg_cluster/ to finish the registration**
-# SPDX-license-identifier: Apache-2.0\r
-##############################################################################\r
-# Copyright (c) 2021 Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
-# are made available under the terms of the Apache License, Version 2.0\r
-# which accompanies this distribution, and is available at\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-##############################################################################\r
-\r
-FROM golang:1.17-alpine\r
-\r
-RUN apk update \\r
- && apk add --no-cache make\r
-\r
-WORKDIR /go/src/github.com/central-controller\r
-COPY ./ ./\r
-RUN cd src/scc && make all\r
-RUN cd src/rsync && make all\r
-RUN cd src/monitor && make all\r
-\r
-FROM alpine:3.15\r
-\r
-WORKDIR /opt/scc\r
-RUN addgroup -S scc && adduser -S -G scc scc\r
-RUN chown scc:scc /opt/scc -R\r
-\r
-COPY --chown=scc --from=0 /go/src/github.com/central-controller/src/scc/scc ./\r
-COPY --chown=scc --from=0 /go/src/github.com/central-controller/src/rsync/rsync ./\r
-COPY --chown=scc --from=0 /go/src/github.com/central-controller/src/monitor/monitor ./\r
-COPY --chown=scc --from=0 /go/src/github.com/central-controller/build/entrypoint ./\r
-RUN chmod +x entrypoint\r
-\r
-USER scc\r
-\r
-ENTRYPOINT ["./entrypoint"]\r
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2021 Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+FROM golang:1.17-alpine
+
+RUN apk update \
+ && apk add --no-cache make
+
+WORKDIR /go/src/github.com/central-controller
+COPY ./ ./
+RUN cd src/scc && make all
+RUN cd src/rsync && make all
+RUN cd src/monitor && make all
+
+FROM alpine:3.15
+
+WORKDIR /opt/scc
+RUN addgroup -S scc && adduser -S -G scc scc
+RUN chown scc:scc /opt/scc -R
+
+COPY --chown=scc --from=0 /go/src/github.com/central-controller/src/scc/scc ./
+COPY --chown=scc --from=0 /go/src/github.com/central-controller/src/rsync/rsync ./
+COPY --chown=scc --from=0 /go/src/github.com/central-controller/src/monitor/monitor ./
+COPY --chown=scc --from=0 /go/src/github.com/central-controller/build/entrypoint ./
+RUN chmod +x entrypoint
+
+USER scc
+
+ENTRYPOINT ["./entrypoint"]
-# Steps for building v1 API Docker Image\r
-\r
- `$cd central-controller`\r
-\r
+# Steps for building v1 API Docker Image
+
+ `$cd central-controller`
+
`$docker build -f build/Dockerfile . -t scc`
\ No newline at end of file
-# Steps for running v1 API microservices\r
-\r
-### Precondition\r
-**1. Install cert-manager**\r
-\r
-`$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml`\r
-\r
-### Steps to install packages from yaml\r
-**1. Create namespace for SDEWAN Central Controller v1Microservices**\r
-\r
-`$cd kubernetes`\r
-`$ kubectl create namespace sdewan-system`\r
-\r
-**2. Create Databases used by SDEWAN Central Controller v1 Microservices for Etcd and Mongo**\r
-\r
-`$ kubectl apply -f scc_db.yaml -n sdewan-system`\r
-\r
-**3. create SDEWAN Central Controller v1 Microservices**\r
-\r
-`$ kubectl apply -f scc.yaml -n sdewan-system`\r
-\r
-`$ kubectl apply -f scc_rsync.yaml -n sdewan-system`\r
-\r
-**4. install monitor resources**\r
-\r
-`$ ./monitor-deploy.sh`\r
+# Steps for running v1 API microservices
+
+### Precondition
+**1. Install cert-manager**
+
+`$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml`
+
+### Steps to install packages from yaml
+**1. Create namespace for SDEWAN Central Controller v1Microservices**
+
+`$cd kubernetes`
+`$ kubectl create namespace sdewan-system`
+
+**2. Create Databases used by SDEWAN Central Controller v1 Microservices for Etcd and Mongo**
+
+`$ kubectl apply -f scc_db.yaml -n sdewan-system`
+
+**3. create SDEWAN Central Controller v1 Microservices**
+
+`$ kubectl apply -f scc.yaml -n sdewan-system`
+
+`$ kubectl apply -f scc_rsync.yaml -n sdewan-system`
+
+**4. install monitor resources**
+
+`$ ./monitor-deploy.sh`
-kubectl apply -f monitor/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml\r
-kubectl apply -f monitor/role.yaml\r
-kubectl apply -f monitor/cluster_role.yaml\r
-kubectl apply -f monitor/role_binding.yaml\r
-kubectl apply -f monitor/clusterrole_binding.yaml\r
-kubectl apply -f monitor/service_account.yaml\r
-kubectl apply -f monitor/operator.yaml\r
+kubectl apply -f monitor/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml
+kubectl apply -f monitor/role.yaml
+kubectl apply -f monitor/cluster_role.yaml
+kubectl apply -f monitor/role_binding.yaml
+kubectl apply -f monitor/clusterrole_binding.yaml
+kubectl apply -f monitor/service_account.yaml
+kubectl apply -f monitor/operator.yaml
-kubectl delete -f monitor/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml\r
-kubectl delete -f monitor/role.yaml\r
-kubectl delete -f monitor/cluster_role.yaml\r
-kubectl delete -f monitor/role_binding.yaml\r
-kubectl delete -f monitor/clusterrole_binding.yaml\r
-kubectl delete -f monitor/service_account.yaml\r
-kubectl delete -f monitor/operator.yaml\r
+kubectl delete -f monitor/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml
+kubectl delete -f monitor/role.yaml
+kubectl delete -f monitor/cluster_role.yaml
+kubectl delete -f monitor/role_binding.yaml
+kubectl delete -f monitor/clusterrole_binding.yaml
+kubectl delete -f monitor/service_account.yaml
+kubectl delete -f monitor/operator.yaml
-apiVersion: rbac.authorization.k8s.io/v1\r
-kind: ClusterRole\r
-metadata:\r
- creationTimestamp: null\r
- name: monitor\r
-rules:\r
-- apiGroups:\r
- - ""\r
- resources:\r
- - pods\r
- - services\r
- - endpoints\r
- - persistentvolumeclaims\r
- - events\r
- - configmaps\r
- - secrets\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - apps\r
- resources:\r
- - deployments\r
- - daemonsets\r
- - replicasets\r
- - statefulsets\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - monitoring.coreos.com\r
- resources:\r
- - servicemonitors\r
- verbs:\r
- - get\r
- - create\r
-- apiGroups:\r
- - apps\r
- resourceNames:\r
- - monitor\r
- resources:\r
- - deployments/finalizers\r
- verbs:\r
- - update\r
-- apiGroups:\r
- - ""\r
- resources:\r
- - pods\r
- verbs:\r
- - get\r
-- apiGroups:\r
- - apps\r
- resources:\r
- - replicasets\r
- verbs:\r
- - get\r
-- apiGroups:\r
- - k8splugin.io\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - batch\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - extensions\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - certificates.k8s.io\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ creationTimestamp: null
+ name: monitor
+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:
+ - monitor
+ resources:
+ - deployments/finalizers
+ verbs:
+ - update
+- apiGroups:
+ - ""
+ resources:
+ - pods
+ verbs:
+ - get
+- apiGroups:
+ - apps
+ resources:
+ - replicasets
+ verbs:
+ - get
+- apiGroups:
+ - k8splugin.io
+ resources:
+ - '*'
+ verbs:
+ - '*'
+- apiGroups:
+ - batch
+ resources:
+ - '*'
+ verbs:
+ - '*'
+- apiGroups:
+ - extensions
+ resources:
+ - '*'
+ verbs:
+ - '*'
+- apiGroups:
+ - certificates.k8s.io
+ resources:
+ - '*'
+ verbs:
+ - '*'
-kind: ClusterRoleBinding\r
-apiVersion: rbac.authorization.k8s.io/v1\r
-metadata:\r
- name: monitor\r
-subjects:\r
-- kind: ServiceAccount\r
- name: monitor\r
- namespace: default\r
-roleRef:\r
- kind: ClusterRole\r
- name: monitor\r
- apiGroup: rbac.authorization.k8s.io\r
+kind: ClusterRoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: monitor
+subjects:
+- kind: ServiceAccount
+ name: monitor
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: monitor
+ apiGroup: rbac.authorization.k8s.io
-apiVersion: k8splugin.io/v1alpha1\r
-kind: ResourceBundleState\r
-metadata:\r
- name: example-resourcebundlestate\r
- labels:\r
- "emco/deployment-id": "bionic-beaver"\r
-spec:\r
- selector:\r
- matchLabels:\r
- "emco/deployment-id": "bionic-beaver"\r
-status:\r
- ready: false\r
+apiVersion: k8splugin.io/v1alpha1
+kind: ResourceBundleState
+metadata:
+ name: example-resourcebundlestate
+ labels:
+ "emco/deployment-id": "bionic-beaver"
+spec:
+ selector:
+ matchLabels:
+ "emco/deployment-id": "bionic-beaver"
+status:
+ ready: false
-apiVersion: apiextensions.k8s.io/v1\r
-kind: CustomResourceDefinition\r
-metadata:\r
- name: resourcebundlestates.k8splugin.io\r
-spec:\r
- group: k8splugin.io\r
- names:\r
- kind: ResourceBundleState\r
- listKind: ResourceBundleStateList\r
- plural: resourcebundlestates\r
- singular: resourcebundlestate\r
- scope: Namespaced\r
- versions:\r
- - name: v1alpha1\r
- schema:\r
- openAPIV3Schema:\r
- properties:\r
- apiVersion:\r
- description: 'APIVersion defines the versioned schema of this representation\r
- of an object. Servers should convert recognized schemas to the latest\r
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'\r
- type: string\r
- kind:\r
- description: 'Kind is a string value representing the REST resource this\r
- object represents. Servers may infer this from the endpoint the client\r
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'\r
- type: string\r
- metadata:\r
- type: object\r
- spec:\r
- properties:\r
- selector:\r
- type: object\r
- required:\r
- - selector\r
- type: object\r
- status:\r
- properties:\r
- podStatuses:\r
- items:\r
- type: object\r
- type: array\r
- ready:\r
- type: boolean\r
- resourceCount:\r
- format: int32\r
- type: integer\r
- serviceStatuses:\r
- items:\r
- type: object\r
- type: array\r
- configMapStatuses:\r
- items:\r
- type: object\r
- type: array\r
- deploymentStatuses:\r
- items:\r
- type: object\r
- type: array\r
- secretStatuses:\r
- items:\r
- type: object\r
- type: array\r
- daemonSetStatuses:\r
- items:\r
- type: object\r
- type: array\r
- ingressStatuses:\r
- items:\r
- type: object\r
- type: array\r
- jobStatuses:\r
- items:\r
- type: object\r
- type: array\r
- statefulSetStatuses:\r
- items:\r
- type: object\r
- type: array\r
- csrStatuses:\r
- items:\r
- type: object\r
- type: array\r
- required:\r
- - ready\r
- - resourceCount\r
- - podStatuses\r
- - serviceStatuses\r
- - configMapStatuses\r
- - deploymentStatuses\r
- - secretStatuses\r
- - daemonSetStatuses\r
- - ingressStatuses\r
- - jobStatuses\r
- - statefulSetStatuses\r
- - csrStatuses\r
- type: object\r
- type: object\r
- served: true\r
- storage: true\r
- subresources:\r
- status: {}\r
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: resourcebundlestates.k8splugin.io
+spec:
+ group: k8splugin.io
+ names:
+ kind: ResourceBundleState
+ listKind: ResourceBundleStateList
+ plural: resourcebundlestates
+ singular: resourcebundlestate
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ properties:
+ selector:
+ type: object
+ required:
+ - selector
+ type: object
+ status:
+ properties:
+ podStatuses:
+ items:
+ type: object
+ type: array
+ ready:
+ type: boolean
+ resourceCount:
+ format: int32
+ type: integer
+ serviceStatuses:
+ items:
+ type: object
+ type: array
+ configMapStatuses:
+ items:
+ type: object
+ type: array
+ deploymentStatuses:
+ items:
+ type: object
+ type: array
+ secretStatuses:
+ items:
+ type: object
+ type: array
+ daemonSetStatuses:
+ items:
+ type: object
+ type: array
+ ingressStatuses:
+ items:
+ type: object
+ type: array
+ jobStatuses:
+ items:
+ type: object
+ type: array
+ statefulSetStatuses:
+ items:
+ type: object
+ type: array
+ csrStatuses:
+ items:
+ type: object
+ type: array
+ required:
+ - ready
+ - resourceCount
+ - podStatuses
+ - serviceStatuses
+ - configMapStatuses
+ - deploymentStatuses
+ - secretStatuses
+ - daemonSetStatuses
+ - ingressStatuses
+ - jobStatuses
+ - statefulSetStatuses
+ - csrStatuses
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
-kubectl delete rolebinding monitor\r
-kubectl delete clusterrolebinding monitor\r
-kubectl delete role monitor\r
-kubectl delete clusterrole monitor\r
-kubectl delete serviceaccount monitor\r
-kubectl delete deploy monitor\r
+kubectl delete rolebinding monitor
+kubectl delete clusterrolebinding monitor
+kubectl delete role monitor
+kubectl delete clusterrole monitor
+kubectl delete serviceaccount monitor
+kubectl delete deploy monitor
-apiVersion: apps/v1\r
-kind: Deployment\r
-metadata:\r
- name: monitor\r
- labels:\r
- "emco/deployment-id": "monitor"\r
-spec:\r
- replicas: 1\r
- selector:\r
- matchLabels:\r
- "emco/deployment-id": "monitor"\r
- template:\r
- metadata:\r
- labels:\r
- "emco/deployment-id": "monitor"\r
- spec:\r
- serviceAccountName: monitor\r
- containers:\r
- - name: monitor\r
- # Replace this with the built image name\r
- image: scc:latest\r
- command: ["/opt/scc/entrypoint", "monitor"]\r
- imagePullPolicy: IfNotPresent\r
- env:\r
- - name: WATCH_NAMESPACE\r
- value: ""\r
- - name: POD_NAME\r
- valueFrom:\r
- fieldRef:\r
- fieldPath: metadata.name\r
- - name: OPERATOR_NAME\r
- value: "monitor"\r
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: monitor
+ labels:
+ "emco/deployment-id": "monitor"
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ "emco/deployment-id": "monitor"
+ template:
+ metadata:
+ labels:
+ "emco/deployment-id": "monitor"
+ spec:
+ serviceAccountName: monitor
+ containers:
+ - name: monitor
+ # Replace this with the built image name
+ image: scc:latest
+ command: ["/opt/scc/entrypoint", "monitor"]
+ imagePullPolicy: IfNotPresent
+ env:
+ - name: WATCH_NAMESPACE
+ value: ""
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: OPERATOR_NAME
+ value: "monitor"
-apiVersion: rbac.authorization.k8s.io/v1\r
-kind: Role\r
-metadata:\r
- creationTimestamp: null\r
- name: monitor\r
-rules:\r
-- apiGroups:\r
- - ""\r
- resources:\r
- - pods\r
- - services\r
- - endpoints\r
- - persistentvolumeclaims\r
- - events\r
- - configmaps\r
- - secrets\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - apps\r
- resources:\r
- - deployments\r
- - daemonsets\r
- - replicasets\r
- - statefulsets\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - monitoring.coreos.com\r
- resources:\r
- - servicemonitors\r
- verbs:\r
- - get\r
- - create\r
-- apiGroups:\r
- - apps\r
- resourceNames:\r
- - monitor\r
- resources:\r
- - deployments/finalizers\r
- verbs:\r
- - update\r
-- apiGroups:\r
- - ""\r
- resources:\r
- - pods\r
- verbs:\r
- - get\r
-- apiGroups:\r
- - apps\r
- resources:\r
- - replicasets\r
- verbs:\r
- - get\r
-- apiGroups:\r
- - k8splugin.io\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - batch\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
-- apiGroups:\r
- - extensions\r
- resources:\r
- - '*'\r
- verbs:\r
- - '*'\r
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ creationTimestamp: null
+ name: monitor
+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:
+ - monitor
+ resources:
+ - deployments/finalizers
+ verbs:
+ - update
+- apiGroups:
+ - ""
+ resources:
+ - pods
+ verbs:
+ - get
+- apiGroups:
+ - apps
+ resources:
+ - replicasets
+ verbs:
+ - get
+- apiGroups:
+ - k8splugin.io
+ resources:
+ - '*'
+ verbs:
+ - '*'
+- apiGroups:
+ - batch
+ resources:
+ - '*'
+ verbs:
+ - '*'
+- apiGroups:
+ - extensions
+ resources:
+ - '*'
+ verbs:
+ - '*'
-kind: RoleBinding\r
-apiVersion: rbac.authorization.k8s.io/v1\r
-metadata:\r
- name: monitor\r
-subjects:\r
-- kind: ServiceAccount\r
- name: monitor\r
-roleRef:\r
- kind: Role\r
- name: monitor\r
- apiGroup: rbac.authorization.k8s.io\r
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: monitor
+subjects:
+- kind: ServiceAccount
+ name: monitor
+roleRef:
+ kind: Role
+ name: monitor
+ apiGroup: rbac.authorization.k8s.io
-apiVersion: v1\r
-kind: ServiceAccount\r
-metadata:\r
- name: monitor\r
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: monitor
-# Resources to create SDEWAN Central Controller v1 Microservices\r
-# SCC Config Map\r
-apiVersion: rbac.authorization.k8s.io/v1\r
-kind: ClusterRoleBinding\r
-metadata:\r
- name: scc-rbac\r
-subjects:\r
- - kind: ServiceAccount\r
- name: default\r
- namespace: sdewan-system\r
-roleRef:\r
- kind: ClusterRole\r
- name: cluster-admin\r
- apiGroup: rbac.authorization.k8s.io\r
-\r
----\r
-# SCC Config Map\r
-kind: ConfigMap\r
-apiVersion: v1\r
-metadata:\r
- name: scc\r
- labels:\r
- app: scc\r
-data:\r
- config.json: |\r
- {\r
- "database-type": "mongo",\r
- "database-ip": "mongo",\r
- "etcd-ip": "etcd",\r
- "service-port": "9015"\r
- }\r
- rsync_config.json: |\r
- {\r
- "rsync-ip": "rsync",\r
- "rsync-port": "9041"\r
- }\r
-\r
----\r
-# SCC Service\r
-apiVersion: v1\r
-kind: Service\r
-metadata:\r
- name: scc\r
- labels:\r
- app: scc\r
-spec:\r
- selector:\r
- app: scc\r
- type: NodePort\r
- ports:\r
- - name: http\r
- port: 9015\r
- nodePort: 31298\r
- protocol: TCP\r
- targetPort: 9015\r
-\r
----\r
-# SCC Deployment\r
-apiVersion: apps/v1\r
-kind: Deployment\r
-metadata:\r
- name: scc\r
-spec:\r
- replicas: 1\r
- selector:\r
- matchLabels:\r
- app: scc\r
- template:\r
- metadata:\r
- labels:\r
- app: scc\r
- spec:\r
- containers:\r
- - name: scc\r
- image: scc:latest\r
- imagePullPolicy: IfNotPresent\r
- command: ["/opt/scc/entrypoint", "scc"]\r
- workingDir: /opt/scc\r
- ports:\r
- - containerPort: 9015\r
- volumeMounts:\r
- - name: config\r
- mountPath: /opt/scc/config.json\r
- subPath: config.json\r
- - name: rsync-config\r
- mountPath: /opt/scc/rsync_config.json\r
- subPath: rsync_config.json\r
- volumes:\r
- - name: config\r
- configMap:\r
- name: scc\r
- items:\r
- - key: config.json\r
- path: config.json\r
- - name: rsync-config\r
- configMap:\r
- name: scc\r
- items:\r
- - key: rsync_config.json\r
- path: rsync_config.json\r
+# Resources to create SDEWAN Central Controller v1 Microservices
+# SCC Config Map
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: scc-rbac
+subjects:
+ - kind: ServiceAccount
+ name: default
+ namespace: sdewan-system
+roleRef:
+ kind: ClusterRole
+ name: cluster-admin
+ apiGroup: rbac.authorization.k8s.io
+
+---
+# SCC Config Map
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ name: scc
+ labels:
+ app: scc
+data:
+ config.json: |
+ {
+ "database-type": "mongo",
+ "database-ip": "mongo",
+ "etcd-ip": "etcd",
+ "service-port": "9015"
+ }
+ rsync_config.json: |
+ {
+ "rsync-ip": "rsync",
+ "rsync-port": "9041"
+ }
+
+---
+# SCC Service
+apiVersion: v1
+kind: Service
+metadata:
+ name: scc
+ labels:
+ app: scc
+spec:
+ selector:
+ app: scc
+ type: NodePort
+ ports:
+ - name: http
+ port: 9015
+ nodePort: 31298
+ protocol: TCP
+ targetPort: 9015
+
+---
+# SCC Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: scc
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: scc
+ template:
+ metadata:
+ labels:
+ app: scc
+ spec:
+ containers:
+ - name: scc
+ image: scc:latest
+ imagePullPolicy: IfNotPresent
+ command: ["/opt/scc/entrypoint", "scc"]
+ workingDir: /opt/scc
+ ports:
+ - containerPort: 9015
+ volumeMounts:
+ - name: config
+ mountPath: /opt/scc/config.json
+ subPath: config.json
+ - name: rsync-config
+ mountPath: /opt/scc/rsync_config.json
+ subPath: rsync_config.json
+ volumes:
+ - name: config
+ configMap:
+ name: scc
+ items:
+ - key: config.json
+ path: config.json
+ - name: rsync-config
+ configMap:
+ name: scc
+ items:
+ - key: rsync_config.json
+ path: rsync_config.json
-# Resources to create Databases used by SDEWAN Central Controller v1 Microservices\r
----\r
-#Etcd Service\r
-apiVersion: v1\r
-kind: Service\r
-metadata:\r
- labels:\r
- app: etcd\r
- name: etcd\r
-spec:\r
- ports:\r
- - name: "2379"\r
- port: 2379\r
- targetPort: 2379\r
- - name: "2380"\r
- port: 2380\r
- targetPort: 2380\r
- selector:\r
- app: etcd\r
-\r
----\r
-#Mongo Service\r
-apiVersion: v1\r
-kind: Service\r
-metadata:\r
- labels:\r
- app: mongo\r
- name: mongo\r
-spec:\r
- ports:\r
- - name: "27017"\r
- port: 27017\r
- targetPort: 27017\r
- selector:\r
- app: mongo\r
-\r
----\r
-#Etcd Deployment\r
-apiVersion: apps/v1\r
-kind: Deployment\r
-metadata:\r
- name: etcd\r
-spec:\r
- replicas: 1\r
- selector:\r
- matchLabels:\r
- app: etcd\r
- template:\r
- metadata:\r
- labels:\r
- app: etcd\r
- spec:\r
- containers:\r
- - image: bitnami/etcd:3\r
- imagePullPolicy: IfNotPresent\r
- name: etcd\r
- env:\r
- - name: "ALLOW_NONE_AUTHENTICATION"\r
- value: "yes"\r
- ports:\r
- - containerPort: 2379\r
- - containerPort: 2380\r
-\r
----\r
-#Mongo Deployment\r
-apiVersion: apps/v1\r
-kind: Deployment\r
-metadata:\r
- labels:\r
- app: mongo\r
- name: mongo\r
-spec:\r
- replicas: 1\r
- selector:\r
- matchLabels:\r
- app: mongo\r
- template:\r
- metadata:\r
- labels:\r
- app: mongo\r
- spec:\r
- containers:\r
- - image: mongo\r
- imagePullPolicy: IfNotPresent\r
- name: mongo\r
- ports:\r
- - containerPort: 27017\r
+# Resources to create Databases used by SDEWAN Central Controller v1 Microservices
+---
+#Etcd Service
+apiVersion: v1
+kind: Service
+metadata:
+ labels:
+ app: etcd
+ name: etcd
+spec:
+ ports:
+ - name: "2379"
+ port: 2379
+ targetPort: 2379
+ - name: "2380"
+ port: 2380
+ targetPort: 2380
+ selector:
+ app: etcd
+
+---
+#Mongo Service
+apiVersion: v1
+kind: Service
+metadata:
+ labels:
+ app: mongo
+ name: mongo
+spec:
+ ports:
+ - name: "27017"
+ port: 27017
+ targetPort: 27017
+ selector:
+ app: mongo
+
+---
+#Etcd Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: etcd
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: etcd
+ template:
+ metadata:
+ labels:
+ app: etcd
+ spec:
+ containers:
+ - image: bitnami/etcd:3
+ imagePullPolicy: IfNotPresent
+ name: etcd
+ env:
+ - name: "ALLOW_NONE_AUTHENTICATION"
+ value: "yes"
+ ports:
+ - containerPort: 2379
+ - containerPort: 2380
+
+---
+#Mongo Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: mongo
+ name: mongo
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: mongo
+ template:
+ metadata:
+ labels:
+ app: mongo
+ spec:
+ containers:
+ - image: mongo
+ imagePullPolicy: IfNotPresent
+ name: mongo
+ ports:
+ - containerPort: 27017
-# Resources to create Rsync used by SDEWAN Central Controller v1 Microservices\r
----\r
-# RSYNC ConfigMap\r
-kind: ConfigMap\r
-apiVersion: v1\r
-metadata:\r
- name: rsync\r
- labels:\r
- app: rsync\r
-data:\r
- config.json: |\r
- {\r
- "database-type": "mongo",\r
- "database-ip": "mongo",\r
- "etcd-ip": "etcd"\r
- }\r
-\r
----\r
-# RSYNC Service\r
-apiVersion: v1\r
-kind: Service\r
-metadata:\r
- name: rsync\r
- labels:\r
- app: rsync\r
-spec:\r
- selector:\r
- app: rsync\r
- type: NodePort\r
- ports:\r
- - name: internal\r
- port: 9041\r
- protocol: TCP\r
- targetPort: 9041\r
- nodePort: 31297\r
-\r
----\r
-# RSYNC Deployment\r
-apiVersion: apps/v1\r
-kind: Deployment\r
-metadata:\r
- name: rsync\r
-spec:\r
- replicas: 1\r
- selector:\r
- matchLabels:\r
- app: rsync\r
- template:\r
- metadata:\r
- labels:\r
- app: rsync\r
- spec:\r
- containers:\r
- - name: rsync\r
- image: scc:latest\r
- imagePullPolicy: IfNotPresent\r
- command: ["/opt/scc/entrypoint", "rsync"]\r
- workingDir: /opt/scc\r
- ports:\r
- - containerPort: 9041\r
- volumeMounts:\r
- - name: config\r
- mountPath: /opt/scc/config.json\r
- subPath: config.json\r
- volumes:\r
- - name: config\r
- configMap:\r
- name: rsync\r
- items:\r
- - key: config.json\r
+# Resources to create Rsync used by SDEWAN Central Controller v1 Microservices
+---
+# RSYNC ConfigMap
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ name: rsync
+ labels:
+ app: rsync
+data:
+ config.json: |
+ {
+ "database-type": "mongo",
+ "database-ip": "mongo",
+ "etcd-ip": "etcd"
+ }
+
+---
+# RSYNC Service
+apiVersion: v1
+kind: Service
+metadata:
+ name: rsync
+ labels:
+ app: rsync
+spec:
+ selector:
+ app: rsync
+ type: NodePort
+ ports:
+ - name: internal
+ port: 9041
+ protocol: TCP
+ targetPort: 9041
+ nodePort: 31297
+
+---
+# RSYNC Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: rsync
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: rsync
+ template:
+ metadata:
+ labels:
+ app: rsync
+ spec:
+ containers:
+ - name: rsync
+ image: scc:latest
+ imagePullPolicy: IfNotPresent
+ command: ["/opt/scc/entrypoint", "rsync"]
+ workingDir: /opt/scc
+ ports:
+ - containerPort: 9041
+ volumeMounts:
+ - name: config
+ mountPath: /opt/scc/config.json
+ subPath: config.json
+ volumes:
+ - name: config
+ configMap:
+ name: rsync
+ items:
+ - key: config.json
path: config.json
\ No newline at end of file
-# Temporary Build Files\r
-build/_output\r
-build/_test\r
-/output\r
-### VisualStudioCode ###\r
-.vscode/*\r
-.history\r
+# Temporary Build Files
+build/_output
+build/_test
+/output
+### VisualStudioCode ###
+.vscode/*
+.history
-// SPDX-License-Identifier: Apache-2.0\r
+// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2020 Intel Corporation
\ No newline at end of file
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2020 Intel Corporation\r
-\r
-export GO111MODULE=on\r
-\r
-all: clean\r
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \\r
- go build -a -ldflags '-extldflags "-static"' \\r
- -o ./monitor ./cmd/manager/main.go\r
-\r
-build: clean test cover\r
-deploy: build\r
-\r
-.PHONY: test\r
-test: clean\r
- @go test -v ./...\r
-\r
-format:\r
- @go fmt ./...\r
-\r
-clean:\r
- @rm -f monitor\r
-\r
-.PHONY: cover\r
-cover:\r
- @go test -p 2 ./... -coverprofile=coverage.out\r
- @go tool cover -html=coverage.out -o coverage.html\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2020 Intel Corporation
+
+export GO111MODULE=on
+
+all: clean
+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
+ go build -a -ldflags '-extldflags "-static"' \
+ -o ./monitor ./cmd/manager/main.go
+
+build: clean test cover
+deploy: build
+
+.PHONY: test
+test: clean
+ @go test -v ./...
+
+format:
+ @go fmt ./...
+
+clean:
+ @rm -f monitor
+
+.PHONY: cover
+cover:
+ @go test -p 2 ./... -coverprofile=coverage.out
+ @go tool cover -html=coverage.out -o coverage.html
-// +build tools\r
-\r
-package tools\r
-\r
-import (\r
- _ "sigs.k8s.io/controller-tools/pkg/crd"\r
-)\r
+// +build tools
+
+package tools
+
+import (
+ _ "sigs.k8s.io/controller-tools/pkg/crd"
+)
-# Steps to register local cluster\r
-\r
-**1. Copy Kubeconfig as admin.conf in this folder**\r
-**2. Compiled as:**\r
- `$ go build -o reg_cluster ./reg_cluster.go`\r
-**3. Edit config.json with mongo db and etcd ip**\r
-**4. Run command to register cluster**\r
- `$ ./reg_cluster`\r
-\r
+# Steps to register local cluster
+
+**1. Copy Kubeconfig as admin.conf in this folder**
+**2. Compiled as:**
+ `$ go build -o reg_cluster ./reg_cluster.go`
+**3. Edit config.json with mongo db and etcd ip**
+**4. Run command to register cluster**
+ `$ ./reg_cluster`
+
-{\r
-"etcd-ip": "",\r
-"database-ip": ""\r
-}\r
+{
+"etcd-ip": "",
+"database-ip": ""
+}
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2020 Intel Corporation\r
-\r
-export GO111MODULE=on\r
-\r
-all: clean\r
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \\r
- go build -tags rsync -o ./rsync ./cmd/main.go\r
-\r
-# The following is done this way as each patch on CI runs build and each merge runs deploy. So for build we don't need to build binary and hence\r
-# no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with\r
-# mock plugin errors out for unit tests. So the seperation avoids the error.\r
-\r
-build: clean test cover\r
-deploy: build\r
-\r
-.PHONY: test\r
-test: clean\r
- @go test -race ./...\r
-\r
-format:\r
- @go fmt ./...\r
-\r
-clean:\r
- @rm -f rsync coverage.html coverage.out\r
-\r
-.PHONY: cover\r
-cover:\r
- @go test -race ./... -coverprofile=coverage.out\r
- @go tool cover -html=coverage.out -o coverage.html\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2020 Intel Corporation
+
+export GO111MODULE=on
+
+all: clean
+ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
+ go build -tags rsync -o ./rsync ./cmd/main.go
+
+# The following is done this way as each patch on CI runs build and each merge runs deploy. So for build we don't need to build binary and hence
+# no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with
+# mock plugin errors out for unit tests. So the seperation avoids the error.
+
+build: clean test cover
+deploy: build
+
+.PHONY: test
+test: clean
+ @go test -race ./...
+
+format:
+ @go fmt ./...
+
+clean:
+ @rm -f rsync coverage.html coverage.out
+
+.PHONY: cover
+cover:
+ @go test -race ./... -coverprofile=coverage.out
+ @go tool cover -html=coverage.out -o coverage.html
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2020 Intel Corporation\r
-\r
-FROM ubuntu:18.04\r
-\r
-ARG HTTP_PROXY=${HTTP_PROXY}\r
-ARG HTTPS_PROXY=${HTTPS_PROXY}\r
-\r
-ENV http_proxy $HTTP_PROXY\r
-ENV https_proxy $HTTPS_PROXY\r
-ENV no_proxy $NO_PROXY\r
-\r
-EXPOSE 9016\r
-\r
-RUN groupadd -r onap && useradd -r -g onap onap\r
-\r
-WORKDIR /opt/multicloud/k8s/rsync\r
-RUN chown onap:onap /opt/multicloud/k8s/rsync -R\r
-\r
-ADD --chown=onap ./rsync ./\r
-\r
-USER onap\r
-\r
-CMD ["./rsync"]\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2020 Intel Corporation
+
+FROM ubuntu:18.04
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+ENV no_proxy $NO_PROXY
+
+EXPOSE 9016
+
+RUN groupadd -r onap && useradd -r -g onap onap
+
+WORKDIR /opt/multicloud/k8s/rsync
+RUN chown onap:onap /opt/multicloud/k8s/rsync -R
+
+ADD --chown=onap ./rsync ./
+
+USER onap
+
+CMD ["./rsync"]
-# SPDX-license-identifier: Apache-2.0\r
-##############################################################################\r
-# Copyright (c) 2021 Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
-# are made available under the terms of the Apache License, Version 2.0\r
-# which accompanies this distribution, and is available at\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-##############################################################################\r
-\r
-export GO111MODULE=on\r
-\r
-all: clean\r
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64\r
- @go build -tags netgo -o ./scc ./cmd/main.go\r
-\r
-# The following is done this way as each patch on CI runs build and each merge runs deploy. So for build we don't need to build binary and hence\r
-# no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with\r
-# mock plugin errors out for unit tests. So the seperation avoids the error.\r
-\r
-build: clean test cover\r
-deploy: build\r
-\r
-.PHONY: test\r
-test: clean\r
- @go test -race ./...\r
-\r
-format:\r
- @go fmt ./...\r
-\r
-clean:\r
- @find . -name "*so" -delete\r
- @rm -f scc coverage.html coverage.out\r
-\r
-.PHONY: cover\r
-cover:\r
- @go test -race ./... -coverprofile=coverage.out\r
- @go tool cover -html=coverage.out -o coverage.html\r
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2021 Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+export GO111MODULE=on
+
+all: clean
+ CGO_ENABLED=1 GOOS=linux GOARCH=amd64
+ @go build -tags netgo -o ./scc ./cmd/main.go
+
+# The following is done this way as each patch on CI runs build and each merge runs deploy. So for build we don't need to build binary and hence
+# no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with
+# mock plugin errors out for unit tests. So the seperation avoids the error.
+
+build: clean test cover
+deploy: build
+
+.PHONY: test
+test: clean
+ @go test -race ./...
+
+format:
+ @go fmt ./...
+
+clean:
+ @find . -name "*so" -delete
+ @rm -f scc coverage.html coverage.out
+
+.PHONY: cover
+cover:
+ @go test -race ./... -coverprofile=coverage.out
+ @go tool cover -html=coverage.out -o coverage.html
-{\r
-"etcd-ip": "",\r
-"database-ip": ""\r
-}\r
+{
+"etcd-ip": "",
+"database-ip": ""
+}
-/*\r
- * Copyright 2020 Intel Corporation, Inc\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package manager\r
-\r
-import (\r
- "encoding/json"\r
- "io"\r
-\r
- "github.com/akraino-edge-stack/icn-sdwan/central-controller/src/scc/pkg/module"\r
- "github.com/open-ness/EMCO/src/orchestrator/pkg/infra/db"\r
- pkgerrors "github.com/pkg/errors"\r
-)\r
-\r
-type ResourceObjectKey struct {\r
- Cluster string `json:"cluster-info"`\r
- Type string `json:"type"`\r
- Name string `json:"name"`\r
-}\r
-\r
-// ResourceObjectManager implements the ControllerObjectManager\r
-type ResourceObjectManager struct {\r
- BaseObjectManager\r
-}\r
-\r
-func NewResourceObjectManager() *ResourceObjectManager {\r
- return &ResourceObjectManager{\r
- BaseObjectManager{\r
- storeName: StoreName,\r
- tagMeta: "resource",\r
- depResManagers: []ControllerObjectManager{},\r
- ownResManagers: []ControllerObjectManager{},\r
- },\r
- }\r
-}\r
-\r
-func (c *ResourceObjectManager) GetResourceName() string {\r
- return Resource\r
-}\r
-\r
-func (c *ResourceObjectManager) IsOperationSupported(oper string) bool {\r
- return false\r
-}\r
-\r
-func (c *ResourceObjectManager) CreateEmptyObject() module.ControllerObject {\r
- return &module.ResourceObject{}\r
-}\r
-\r
-func (c *ResourceObjectManager) GetStoreKey(m map[string]string, t module.ControllerObject, isCollection bool) (db.Key, error) {\r
- // Currently no collections fetching supported\r
- return ResourceObjectKey{\r
- Cluster: m[OverlayResource] + "-" + m[DeviceResource],\r
- Type: m["Type"],\r
- Name: m["Name"],\r
- }, nil\r
-}\r
-\r
-func (c *ResourceObjectManager) ParseObject(r io.Reader) (module.ControllerObject, error) {\r
- var v module.ResourceObject\r
- err := json.NewDecoder(r).Decode(&v)\r
- return &v, err\r
-}\r
-\r
-func (c *ResourceObjectManager) CreateObject(m map[string]string, t module.ControllerObject) (module.ControllerObject, error) {\r
- // DB Operation\r
- t, err := GetDBUtils().CreateObject(c, m, t)\r
- return t, err\r
-}\r
-\r
-func (c *ResourceObjectManager) GetObject(m map[string]string) (module.ControllerObject, error) {\r
- // DB Operation\r
- t, err := GetDBUtils().GetObject(c, m)\r
- return t, err\r
-}\r
-\r
-func (c *ResourceObjectManager) GetObjects(m map[string]string) ([]module.ControllerObject, error) {\r
- return []module.ControllerObject{}, pkgerrors.New("Not implemented")\r
-}\r
-\r
-func (c *ResourceObjectManager) UpdateObject(m map[string]string, t module.ControllerObject) (module.ControllerObject, error) {\r
- // DB Operation\r
- t, err := GetDBUtils().UpdateObject(c, m, t)\r
- return t, err\r
-}\r
-\r
-func (c *ResourceObjectManager) DeleteObject(m map[string]string) error {\r
- // DB Operation\r
- err := GetDBUtils().DeleteObject(c, m)\r
- return err\r
-}\r
+/*
+ * Copyright 2020 Intel Corporation, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package manager
+
+import (
+ "encoding/json"
+ "io"
+
+ "github.com/akraino-edge-stack/icn-sdwan/central-controller/src/scc/pkg/module"
+ "github.com/open-ness/EMCO/src/orchestrator/pkg/infra/db"
+ pkgerrors "github.com/pkg/errors"
+)
+
+type ResourceObjectKey struct {
+ Cluster string `json:"cluster-info"`
+ Type string `json:"type"`
+ Name string `json:"name"`
+}
+
+// ResourceObjectManager implements the ControllerObjectManager
+type ResourceObjectManager struct {
+ BaseObjectManager
+}
+
+func NewResourceObjectManager() *ResourceObjectManager {
+ return &ResourceObjectManager{
+ BaseObjectManager{
+ storeName: StoreName,
+ tagMeta: "resource",
+ depResManagers: []ControllerObjectManager{},
+ ownResManagers: []ControllerObjectManager{},
+ },
+ }
+}
+
+func (c *ResourceObjectManager) GetResourceName() string {
+ return Resource
+}
+
+func (c *ResourceObjectManager) IsOperationSupported(oper string) bool {
+ return false
+}
+
+func (c *ResourceObjectManager) CreateEmptyObject() module.ControllerObject {
+ return &module.ResourceObject{}
+}
+
+func (c *ResourceObjectManager) GetStoreKey(m map[string]string, t module.ControllerObject, isCollection bool) (db.Key, error) {
+ // Currently no collections fetching supported
+ return ResourceObjectKey{
+ Cluster: m[OverlayResource] + "-" + m[DeviceResource],
+ Type: m["Type"],
+ Name: m["Name"],
+ }, nil
+}
+
+func (c *ResourceObjectManager) ParseObject(r io.Reader) (module.ControllerObject, error) {
+ var v module.ResourceObject
+ err := json.NewDecoder(r).Decode(&v)
+ return &v, err
+}
+
+func (c *ResourceObjectManager) CreateObject(m map[string]string, t module.ControllerObject) (module.ControllerObject, error) {
+ // DB Operation
+ t, err := GetDBUtils().CreateObject(c, m, t)
+ return t, err
+}
+
+func (c *ResourceObjectManager) GetObject(m map[string]string) (module.ControllerObject, error) {
+ // DB Operation
+ t, err := GetDBUtils().GetObject(c, m)
+ return t, err
+}
+
+func (c *ResourceObjectManager) GetObjects(m map[string]string) ([]module.ControllerObject, error) {
+ return []module.ControllerObject{}, pkgerrors.New("Not implemented")
+}
+
+func (c *ResourceObjectManager) UpdateObject(m map[string]string, t module.ControllerObject) (module.ControllerObject, error) {
+ // DB Operation
+ t, err := GetDBUtils().UpdateObject(c, m, t)
+ return t, err
+}
+
+func (c *ResourceObjectManager) DeleteObject(m map[string]string) error {
+ // DB Operation
+ err := GetDBUtils().DeleteObject(c, m)
+ return err
+}
-/*\r
- * Copyright 2020 Intel Corporation, Inc\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package module\r
-\r
-// App contains metadata for Apps\r
-type ResourceObject struct {\r
- Metadata ObjectMetaData `json:"metadata"`\r
- Specification ResourceObjectSpec `json:"spec"`\r
-}\r
-\r
-//ResourceObjectSpec contains the parameters\r
-type ResourceObjectSpec struct {\r
- Hash string `json:"hash"`\r
- Ref int `json:"ref"`\r
- ContextId string `json:"cid"`\r
- Status string `json:"status"`\r
-}\r
-\r
-func (c *ResourceObject) GetMetadata() ObjectMetaData {\r
- return c.Metadata\r
-}\r
-\r
-func (c *ResourceObject) GetType() string {\r
- return "Resource"\r
+/*
+ * Copyright 2020 Intel Corporation, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package module
+
+// App contains metadata for Apps
+type ResourceObject struct {
+ Metadata ObjectMetaData `json:"metadata"`
+ Specification ResourceObjectSpec `json:"spec"`
+}
+
+//ResourceObjectSpec contains the parameters
+type ResourceObjectSpec struct {
+ Hash string `json:"hash"`
+ Ref int `json:"ref"`
+ ContextId string `json:"cid"`
+ Status string `json:"status"`
+}
+
+func (c *ResourceObject) GetMetadata() ObjectMetaData {
+ return c.Metadata
+}
+
+func (c *ResourceObject) GetType() string {
+ return "Resource"
}
\ No newline at end of file
-/*\r
- * Copyright 2020 Intel Corporation, Inc\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package resource\r
-\r
-type RouteResource struct {\r
- Name string\r
- Destination string\r
- Gateway string\r
- Device string\r
- Table string\r
-}\r
-\r
-func (c *RouteResource) GetName() string {\r
- return c.Name\r
-}\r
-\r
-func (c *RouteResource) GetType() string {\r
- return "Route"\r
-}\r
-\r
-func (c *RouteResource) ToYaml(target string) string {\r
- basic := `apiVersion: ` + SdewanApiVersion + `\r
-kind: CNFRoute\r
-metadata:\r
- name: ` + c.Name + `\r
- namespace: default\r
- labels:\r
- sdewanPurpose: ` + SdewanPurpose + `\r
- targetCluster: ` + target + `\r
-spec:\r
- dst: ` + c.Destination + `\r
- dev: "` + c.Device + `"\r
- table: ` + c.Table\r
-\r
- if c.Gateway != "" {\r
- basic += `\r
- gw: ` + c.Gateway\r
- }\r
- return basic\r
-}\r
-\r
-func init() {\r
- GetResourceBuilder().Register("Route", &RouteResource{})\r
-}\r
+/*
+ * Copyright 2020 Intel Corporation, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package resource
+
+type RouteResource struct {
+ Name string
+ Destination string
+ Gateway string
+ Device string
+ Table string
+}
+
+func (c *RouteResource) GetName() string {
+ return c.Name
+}
+
+func (c *RouteResource) GetType() string {
+ return "Route"
+}
+
+func (c *RouteResource) ToYaml(target string) string {
+ basic := `apiVersion: ` + SdewanApiVersion + `
+kind: CNFRoute
+metadata:
+ name: ` + c.Name + `
+ namespace: default
+ labels:
+ sdewanPurpose: ` + SdewanPurpose + `
+ targetCluster: ` + target + `
+spec:
+ dst: ` + c.Destination + `
+ dev: "` + c.Device + `"
+ table: ` + c.Table
+
+ if c.Gateway != "" {
+ basic += `
+ gw: ` + c.Gateway
+ }
+ return basic
+}
+
+func init() {
+ GetResourceBuilder().Register("Route", &RouteResource{})
+}
-{\r
-"rsync-ip": "",\r
-"rsync-port": "9041"\r
-}\r
+{
+"rsync-ip": "",
+"rsync-port": "9041"
+}
-{\r
-"etcd-ip": "",\r
-"database-ip": ""\r
-}\r
+{
+"etcd-ip": "",
+"database-ip": ""
+}
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2020 Intel Corporation\r
-\r
- ewo:\r
- host: localhost\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2020 Intel Corporation
+
+ ewo:
+ host: localhost
port: 9015
\ No newline at end of file
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2020 Intel Corporation\r
-\r
-# creating overlay1\r
-version: ewo/v1\r
-resourceContext:\r
- anchor: overlays\r
-metadata:\r
- name: overlay1\r
- description: \r
- userData1: \r
- userData2: \r
-\r
----\r
-# creating overlay2\r
-version: ewo/v1\r
-resourceContext:\r
- anchor: overlays\r
-metadata:\r
- name: overlay2\r
- description: \r
- userData1: \r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2020 Intel Corporation
+
+# creating overlay1
+version: ewo/v1
+resourceContext:
+ anchor: overlays
+metadata:
+ name: overlay1
+ description:
+ userData1:
+ userData2:
+
+---
+# creating overlay2
+version: ewo/v1
+resourceContext:
+ anchor: overlays
+metadata:
+ name: overlay2
+ description:
+ userData1:
userData2:
\ No newline at end of file
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2020 Intel Corporation\r
-\r
-OverlayName: overlay1\r
-ProposalName: proposal1\r
-IPRangelName: iprange1\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2020 Intel Corporation
+
+OverlayName: overlay1
+ProposalName: proposal1
+IPRangelName: iprange1
DeviceName: device1
\ No newline at end of file
-module github.com/open-ness/EMCO/src/orchestrator\r
-\r
-require (\r
- github.com/open-ness/EMCO/src/rsync v0.0.0-00010101000000-000000000000\r
-)\r
-\r
-replace (\r
- github.com/open-ness/EMCO/src/rsync => ../../../../../rsync\r
-)\r
-\r
-go 1.17\r
+module github.com/open-ness/EMCO/src/orchestrator
+
+require (
+ github.com/open-ness/EMCO/src/rsync v0.0.0-00010101000000-000000000000
+)
+
+replace (
+ github.com/open-ness/EMCO/src/rsync => ../../../../../rsync
+)
+
+go 1.17
-module github.com/open-ness/EMCO/src/orchestrator\r
-\r
-require (\r
- github.com/open-ness/EMCO/src/rsync v0.0.0-00010101000000-000000000000\r
-)\r
-\r
-replace (\r
- github.com/open-ness/EMCO/src/rsync => ../../../../../../rsync\r
-)\r
-\r
-go 1.17\r
+module github.com/open-ness/EMCO/src/orchestrator
+
+require (
+ github.com/open-ness/EMCO/src/rsync v0.0.0-00010101000000-000000000000
+)
+
+replace (
+ github.com/open-ness/EMCO/src/rsync => ../../../../../../rsync
+)
+
+go 1.17
-/*\r
-* Copyright 2018 TechMahindra\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
- */\r
-\r
-package auth\r
-\r
-import (\r
- "crypto/tls"\r
- "testing"\r
-)\r
-\r
-//Unit test to varify GetTLSconfig func and varify the tls config min version to be 771\r
-//Assuming cert file name as auth_test.cert\r
-func TestGetTLSConfig(t *testing.T) {\r
- _, err := GetTLSConfig("filedoesnotexist.cert", "filedoesnotexist.cert", "filedoesnotexist.cert")\r
- if err == nil {\r
- t.Errorf("Test failed, expected error but got none")\r
- }\r
- tlsConfig, err := GetTLSConfig("../../../tests/certs/auth_test_certificate.pem",\r
- "../../../tests/certs/auth_test_certificate.pem",\r
- "../../../tests/certs/auth_test_key.pem")\r
- if err != nil {\r
- t.Fatal("Test Failed as GetTLSConfig returned error: " + err.Error())\r
- }\r
- expected := tls.VersionTLS12\r
- actual := tlsConfig.MinVersion\r
- if tlsConfig != nil {\r
- if int(actual) != expected {\r
- t.Errorf("Test Failed due to version mismatch")\r
- }\r
- if tlsConfig == nil {\r
- t.Errorf("Test Failed due to GetTLSConfig returned nil")\r
- }\r
- }\r
-}\r
+/*
+* Copyright 2018 TechMahindra
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package auth
+
+import (
+ "crypto/tls"
+ "testing"
+)
+
+//Unit test to varify GetTLSconfig func and varify the tls config min version to be 771
+//Assuming cert file name as auth_test.cert
+func TestGetTLSConfig(t *testing.T) {
+ _, err := GetTLSConfig("filedoesnotexist.cert", "filedoesnotexist.cert", "filedoesnotexist.cert")
+ if err == nil {
+ t.Errorf("Test failed, expected error but got none")
+ }
+ tlsConfig, err := GetTLSConfig("../../../tests/certs/auth_test_certificate.pem",
+ "../../../tests/certs/auth_test_certificate.pem",
+ "../../../tests/certs/auth_test_key.pem")
+ if err != nil {
+ t.Fatal("Test Failed as GetTLSConfig returned error: " + err.Error())
+ }
+ expected := tls.VersionTLS12
+ actual := tlsConfig.MinVersion
+ if tlsConfig != nil {
+ if int(actual) != expected {
+ t.Errorf("Test Failed due to version mismatch")
+ }
+ if tlsConfig == nil {
+ t.Errorf("Test Failed due to GetTLSConfig returned nil")
+ }
+ }
+}
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2021 Intel Corporation\r
-# The following patch adds a directive for certmanager to inject CA into the CRD\r
-# CRD conversion requires k8s 1.13 or later.\r
-apiVersion: apiextensions.k8s.io/v1\r
-kind: CustomResourceDefinition\r
-metadata:\r
- annotations:\r
- cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)\r
- name: cnflocalservices.batch.sdewan.akraino.org\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2021 Intel Corporation
+# The following patch adds a directive for certmanager to inject CA into the CRD
+# CRD conversion requires k8s 1.13 or later.
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
+ name: cnflocalservices.batch.sdewan.akraino.org
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2021 Intel Corporation\r
-# The following patch adds a directive for certmanager to inject CA into the CRD\r
-# CRD conversion requires k8s 1.13 or later.\r
-apiVersion: apiextensions.k8s.io/v1\r
-kind: CustomResourceDefinition\r
-metadata:\r
- annotations:\r
- cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)\r
- name: cnfnats.batch.sdewan.akraino.org\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2021 Intel Corporation
+# The following patch adds a directive for certmanager to inject CA into the CRD
+# CRD conversion requires k8s 1.13 or later.
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
+ name: cnfnats.batch.sdewan.akraino.org
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2021 Intel Corporation\r
-# The following patch enables conversion webhook for CRD\r
-# CRD conversion requires k8s 1.13 or later.\r
-apiVersion: apiextensions.k8s.io/v1\r
-kind: CustomResourceDefinition\r
-metadata:\r
- name: cnflocalservices.batch.sdewan.akraino.org\r
-spec:\r
- conversion:\r
- strategy: Webhook\r
- webhookClientConfig:\r
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,\r
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)\r
- caBundle: Cg==\r
- service:\r
- namespace: system\r
- name: webhook-service\r
- path: /convert\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2021 Intel Corporation
+# The following patch enables conversion webhook for CRD
+# CRD conversion requires k8s 1.13 or later.
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: cnflocalservices.batch.sdewan.akraino.org
+spec:
+ conversion:
+ strategy: Webhook
+ webhookClientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2021 Intel Corporation\r
-# The following patch enables conversion webhook for CRD\r
-# CRD conversion requires k8s 1.13 or later.\r
-apiVersion: apiextensions.k8s.io/v1\r
-kind: CustomResourceDefinition\r
-metadata:\r
- name: cnfnats.batch.sdewan.akraino.org\r
-spec:\r
- conversion:\r
- strategy: Webhook\r
- webhookClientConfig:\r
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,\r
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)\r
- caBundle: Cg==\r
- service:\r
- namespace: system\r
- name: webhook-service\r
- path: /convert\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2021 Intel Corporation
+# The following patch enables conversion webhook for CRD
+# CRD conversion requires k8s 1.13 or later.
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: cnfnats.batch.sdewan.akraino.org
+spec:
+ conversion:
+ strategy: Webhook
+ webhookClientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
-# SPDX-License-Identifier: Apache-2.0\r
-# Copyright (c) 2021 Intel Corporation\r
----\r
-apiVersion: batch.sdewan.akraino.org/v1alpha1\r
-kind: CNFNAT\r
-metadata:\r
- name: nat-sample\r
- namespace: default\r
- labels:\r
- sdewanPurpose: cnf1\r
-spec:\r
- src: iface1\r
- src_ip: 192.168.1.2\r
- src_dip: 1.2.3.4\r
- dest: iface2\r
- proto: tcp\r
- target: DNAT\r
+# SPDX-License-Identifier: Apache-2.0
+# Copyright (c) 2021 Intel Corporation
+---
+apiVersion: batch.sdewan.akraino.org/v1alpha1
+kind: CNFNAT
+metadata:
+ name: nat-sample
+ namespace: default
+ labels:
+ sdewanPurpose: cnf1
+spec:
+ src: iface1
+ src_ip: 192.168.1.2
+ src_dip: 1.2.3.4
+ dest: iface2
+ proto: tcp
+ target: DNAT
...