CORD-2965 onboard the kubernetes service
Change-Id: I69034d67cc67cdadb8084ec00bcffb50ecc057ea
diff --git a/examples/adminuser-values.yaml b/examples/adminuser-values.yaml
index 6f45295..435a13b 100644
--- a/examples/adminuser-values.yaml
+++ b/examples/adminuser-values.yaml
@@ -38,3 +38,6 @@
vsg-hw:
xosAdminUser: *adminuser
xosAdminPassword: *adminpass
+kubernetes:
+ xosAdminUser: *adminuser
+ xosAdminPassword: *adminpass
diff --git a/examples/candidate-tag-values.yaml b/examples/candidate-tag-values.yaml
index 803616b..aa11d0c 100644
--- a/examples/candidate-tag-values.yaml
+++ b/examples/candidate-tag-values.yaml
@@ -38,3 +38,5 @@
volt_synchronizerImage: "xosproject/volt-synchronizer:candidate"
vsg-hw:
vsg_hw_synchronizerImage: "xosproject/vsg-hw-synchronizer:candidate"
+kubernetes:
+ kubernetes_synchronizerImage: "xosproject/kubernetes-synchronizer:candidate"
diff --git a/examples/filter-images.yaml b/examples/filter-images.yaml
index ff4b082..e9f5e38 100644
--- a/examples/filter-images.yaml
+++ b/examples/filter-images.yaml
@@ -32,6 +32,7 @@
- xosproject/onos-synchronizer
- xosproject/addressmanager-synchronizer
- xosproject/vsg-hw-synchronizer
+- xosproject/kubernetes-synchronizer
- xosproject/fabric-synchronizer
- xosproject/xos-api-tester
- nginx
diff --git a/examples/pull-always-values.yaml b/examples/pull-always-values.yaml
index ab3135b..4093a81 100644
--- a/examples/pull-always-values.yaml
+++ b/examples/pull-always-values.yaml
@@ -30,3 +30,5 @@
imagePullPolicy: 'Always'
vsg-hw:
imagePullPolicy: 'Always'
+kubernetes:
+ imagePullPolicy: 'Always'
diff --git a/xos-core/templates/50-rbac.yaml b/xos-core/templates/50-rbac.yaml
new file mode 100644
index 0000000..7e983b4
--- /dev/null
+++ b/xos-core/templates/50-rbac.yaml
@@ -0,0 +1,35 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: kubernetes-synchronizer
+
+...
+---
+
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: kubernetes-synchronizer-cluster-admin
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: cluster-admin
+subjects:
+ - kind: ServiceAccount
+ name: kubernetes-synchronizer
+ namespace: default
diff --git a/xos-profiles/rcord-lite/requirements.yaml b/xos-profiles/rcord-lite/requirements.yaml
index 6219740..3508a8d 100644
--- a/xos-profiles/rcord-lite/requirements.yaml
+++ b/xos-profiles/rcord-lite/requirements.yaml
@@ -30,3 +30,6 @@
- name: vrouter
version: 0.1.0
repository: file://../../xos-services/vrouter
+- name: kubernetes
+ version: 0.1.0
+ repository: file://../../xos-services/kubernetes
diff --git a/xos-profiles/rcord-lite/values.yaml b/xos-profiles/rcord-lite/values.yaml
index e3090f8..d465cd9 100644
--- a/xos-profiles/rcord-lite/values.yaml
+++ b/xos-profiles/rcord-lite/values.yaml
@@ -185,6 +185,7 @@
description: Set up VOLT, AddressManager, and RCORD services
imports:
- custom_types/image.yaml
+ - custom_types/kubernetesservice.yaml
- custom_types/network.yaml
- custom_types/networkslice.yaml
- custom_types/networktemplate.yaml
@@ -222,6 +223,10 @@
- provider_service:
node: service#volt
relationship: tosca.relationships.BelongsToOne
+ service#kubernetes:
+ type: tosca.nodes.KubernetesService
+ properties:
+ name: kubernetes
service#volt:
type: tosca.nodes.VOLTService
properties:
diff --git a/xos-services/kubernetes/Chart.yaml b/xos-services/kubernetes/Chart.yaml
new file mode 100644
index 0000000..7776549
--- /dev/null
+++ b/xos-services/kubernetes/Chart.yaml
@@ -0,0 +1,21 @@
+---
+
+# Copyright 2018-present Open Networking Foundation
+#
+# 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.
+
+apiVersion: v1
+appVersion: "1.0"
+description: A Helm chart for XOS's "kubernetes" service
+name: kubernetes
+version: 0.1.0
diff --git a/xos-services/kubernetes/templates/_helpers.tpl b/xos-services/kubernetes/templates/_helpers.tpl
new file mode 100644
index 0000000..e4664e1
--- /dev/null
+++ b/xos-services/kubernetes/templates/_helpers.tpl
@@ -0,0 +1,80 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Copyright 2018-present Open Networking Foundation
+
+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.
+*/}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "kubernetes.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "kubernetes.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "kubernetes.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "kubernetes.serviceConfig" -}}
+name: kubernetes
+accessor:
+ username: {{ .Values.xosAdminUser | quote }}
+ password: {{ .Values.xosAdminPassword | quote }}
+ endpoint: xos-core:50051
+required_models:
+ - KubernetesService
+ - KubernetesServiceInstance
+dependency_graph: "/opt/xos/synchronizers/kubernetes/model-deps"
+steps_dir: "/opt/xos/synchronizers/kubernetes/steps"
+# model_policies_dir: "/opt/xos/synchronizers/kubernetes/model_policies"
+sys_dir: "/opt/xos/synchronizers/kubernetes/sys"
+models_dir: "/opt/xos/synchronizers/kubernetes/models"
+pull_steps_dir: "/opt/xos/synchronizers/kubernetes/pull_steps"
+logging:
+ version: 1
+ handlers:
+ console:
+ class: logging.StreamHandler
+ file:
+ class: logging.handlers.RotatingFileHandler
+ filename: /var/log/xos.log
+ maxBytes: 10485760
+ backupCount: 5
+ loggers:
+ 'multistructlog':
+ handlers:
+ - console
+ - file
+ level: DEBUG
+{{- end -}}
diff --git a/xos-services/kubernetes/templates/configmap.yaml b/xos-services/kubernetes/templates/configmap.yaml
new file mode 100644
index 0000000..96bcbf3
--- /dev/null
+++ b/xos-services/kubernetes/templates/configmap.yaml
@@ -0,0 +1,23 @@
+---
+
+# Copyright 2018-present Open Networking Foundation
+#
+# 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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: kubernetes
+data:
+ serviceConfig: |
+{{ include "kubernetes.serviceConfig" . | indent 4 }}
diff --git a/xos-services/kubernetes/templates/deployment.yaml b/xos-services/kubernetes/templates/deployment.yaml
new file mode 100644
index 0000000..575e941
--- /dev/null
+++ b/xos-services/kubernetes/templates/deployment.yaml
@@ -0,0 +1,78 @@
+---
+
+# Copyright 2018-present Open Networking Foundation
+#
+# 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.
+
+apiVersion: apps/v1beta2
+kind: Deployment
+metadata:
+ name: {{ template "kubernetes.fullname" . }}
+ labels:
+ app: {{ template "kubernetes.name" . }}
+ chart: {{ template "kubernetes.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ app: {{ template "kubernetes.name" . }}
+ release: {{ .Release.Name }}
+ template:
+ metadata:
+ labels:
+ app: {{ template "kubernetes.name" . }}
+ release: {{ .Release.Name }}
+ annotations:
+ checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
+ spec:
+ serviceAccountName: kubernetes-synchronizer
+ containers:
+ - name: {{ .Chart.Name }}
+ image: {{ .Values.kubernetes_synchronizerImage | quote }}
+ imagePullPolicy: {{ .Values.imagePullPolicy }}
+ resources:
+{{ toYaml .Values.resources | indent 12 }}
+ volumeMounts:
+ - name: kubernetes-config
+ mountPath: /opt/xos/synchronizers/kubernetes/kubernetes_config.yaml
+ subPath: kubernetes_config.yaml
+ - name: certchain-volume
+ mountPath: /usr/local/share/ca-certificates/local_certs.crt
+ subPath: config/ca_cert_chain.pem
+ volumes:
+ - name: kubernetes-config
+ configMap:
+ name: kubernetes
+ items:
+ - key: serviceConfig
+ path: kubernetes_config.yaml
+ - name: certchain-volume
+ configMap:
+ name: ca-certificates
+ items:
+ - key: chain
+ path: config/ca_cert_chain.pem
+ {{- with .Values.nodeSelector }}
+ nodeSelector:
+{{ toYaml . | indent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+ affinity:
+{{ toYaml . | indent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+ tolerations:
+{{ toYaml . | indent 8 }}
+ {{- end }}
diff --git a/xos-services/kubernetes/values.yaml b/xos-services/kubernetes/values.yaml
new file mode 100644
index 0000000..fe417d6
--- /dev/null
+++ b/xos-services/kubernetes/values.yaml
@@ -0,0 +1,38 @@
+---
+# Copyright 2018-present Open Networking Foundation
+#
+# 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.
+
+# Default values for kubernetes synchronizer.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+nameOverride: ""
+fullnameOverride: ""
+
+imagePullPolicy: 'IfNotPresent'
+
+kubernetes_synchronizerImage: "xosproject/kubernetes-synchronizer:master"
+
+xosAdminUser: "admin@opencord.org"
+xosAdminPassword: "letmein"
+
+resources: {}
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}