summaryrefslogtreecommitdiffstats
path: root/tools/cloudify/ves-grafana/blueprint.yaml
blob: 00963b31e79f45557eefa06f453eaa1bf35763e8 (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
tosca_definitions_version: cloudify_dsl_1_3
#
# Copyright 2018 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 blueprint for running a grafana service for OPNFV VES
#  under kubernetes.

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: 3000

  container_port:
    default: 3000

  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 }

  ves_grafana_service:
    type: cloudify.kubernetes.resources.Service
    properties:
      definition:
        apiVersion: v1
        metadata:
          name: ves-grafana-service
        spec:
          type: NodePort
          ports:
          - port: { get_input: spec_port }
          selector:
            app: ves-grafana
    relationships:
      - type: cloudify.kubernetes.relationships.managed_by_master
        target: kubernetes_master
      - type: cloudify.relationships.depends_on
        target: ves_grafana_pod

  ves_grafana_pod:
    type: cloudify.kubernetes.resources.Pod
    properties:
      definition:
        apiVersion: v1
        metadata:
          name: ves-grafana-pod
          labels:
            app: ves-grafana
        spec:
          containers:
          - name: ves-grafana
            image: grafana/grafana
            env:
            ports:
            - containerPort: { get_input: container_port }
    relationships:
      - type: cloudify.kubernetes.relationships.managed_by_master
        target: kubernetes_master