Skip to content

Commit

Permalink
Merge pull request #6 from cloudify-examples/update-plugins
Browse files Browse the repository at this point in the history
Update plugins
  • Loading branch information
EarthmanT authored Jul 28, 2017
2 parents 44fe4e3 + 6211447 commit 23948e4
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 161 deletions.
26 changes: 18 additions & 8 deletions aws-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ description: >
It is based on this documentation: https://kubernetes.io/docs/getting-started-guides/kubeadm/
imports:
- http://www.getcloudify.org/spec/cloudify/4.0.1/types.yaml
- http://getcloudify.org.s3.amazonaws.com/spec/aws-plugin/1.4.9/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.5/plugin.yaml
- types/scale.yaml
- types/cloud_config/cloud-config.yaml
- types/kubernetes.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-aws-plugin/1.4.13/plugin.yaml
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-diamond-plugin/1.3.5/plugin.yaml
- imports/kubernetes.yaml
- imports/cloud-config.yaml

Expand Down Expand Up @@ -168,12 +166,24 @@ node_templates:
to_port: 4001
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 4789
to_port: 4789
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 6443
to_port: 6443
cidr_ip: 0.0.0.0/0
- ip_protocol: udp
from_port: 6443
to_port: 6443
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 8000
to_port: 8000
from_port: 6783
to_port: 6784
cidr_ip: 0.0.0.0/0
- ip_protocol: udp
from_port: 6783
to_port: 6784
cidr_ip: 0.0.0.0/0
- ip_protocol: tcp
from_port: 8080
Expand Down
61 changes: 56 additions & 5 deletions azure-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ description: >
# Several lines are commented. Currently there is not a Centos 7 image that supports Cloud Init. When there is, we will replace the current docker/kubernetes installation method with the commented lines.

imports:
- http://www.getcloudify.org/spec/cloudify/4.0.1/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-azure-plugin/1.4.3/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.5/plugin.yaml
- types/scale.yaml
# - types/cloud_config/cloud-config.yaml
- types/kubernetes.yaml
- imports/kubernetes.yaml
# - imports/cloud-config.yaml

inputs:

Expand Down Expand Up @@ -334,6 +330,17 @@ node_templates:
priority: 108
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},4789tcp]}
properties:
description: 4789 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 4789
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1080
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6443tcp]}
properties:
description: 6443 TCP access
Expand All @@ -345,6 +352,50 @@ node_templates:
priority: 109
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6783tcp]}
properties:
description: 6783 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 6783
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1090
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6784tcp]}
properties:
description: 6784 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 6784
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1091
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6783udp]}
properties:
description: 6783 UDP access
protocol: Udp
sourcePortRange: '*'
destinationPortRange: 6783
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1092
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6784udp]}
properties:
description: 6784 UDP access
protocol: Udp
sourcePortRange: '*'
destinationPortRange: 6784
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1093
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},8000tcp]}
properties:
description: 8000 TCP access
Expand Down
78 changes: 36 additions & 42 deletions imports/cloud-config.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,41 @@
node_templates:

cloudify_host_cloud_config:
type: cloudify.nodes.CloudConfig
type: cloudify.nodes.CloudInit.CloudConfig
properties:
resource_config:
encode_base64: { get_input: encode_cloud_config }
interfaces:
cloudify.interfaces.lifecycle:
create:
inputs:
cloud_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
packages:
- [docker, 1.12.6-28.git1398f24.el7.centos]
- [kubelet, 1.6.4-0]
- [kubeadm, 1.6.4-0]
- [kubectl, 1.6.4-0]
- [kubernetes-cni, 0.5.1-0]
runcmd:
- [ systemctl, enable, docker ]
- [ systemctl, start, docker ]
- [ systemctl, enable, kubelet ]
- [ systemctl, start, kubelet ]
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
packages:
- [docker, 1.12.6-28.git1398f24.el7.centos]
- [kubelet, 1.6.4-0]
- [kubeadm, 1.6.4-0]
- [kubectl, 1.6.4-0]
- [kubernetes-cni, 0.5.1-0]
runcmd:
- [ systemctl, enable, docker ]
- [ systemctl, start, docker ]
- [ systemctl, enable, kubelet ]
- [ systemctl, start, kubelet ]
59 changes: 59 additions & 0 deletions imports/kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
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/configure_master.py
start:
implementation: scripts/start_master.py

