CORD-3162 Create demo-exampleservice profile
Change-Id: I1720360013c3dc916add7b4d8a5dc7962cbdf037
diff --git a/xos-services/exampleservice/templates/_helpers.tpl b/xos-services/exampleservice/templates/_helpers.tpl
index 56ecf89..5087738 100644
--- a/xos-services/exampleservice/templates/_helpers.tpl
+++ b/xos-services/exampleservice/templates/_helpers.tpl
@@ -31,13 +31,9 @@
{{- .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.
@@ -52,16 +48,6 @@
username: {{ .Values.xosAdminUser | quote }}
password: {{ .Values.xosAdminPassword | quote }}
endpoint: xos-core:50051
-required_models:
- - ExampleService
- - ExampleServiceInstance
- - ServiceDependency
- - ServiceMonitoringAgentInfo
-dependency_graph: "/opt/xos/synchronizers/exampleservice/model-deps"
-steps_dir: "/opt/xos/synchronizers/exampleservice/steps"
-sys_dir: "/opt/xos/synchronizers/exampleservice/sys"
-model_policies_dir: "/opt/xos/synchronizers/exampleservice/model_policies"
-models_dir: "/opt/xos/synchronizers/exampleservice/models"
logging:
version: 1
handlers:
@@ -78,4 +64,7 @@
- console
- file
level: DEBUG
+proxy_ssh:
+ enabled: {{ .Values.global.proxySshEnabled }}
+ user: {{ .Values.global.proxySshUser }}
{{- end -}}
diff --git a/xos-services/exampleservice/templates/_tosca.tpl b/xos-services/exampleservice/templates/_tosca.tpl
new file mode 100644
index 0000000..eeb8e20
--- /dev/null
+++ b/xos-services/exampleservice/templates/_tosca.tpl
@@ -0,0 +1,161 @@
+{{/* 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.
+*/}}
+{{- define "exampleservice.serviceTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+ - custom_types/slice.yaml
+ - custom_types/site.yaml
+ - custom_types/image.yaml
+ - custom_types/flavor.yaml
+ - custom_types/network.yaml
+ - custom_types/networktemplate.yaml
+ - custom_types/networkslice.yaml
+ - custom_types/exampleservice.yaml
+ - custom_types/exampleserviceinstance.yaml
+
+description: configure exampleservice
+
+topology_template:
+ node_templates:
+
+# site, image, fully created in deployment.yaml
+ mysite:
+ type: tosca.nodes.Site
+ properties:
+ must-exist: true
+ name: {{ .cordSiteName }}
+
+ m1.small:
+ type: tosca.nodes.Flavor
+ properties:
+ name: m1.small
+ must-exist: true
+
+ trusty-server-multi-nic:
+ type: tosca.nodes.Image
+ properties:
+ name: "trusty-server-multi-nic"
+ container_format: "BARE"
+ disk_format: "QCOW2"
+ path: "https://github.com/opencord/platform-install/releases/download/vms/trusty-server-cloudimg-amd64-disk1.img.20170201"
+
+# private network template, fully created somewhere else
+ private:
+ type: tosca.nodes.NetworkTemplate
+ properties:
+ must-exist: true
+ name: Private
+
+# management networks, fully created in management-net.yaml
+ management_network:
+ type: tosca.nodes.Network
+ properties:
+ must-exist: true
+ name: management
+
+# public network, fully created somewhere else
+ public_network:
+ type: tosca.nodes.Network
+ properties:
+ must-exist: true
+ name: public
+
+ exampleservice_network:
+ type: tosca.nodes.Network
+ properties:
+ name: exampleservice_network
+ labels: exampleservice_private_network
+ requirements:
+ - template:
+ node: private
+ relationship: tosca.relationships.BelongsToOne
+ - owner:
+ node: exampleservice_slice
+ relationship: tosca.relationships.BelongsToOne
+
+# ExampleService Slices
+ exampleservice_slice:
+ description: Example Service Slice
+ type: tosca.nodes.Slice
+ properties:
+ name: exampleservice
+ default_isolation: vm
+ network: noauto
+ requirements:
+ - site:
+ node: mysite
+ relationship: tosca.relationships.BelongsToOne
+ - service:
+ node: exampleservice
+ relationship: tosca.relationships.BelongsToOne
+ - default_image:
+ node: trusty-server-multi-nic
+ relationship: tosca.relationships.BelongsToOne
+ - default_flavor:
+ node: m1.small
+ relationship: tosca.relationships.BelongsToOne
+
+# ExampleService NetworkSlices
+ exampleservice_slice_management_network:
+ type: tosca.nodes.NetworkSlice
+ requirements:
+ - network:
+ node: management_network
+ relationship: tosca.relationships.BelongsToOne
+ - slice:
+ node: exampleservice_slice
+ relationship: tosca.relationships.BelongsToOne
+
+ exampleservice_slice_public_network:
+ type: tosca.nodes.NetworkSlice
+ requirements:
+ - network:
+ node: public_network
+ relationship: tosca.relationships.BelongsToOne
+ - slice:
+ node: exampleservice_slice
+ relationship: tosca.relationships.BelongsToOne
+
+ exampleservice_slice_exampleservice_network:
+ type: tosca.nodes.NetworkSlice
+ requirements:
+ - network:
+ node: exampleservice_network
+ relationship: tosca.relationships.BelongsToOne
+ - slice:
+ node: exampleservice_slice
+ relationship: tosca.relationships.BelongsToOne
+
+ exampleservice:
+ type: tosca.nodes.ExampleService
+ properties:
+ name: exampleservice
+ public_key: {{ .publicKey | quote }}
+ private_key_fn: /opt/xos/services/exampleservice/keys/id_rsa
+ service_message: hello
+
+ exampletenant1:
+ type: tosca.nodes.ExampleServiceInstance
+ properties:
+ name: exampletenant1
+ tenant_message: world
+ requirements:
+ - owner:
+ node: exampleservice
+ relationship: tosca.relationships.BelongsToOne
+{{- end -}}
diff --git a/xos-services/exampleservice/templates/deployment.yaml b/xos-services/exampleservice/templates/deployment.yaml
index 4509f9b..e8fac2f 100644
--- a/xos-services/exampleservice/templates/deployment.yaml
+++ b/xos-services/exampleservice/templates/deployment.yaml
@@ -42,24 +42,38 @@
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: exampleservice-config
- mountPath: /opt/xos/synchronizers/exampleservice/exampleservice_config.yaml
- subPath: exampleservice_config.yaml
+ mountPath: /opt/xos/synchronizers/exampleservice/mounted_config.yaml
+ subPath: mounted_config.yaml
- name: certchain-volume
mountPath: /usr/local/share/ca-certificates/local_certs.crt
subPath: config/ca_cert_chain.pem
+ - name: exampleservice-keys
+ mountPath: /opt/xos/services/exampleservice/keys
+ readOnly: true
+ - name: node-key
+ mountPath: /opt/cord_profile
+ readOnly: true
volumes:
- name: exampleservice-config
configMap:
name: exampleservice
items:
- key: serviceConfig
- path: exampleservice_config.yaml
+ path: mounted_config.yaml
- name: certchain-volume
configMap:
name: ca-certificates
items:
- key: chain
path: config/ca_cert_chain.pem
+ - name: exampleservice-keys
+ secret:
+ secretName: exampleservice-keys
+ - name: node-key
+ secret:
+ secretName: node-key
+ defaultMode: 256
+ optional: true
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
diff --git a/xos-services/exampleservice/templates/secret.yaml b/xos-services/exampleservice/templates/secret.yaml
new file mode 100644
index 0000000..9ffe719
--- /dev/null
+++ b/xos-services/exampleservice/templates/secret.yaml
@@ -0,0 +1,23 @@
+---
+# 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: Secret
+metadata:
+ name: exampleservice-keys
+ namespace: default
+type: Opaque
+data:
+ id_rsa: {{ .Files.Get .Values.privateKeyFile | b64enc }}
\ No newline at end of file