CORD-3162 Create demo-exampleservice profile
Change-Id: I1720360013c3dc916add7b4d8a5dc7962cbdf037
diff --git a/xos-services/exampleservice/files/id_rsa b/xos-services/exampleservice/files/id_rsa
new file mode 100644
index 0000000..c840002
--- /dev/null
+++ b/xos-services/exampleservice/files/id_rsa
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpgIBAAKCAQEAy+S+bw7ENW5knorMTH/xmRKr/OaBx7ukRRNe1WKEwLgQbB0J
+xEznHG0E/OakgcuTQDACArTndeYl2H5rpdHhXkh6EK9R9yAF09In+gDcVzpvP2dq
+5UTbYThILIw0FPX6DcUOMJLMoMuXqSpmxITKmxWY7o+M2H0rT8xP4JBUhPUI4SjF
+miZsixX6vX/A5wvk0xONSuYhm7a2pq+6h0lrCisu+V1ejGWSyxRMa0KpWA5SwNld
+GmHswqpd3wfeiiZn+hiUU9492O6Fmo+4BMzAsnANkID/GTRS/9kNaoL0EXOiOOvx
+1IjodyE/C1Q3aNmVJ/aqzWpnkNc0e2vsAb2CFQIDAQABAoIBAQDGRZByCtf+ZXVv
+PuXgVmKoSiH5cmYtxmi9y1JjCsSxa8x8ddhzjZ0IZXN+QwMiPMbamlS6MRUL71xK
+JNWlkG0p9CzPYM3CFN/V1f2N/ZxHLsnTzEuE2+rBpat5tnVHFNOu5DsiPP7ENncq
+x9Lbs44aNWxcQDfkpgOiO7pJU9D84FYuJbH6EhHCt1nuyUeHaG7qqsDYnaGo6NSc
+qqnmrvoSBOQ+CIXgqRwGuetN9kNF/nKOWxWiZ+VAYIXb7cnkmOWTg5ojPifCWMeE
+xiV9agFzEEJhPxhivFtIq0XvsiSlAZvZcREXKayw6zFx9JTgpOXYln+xg0pQEVXr
+MLWv7BTZAoGBAPLy1Z7qjeR9PwTZen970AS3BsATQAcAh4aEHGPxwLmWDkhzJTW7
+C2U4dSyjB1W6OL6y4u7aggO5nshsEUZ73hE37b1/sr1PYC+NXuXuThDYDFD3f5LA
+HwU0Xvx+uibV75+XpOkClSBkf2k6eBFD68PaLyjfCSnEkzukWPtngxRTAoGBANbY
+zXFKIrcQtAz2p3+txU9Xqa5xK2rQfLurc66xxxC3KO8oMhYP2htieYRygwg91JR2
+Bu6sX8+t5MNYSso1t8CSO36tcgUDowo+2XuvY9FwQUgViHNKOb7cFrNSgWMVhbng
+/ZgxKrnVl1NPBivDV5kPg+jD1BIOUlQimyrD6sL3AoGBAOnnRCZpWs1GjHrly5ub
+n846TMR2hCl5qAGphg/vfIbxYrT8LzII8FK2xZGBMJmn3eQ0JGqkc5KUjrwV15gN
+v+LB/yF4JaVAG7IMoPYstnpfF5SIhQnL8NG4906P0Dd9t+PmQz6XXu4987FjOqAc
+zYvVr5vhCFhvSvWcKJN7uGbDAoGBAKvJequlLZDXCEB9UHzkwymn3IMg9ihYQAQH
+GV6Lw7H34gEoULQXRLw0xxlCPsduOPXkUbKxnYJ/drVDebmprh2KT4wAv3SG7eyZ
+SGh/Wv7yFSDAJvSYWwfjDzufMtm5Mc3oupzgY1toD7GLNFH1xasbHswVGRK+5NFl
+QlC1ipcNAoGBAIxqGyCai6btwDlbpkdI+ck2j7k9ndZ8sosc0G2se9d58sfsHdWe
+1wpqe62t7mQZr+IgEyq7RuuEtRR6Xqb8RQqAuEdSms1zcWc30SJJhPiwxIeLL0dx
+ly/HBBqnozD4BN3ENiqnIhOgeZE7XHaS43luYkYpBOuBaWYs5IIZWcct
+-----END RSA PRIVATE KEY-----
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
diff --git a/xos-services/exampleservice/values.yaml b/xos-services/exampleservice/values.yaml
index 80389ba..a10289d 100644
--- a/xos-services/exampleservice/values.yaml
+++ b/xos-services/exampleservice/values.yaml
@@ -29,6 +29,8 @@
xosAdminUser: "admin@opencord.org"
xosAdminPassword: "letmein"
+cordSiteName: "mysite"
+
resources: {}
nodeSelector: {}
@@ -36,3 +38,11 @@
tolerations: []
affinity: {}
+
+publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL5L5vDsQ1bmSeisxMf/GZEqv85oHHu6RFE17VYoTAuBBsHQnETOccbQT85qSBy5NAMAICtOd15iXYfmul0eFeSHoQr1H3IAXT0if6ANxXOm8/Z2rlRNthOEgsjDQU9foNxQ4wksygy5epKmbEhMqbFZjuj4zYfStPzE/gkFSE9QjhKMWaJmyLFfq9f8DnC+TTE41K5iGbtramr7qHSWsKKy75XV6MZZLLFExrQqlYDlLA2V0aYezCql3fB96KJmf6GJRT3j3Y7oWaj7gEzMCycA2QgP8ZNFL/2Q1qgvQRc6I46/HUiOh3IT8LVDdo2ZUn9qrNameQ1zR7a+wBvYIV Insecure M-CORD keypair"
+privateKeyFile: "files/id_rsa"
+
+# These variables can be overridden by the profile chart
+global:
+ proxySshEnabled: true
+ proxySshUser: "root"