cloudify.nodes.Kubernetes.Node:
derived_from: cloudify.nodes.Root
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: scripts/create.py
configure:
implementation: scripts/configure_node.py

node_templates:

kubernetes_master:
Expand All @@ -14,6 +43,36 @@ node_templates:
- type: cloudify.relationships.depends_on
target: kubernetes_master

outputs:

kubernetes_master_configuration:
value: { get_attribute: [ kubernetes_master, configuration_file_content ] }


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:
Expand Down
19 changes: 8 additions & 11 deletions openstack-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,29 @@ description: >
It is based on this documentation: https://kubernetes.io/docs/getting-started-guides/kubeadm/
imports:
- http://www.getcloudify.org/spec/cloudify/4.0.1/types.yaml
- http://www.getcloudify.org/spec/openstack-plugin/2.0.1/plugin.yaml
- http://www.getcloudify.org/spec/fabric-plugin/1.3.1/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.5/plugin.yaml
- types/scale.yaml
- types/cloud_config/cloud-config.yaml
- types/kubernetes.yaml
- imports/kubernetes.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-openstack-plugin/2.2.0/plugin.yaml
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-fabric-plugin/1.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-diamond-plugin/1.3.5/plugin.yaml
- imports/cloud-config.yaml
- imports/kubernetes.yaml

inputs:

image:
description: Image to be used when launching agent VMs
default: { get_secret: centos_core_image }

flavor:
description: Flavor of the agent VMs
default: { get_secret: large_image_flavor }

agent_user:
description: >
User for connecting to agent VMs
default: centos

encode_cloud_config:
default: false

dsl_definitions:

openstack_config: &openstack_config
Expand Down
28 changes: 0 additions & 28 deletions scripts/cloud_config/create.py

This file was deleted.

6 changes: 5 additions & 1 deletion scripts/configure_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import getpass
import subprocess
from cloudify import ctx
from cloudify.exceptions import OperationRetry


def execute_command(_command):
Expand Down Expand Up @@ -39,6 +40,9 @@ def execute_command(_command):

# Start the Kube Master
start_output = execute_command('sudo kubeadm init --skip-preflight-checks')
if isinstance(start_output, bool):
execute_command('sudo kubeadm reset')
raise OperationRetry('Restarting kubernetes because of a problem.')
for line in start_output.split('\n'):
if 'kubeadm join' in line:
ctx.instance.runtime_properties['join_command'] = line.lstrip()
Expand All @@ -62,4 +66,4 @@ def execute_command(_command):
execute_command('sudo chmod a+x /usr/local/bin/weave')
execute_command('sudo curl -L git.io/scope -o /usr/local/bin/scope')
execute_command('sudo chmod a+x /usr/local/bin/scope')
execute_command('scope launch')
execute_command('/usr/local/bin/scope launch')
2 changes: 1 addition & 1 deletion scripts/configure_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def execute_command(_command):
execute_command('sudo chmod a+x /usr/local/bin/weave')
execute_command('sudo curl -L git.io/scope -o /usr/local/bin/scope')
execute_command('sudo chmod a+x /usr/local/bin/scope')
execute_command('scope launch')
execute_command('/usr/local/bin/scope launch')
13 changes: 0 additions & 13 deletions types/cloud_config/cloud-config.yaml

This file was deleted.

Empty file removed types/docker.yaml
Empty file.
Loading

0 comments on commit 23948e4

Please sign in to comment.