Skip to content

Commit

Permalink
reworked bmc blueprint to fix bug in kubernetes docker-multinode scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dfilppi committed Apr 19, 2017
1 parent 454aba4 commit e06553a
Show file tree
Hide file tree
Showing 3 changed files with 270 additions and 107 deletions.
224 changes: 117 additions & 107 deletions bmc-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ imports:
- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- http://www.getcloudify.org/spec/fabric-plugin/1.3.1/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.3/plugin.yaml
- https://github.com/cloudify-incubator/cloudify-oraclebmc-plugin/archive/0.1.zip
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-oraclebmc-plugin/master/plugin.yaml
- types/scale.yaml

dsl_definitions:
bmc_config: &bmc_config
user:
fingerprint:
key_file: ~/.ssh/bmcs_api_key
key_file:
tenancy:
region: us-phoenix-1
region:

hyperkube_monitoring: &hyperkube_monitoring
collectors_config:
Expand All @@ -23,6 +23,7 @@ dsl_definitions:
DiskUsageCollector:
config:
devices: sd[a-z]+[0-9]*$
NetworkCollector: {}
ProcessResourcesCollector:
config:
enabled: true
Expand All @@ -46,7 +47,6 @@ inputs:
description: image (must be Oracle Linux)
master_shape:
description: flavor
default: BM.Standard1.36
worker_image:
description: image
worker_shape:
Expand All @@ -69,22 +69,25 @@ node_templates:
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: fabric.fabric_plugin.tasks.run_commands
implementation: fabric.fabric_plugin.tasks.run_task
inputs:
fabric_env:
host_string: { get_attribute: [ master_host, public_ip ] }
user: { get_input: ssh_user }
key_filename: { get_input: ssh_keyfile }
commands:
- "curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
- "chmod +x kubectl"
- "sudo setenforce 0"
- "sudo systemctl disable firewalld"
- "sudo systemctl stop firewalld"
- "sudo yum install -y git"
- "rm -rf kube-deploy"
- "git clone https://github.com/kubernetes/kube-deploy"
- "cd kube-deploy/docker-multinode;sudo ./master.sh"
tasks_file: scripts/fabric_tasks.py
task_name: start_master
task_properties:
k8s_settings:
k8s_version: v1.3.0
etcd_version: 2.2.5
flannel_version: v0.6.2
flannel_ipmasq: 'true'
flannel_network: 10.1.0.0/16
flannel_backend: udp
restart_policy: unless-stopped
arch: amd64
net_interface: eth0
relationships:
- type: cloudify.relationships.contained_in
target: master_host
Expand All @@ -94,17 +97,26 @@ node_templates:
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: fabric.fabric_plugin.tasks.run_commands
implementation: fabric.fabric_plugin.tasks.run_task
inputs:
fabric_env:
host_string: { get_attribute: [ worker_host, public_ip ] }
user: { get_input: ssh_user }
key_filename: { get_input: ssh_keyfile }
commands:
- "sudo yum install -y git"
- "rm -rf kube-deploy"
- "git clone https://github.com/kubernetes/kube-deploy"
- { concat: [ "cd kube-deploy/docker-multinode;sudo MASTER_IP=", { get_attribute: [ master_host, private_ip ] }," ./worker.sh" ] }
tasks_file: scripts/fabric_tasks.py
task_name: start_worker
task_properties:
master_ip: { get_attribute: [ master_host, ip ] }
k8s_settings:
k8s_version: v1.3.0
etcd_version: 2.2.5
flannel_version: v0.6.2
flannel_ipmasq: 'true'
flannel_network: 10.1.0.0/16
flannel_backend: udp
restart_policy: unless-stopped
arch: amd64
net_interface: eth0
relationships:
- type: cloudify.relationships.depends_on
target: master
Expand All @@ -119,10 +131,10 @@ node_templates:
bmc_config: *bmc_config
ssh_keyfile: { get_input: master_key}
name: master
public_key_file: ~/.ssh/dfilppi-dc.key.pub
public_key_file:
image_id: { get_input: master_image }
instance_shape: { get_input: master_shape }
compartment_id: ''
compartment_id:
availability_domain: { get_input: availability_domain }
relationships:
- type: cloudify.oraclebmc.relationships.instance_connected_to_subnet
Expand All @@ -136,10 +148,10 @@ node_templates:
bmc_config: *bmc_config
ssh_keyfile: { get_input: worker_key}
name: worker
public_key_file: ~/.ssh/dfilppi-dc.key.pub
public_key_file:
image_id: { get_input: worker_image }
instance_shape: { get_input: worker_shape }
compartment_id: ''
compartment_id:
availability_domain: { get_input: availability_domain }
relationships:
- type: cloudify.oraclebmc.relationships.instance_connected_to_subnet
Expand All @@ -165,16 +177,16 @@ node_templates:
properties:
bmc_config: *bmc_config
use_external_resource: true
resource_id: ''
resource_id:

