blob: a7d7c496957d0bf33731ae1e7f5dc7539bf987f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
tosca_definitions_version: cloudify_dsl_1_3
#
# Copyright 2017 AT&T Intellectual Property, Inc
#
# 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.
#
# What this is: Cloudify demo blueprint for running nginx under kubernetes.
#
# Based upon
# https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/blob/master/examples/simple-blueprint-defined-resource.yaml
# https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/blob/1.2.0/examples/example-blueprint.yaml
imports:
- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-kubernetes-plugin/1.2.1/plugin.yaml
inputs:
spec_port:
default: 80
container_port:
default: 80
kubernetes_configuration_file_content:
default: kube.config
kubernetes_master_ip:
type: string
default: { get_secret: kubernetes_master_ip }
kubernetes_master_port:
type: string
default: { get_secret: kubernetes_master_port }
kubernetes_certificate_authority_data:
default: { get_secret: kubernetes_certificate_authority_data }
kubernetes-admin_client_certificate_data:
default: { get_secret: kubernetes-admin_client_certificate_data }
kubernetes-admin_client_key_data:
default: { get_secret: kubernetes-admin_client_key_data }
kubernetes_master_configuration:
default:
apiVersion: v1
kind: Config
preferences: {}
current-context: kubernetes-admin@kubernetes
clusters:
- name: kubernetes
cluster:
certificate-authority-data: { get_input: kubernetes_certificate_authority_data }
server: { concat: [ 'https://', { get_input: kubernetes_master_ip}, ':', { get_input: kubernetes_master_port } ] }
contexts:
- name: kubernetes-admin@kubernetes
context:
cluster: kubernetes
user: kubernetes-admin
users:
- name: kubernetes-admin
user:
client-certificate-data: { get_input: kubernetes-admin_client_certificate_data }
client-key-data: { get_input: kubernetes-admin_client_key_data }
kubernetes_configuration_file_content:
description: >
File content of kubernetes master YAML configuration
default: { get_input: kubernetes_master_configuration }
node_templates:
kubernetes_master:
type: cloudify.kubernetes.nodes.Master
properties:
configuration:
file_content: { get_input: kubernetes_configuration_file_content }
nginx_service:
type: cloudify.kubernetes.resources.Service
properties:
definition:
apiVersion: v1
metadata:
name: nginx-service
spec:
type: NodePort
ports:
- port: { get_input: spec_port }
selector:
app: nginx
relationships:
- type: cloudify.kubernetes.relationships.managed_by_master
target: kubernetes_master
- type: cloudify.relationships.depends_on
target: nginx_pod
# Following part based upon http://docs.getcloudify.org/4.1.0/plugins/kubernetes/
nginx_pod:
type: cloudify.kubernetes.resources.Pod
properties:
definition:
apiVersion: v1
metadata:
name: nginx
labels:
app: nginx
spec:
nodeSelector:
role: worker
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: { get_input: container_port }
relationships:
- type: cloudify.kubernetes.relationships.managed_by_master
target: kubernetes_master
|