summaryrefslogtreecommitdiffstats
path: root/TOSCA/kubernetes-cluster-TOSCA/imports
diff options
context:
space:
mode:
Diffstat (limited to 'TOSCA/kubernetes-cluster-TOSCA/imports')
-rw-r--r--TOSCA/kubernetes-cluster-TOSCA/imports/cloud-config.yaml76
-rw-r--r--TOSCA/kubernetes-cluster-TOSCA/imports/kubernetes.yaml216
2 files changed, 292 insertions, 0 deletions
diff --git a/TOSCA/kubernetes-cluster-TOSCA/imports/cloud-config.yaml b/TOSCA/kubernetes-cluster-TOSCA/imports/cloud-config.yaml
new file mode 100644
index 0000000000..137681631e
--- /dev/null
+++ b/TOSCA/kubernetes-cluster-TOSCA/imports/cloud-config.yaml
@@ -0,0 +1,76 @@
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T
+#
+# 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.
+#============LICENSE_END============================================
+
+# this is the cloud init. It will install the reqiured packages and do some basic config on every VM.
+
+node_templates:
+
+ cloudify_host_cloud_config:
+ type: cloudify.nodes.CloudInit.CloudConfig
+ properties:
+ resource_config:
+ groups:
+ - docker
+ users:
+ - name: { get_input: agent_user }
+ primary-group: wheel
+ groups: docker
+ shell: /bin/bash
+ sudo: ['ALL=(ALL) NOPASSWD:ALL']
+ ssh-authorized-keys:
+ - { get_secret: agent_key_public }
+ write_files:
+ - path: /etc/yum.repos.d/kubernetes.repo
+ owner: root:root
+ permissions: '0444'
+ content: |
+ # installed by cloud-init
+ [kubernetes]
+ name=Kubernetes
+ baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
+ enabled=1
+ gpgcheck=1
+ repo_gpgcheck=1
+ gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
+ https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
+
+ - path: /etc/sysctl.d/k8s.conf
+ owner: root:root
+ permissions: '0444'
+ content: |
+ # installed by cloud-init
+ net.bridge.bridge-nf-call-ip6tables = 1
+ net.bridge.bridge-nf-call-iptables = 1
+
+ packages:
+ - [docker, 1.12.6]
+ - [kubelet, 1.8.6-0]
+ - [kubeadm, 1.8.6-0]
+ - [kubectl, 1.8.6-0]
+ - [kubernetes-cni, 0.5.1-1]
+ - [nfs-utils]
+ runcmd:
+ - [ setenforce, 0 ]
+ - [ sysctl , '--system' ]
+ - [ systemctl, enable, docker ]
+ - [ systemctl, start, docker ]
+ - [ systemctl, enable, kubelet ]
+ - [ systemctl, start, kubelet ]
+ - [ mkdir, '-p', /tmp/data ]
+ - [ chcon, '-Rt', svirt_sandbox_file_t, /tmp/data ]
+ - [ mkdir, '-p', /dockerdata-nfs ]
+ - [ chmod, 777, /dockerdata-nfs ] \ No newline at end of file
diff --git a/TOSCA/kubernetes-cluster-TOSCA/imports/kubernetes.yaml b/TOSCA/kubernetes-cluster-TOSCA/imports/kubernetes.yaml
new file mode 100644
index 0000000000..4467fc475d
--- /dev/null
+++ b/TOSCA/kubernetes-cluster-TOSCA/imports/kubernetes.yaml
@@ -0,0 +1,216 @@
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T
+#
+# 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.
+#============LICENSE_END============================================
+
+inputs:
+
+ labels:
+ default: {}
+
+node_types:
+
+ cloudify.nodes.Kubernetes:
+ derived_from: cloudify.nodes.Root
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ create:
+ implementation: scripts/create.py
+
+ cloudify.nodes.Kubernetes.Master:
+ derived_from: cloudify.nodes.Root
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ create:
+ implementation: scripts/create.py
+ configure:
+ implementation: scripts/kubernetes_master/configure.py
+ start:
+ implementation: scripts/kubernetes_master/start.py
+
+ cloudify.nodes.Kubernetes.Node:
+ derived_from: cloudify.nodes.Root
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ create:
+ implementation: scripts/create.py
+ configure:
+ implementation: scripts/kubernetes_node/configure.py
+ start:
+ implementation: fabric.fabric_plugin.tasks.run_task
+ inputs:
+ tasks_file:
+ default: scripts/tasks.py
+ task_name:
+ default: label_node
+ task_properties:
+ default:
+ hostname: { get_attribute: [ SELF, hostname ] }
+ labels: { get_input: labels }
+ fabric_env:
+ default:
+ host_string: { get_attribute: [ kubernetes_master_host, ip ] }
+ user: { get_input: agent_user }
+ key: { get_secret: agent_key_private }
+ stop:
+ implementation: fabric.fabric_plugin.tasks.run_task
+ inputs:
+ tasks_file:
+ default: scripts/tasks.py
+ task_name:
+ default: stop_node
+ task_properties:
+ default:
+ hostname: { get_attribute: [ SELF, hostname ] }
+ fabric_env:
+ default:
+ host_string: { get_attribute: [ kubernetes_master_host, ip ] }
+ user: { get_input: agent_user }
+ key: { get_secret: agent_key_private }
+ delete:
+ implementation: fabric.fabric_plugin.tasks.run_task
+ inputs:
+ tasks_file:
+ default: scripts/tasks.py
+ task_name:
+ default: delete_node
+ task_properties:
+ default:
+ hostname: { get_attribute: [ SELF, hostname ] }
+ fabric_env:
+ default:
+ host_string: { get_attribute: [ kubernetes_master_host, ip ] }
+ user: { get_input: agent_user }
+ key: { get_secret: agent_key_private }
+
+node_templates:
+
+ kubernetes_master:
+ type: cloudify.nodes.Kubernetes.Master
+ relationships:
+ - type: cloudify.relationships.contained_in
+ target: kubernetes_master_host
+
+ kubernetes_node:
+ type: cloudify.nodes.Kubernetes.Node
+ relationships:
+ - type: cloudify.relationships.contained_in
+ target: kubernetes_node_host
+ - type: cloudify.relationships.depends_on
+ target: kubernetes_master
+
+outputs:
+
+ kubernetes_cluster_bootstrap_token:
+ value: { get_attribute: [ kubernetes_master, bootstrap_token ] }
+
+ kubernetes_cluster_master_ip:
+ value: { get_attribute: [ kubernetes_master, master_ip ] }
+
+ kubernetes-admin_client_certificate_data:
+ value: { get_attribute: [ kubernetes_master, kubernetes-admin_client_certificate_data ] }
+
+ kubernetes-admin_client_key_data:
+ value: { get_attribute: [ kubernetes_master, kubernetes-admin_client_key_data ] }
+
+ kubernetes_certificate_authority_data:
+ value: { get_attribute: [ kubernetes_master, kubernetes_certificate_authority_data ] }
+
+policy_types:
+ scale_policy_type:
+ source: policies/scale.clj
+ properties:
+ policy_operates_on_group:
+ default: true
+ service_selector:
+ description: regular expression that selects the metric to be measured
+ default: ".*"
+ moving_window_size:
+ description: the moving window for individual sources in secs
+ default: 10
+ scale_threshold:
+ description: the value to trigger scaling over aggregrated moving values
+ scale_limit:
+ description: scaling limit
+ default: 10
+ scale_direction:
+ description: scale up ('<') or scale down ('>')
+ default: '<'
+ cooldown_time:
+ description: the time to wait before evaluating again after a scale
+ default: 60
+
+groups: {}
+
+# scale_up_group:
+# members: [kubernetes_node_host]
+# policies:
+# auto_scale_up:
+# type: scale_policy_type
+# properties:
+# policy_operates_on_group: true
+# scale_limit: 6
+# scale_direction: '<'
+# scale_threshold: 30
+# service_selector: .*kubernetes_node_host.*cpu.total.user
+# cooldown_time: 60
+# triggers:
+# execute_scale_workflow:
+# type: cloudify.policies.triggers.execute_workflow
+# parameters:
+# workflow: scale
+# workflow_parameters:
+# delta: 1
+# scalable_entity_name: kubernetes_node_host
+
+# scale_down_group:
+# members: [kubernetes_node_host]
+# policies:
+# auto_scale_down:
+# type: scale_policy_type
+# properties:
+# policy_operates_on_group: true
+# scale_limit: 6
+# scale_direction: '<'
+# scale_threshold: 30
+# service_selector: .*kubernetes_node_host.*cpu.total.user
+# cooldown_time: 60
+# triggers:
+# execute_scale_workflow:
+# type: cloudify.policies.triggers.execute_workflow
+# parameters:
+# workflow: scale
+# workflow_parameters:
+# delta: 1
+# scalable_entity_name: kubernetes_node_host
+
+# heal_group:
+# members: [kubernetes_node_host]
+# policies:
+# simple_autoheal_policy:
+# type: cloudify.policies.types.host_failure
+# properties:
+# service:
+# - .*kubernetes_node_host.*.cpu.total.system
+# - .*kubernetes_node_host.*.process.hyperkube.cpu.percent
+# interval_between_workflows: 60
+# triggers:
+# auto_heal_trigger:
+# type: cloudify.policies.triggers.execute_workflow
+# parameters:
+# workflow: heal
+# workflow_parameters:
+# node_instance_id: { 'get_property': [ SELF, node_id ] }
+# diagnose_value: { 'get_property': [ SELF, diagnose ] }