subnet:
type: cloudify.oraclebmc.nodes.Subnet
properties:
bmc_config: *bmc_config
name: kubernetes_subnet
compartment_id: ''
compartment_id:
cidr_block: 10.10.20.0/24
availability_domain: vNkz:PHX-AD-2
availability_domain:
security_rules:
- "0.0.0.0/0,22"
- "0.0.0.0/0,53"
Expand All @@ -194,93 +206,91 @@ node_templates:
gateway:
type: cloudify.oraclebmc.nodes.Gateway
properties:
resource_id: ''
resource_id:
use_external_resource: true
bmc_config: *bmc_config
relationships:
- type: cloudify.oraclebmc.relationships.gateway_connected_to_network
target: network


groups:

scale_up_group:
members: [worker_host]
# This defines a scale group whose members may be scaled up, incrementing by 1.

scale_up_group:
members: [worker_host]
# This defines a scale group whose members may be scaled up, incrementing by 1.
# The scale worflow is called when the following criteria are met
# The Hyperkube process total CPU will be more than 3 for a total of 10 seconds.
# No more than 6 hosts will be allowed.
policies:
auto_scale_up:
type: scale_policy_type
properties:
policy_operates_on_group: true
scale_limit: 6
scale_direction: '<'
scale_threshold: 30
service_selector: .*worker_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: worker
scale_compute: true

scale_down_group:
# This defines a scale group whose members may be scaled down. Only one host will be removed per run.
# The scale worflow is called when the following criteria are met
# The Hyperkube process total CPU will be more than 3 for a total of 10 seconds.
# No more than 6 hosts will be allowed.
policies:
auto_scale_up:
type: scale_policy_type
properties:
policy_operates_on_group: true
scale_limit: 6
scale_direction: '<'
scale_threshold: 30
#service_selector: .*worker_host.*.cpu.total.user
service_selector: .*worker_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: worker
scale_compute: true

scale_down_group:
# This defines a scale group whose members may be scaled down. Only one host will be removed per run.
# The scale worflow is called when the following criteria are met
# The Hyperkube process total CPU will be less than 1 for a total of 200 seconds.
# No less than 2 hosts will be allowed.
members: [worker_host]
policies:
auto_scale_down:
type: scale_policy_type
properties:
scale_limit: 2
scale_direction: '>'
scale_threshold: 25
#service_selector: .*worker_host.*.process.hyperkube.cpu.percent
service_selector: .*worker_host.*cpu.total.user
cooldown_time: 60
moving_window_size: 30
triggers:
execute_scale_workflow:
type: cloudify.policies.triggers.execute_workflow
parameters:
workflow: scale
workflow_parameters:
delta: -1
scalable_entity_name: worker
scale_compute: true

heal_group:
# This defines a group of hosts in members that may be healed.
# The heal workflow is called when a the following policy criteria are met.
# Either the hyperkube process on the host, or the total host CPU need fall silent.
# The host and all software that it is supposed to have running on it will be healed.
members: [worker_host]
policies:
simple_autoheal_policy:
type: cloudify.policies.types.host_failure
properties:
service:
- .*worker_host.*.cpu.total.system
- .*worker_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 ] }

# The Hyperkube process total CPU will be less than 1 for a total of 200 seconds.
# No less than 2 hosts will be allowed.
members: [worker_host]
policies:
auto_scale_down:
type: scale_policy_type
properties:
scale_limit: 2
scale_direction: '>'
scale_threshold: 25
#service_selector: .*worker_host.*.process.hyperkube.cpu.percent
service_selector: .*worker_host.*cpu.total.user
cooldown_time: 60
moving_window_size: 30
triggers:
execute_scale_workflow:
type: cloudify.policies.triggers.execute_workflow
parameters:
workflow: scale
workflow_parameters:
delta: -1
scalable_entity_name: worker
scale_compute: true

heal_group:
# This defines a group of hosts in members that may be healed.
# The heal workflow is called when a the following policy criteria are met.
# Either the hyperkube process on the host, or the total host CPU need fall silent.
# The host and all software that it is supposed to have running on it will be healed.
members: [worker_host]
policies:
simple_autoheal_policy:
type: cloudify.policies.types.host_failure
properties:
service:
- .*worker_host.*.cpu.total.system
- .*worker_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 ] }

outputs:
kubernetes_info:
description: Kubernetes Dashboard URL
Expand Down
Binary file added resources/kube-deploy.tgz
Binary file not shown.
Loading

0 comments on commit e06553a

Please sign in to comment.