From b711fac37e8d27797117ccd92df00daa2d1710b2 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Tue, 6 Dec 2016 01:08:41 +0000 Subject: [PATCH] Do not use template.substitutions in pod resources --- kubernetes/catalog/kubernetes/pods.bom | 25 +++++++------------ kubernetes/resources/kubernetes/kube-dns.yaml | 14 +++++------ .../kubernetes/kubernetes-dashboard.yaml | 2 +- .../kubernetes/policy-controller.yaml | 4 +-- .../resources/kubernetes/prometheus.yaml | 8 +++--- 5 files changed, 23 insertions(+), 30 deletions(-) diff --git a/kubernetes/catalog/kubernetes/pods.bom b/kubernetes/catalog/kubernetes/pods.bom index c7dd5172..9a35881e 100644 --- a/kubernetes/catalog/kubernetes/pods.bom +++ b/kubernetes/catalog/kubernetes/pods.bom @@ -26,9 +26,6 @@ brooklyn.catalog: - name: kubernetes.pod.name label: "Kubernetes Pod Name" type: string - - name: template.substitutions - label: "Template Substitutions" - type: java.util.Map brooklyn.config: install.unique_label: @@ -134,11 +131,10 @@ brooklyn.catalog: kubernetes.pod.file: "classpath://io.brooklyn.clocker.kubernetes:kubernetes/kube-dns.yaml" kubernetes.pod.namespace: "kube-system" - template.substitutions: - kubernetes_url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") - replicas: $brooklyn:entity("kubernetes-cluster").config("kubernetes.initial.size") - dns_service_ip: $brooklyn:entity("kubernetes-cluster").config("kubernetes.dns.address") - dns_service_domain: $brooklyn:entity("kubernetes-cluster").config("kubernetes.dns.domain") + kubernetes.url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") + dns.replicas: $brooklyn:entity("kubernetes-cluster").config("kubernetes.initial.size") + dns.service.ip: $brooklyn:entity("kubernetes-cluster").config("kubernetes.dns.address") + dns.service.domain: $brooklyn:entity("kubernetes-cluster").config("kubernetes.dns.domain") - id: kubernetes-dashboard-pod name: "Kubernetes Dashboard Pod" @@ -153,8 +149,7 @@ brooklyn.catalog: kubernetes.pod.file: "classpath://io.brooklyn.clocker.kubernetes:kubernetes/kubernetes-dashboard.yaml" kubernetes.pod.namespace: "kube-system" - template.substitutions: - kubernetes_url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") + kubernetes.url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") - id: calico-policy-controller-pod name: "Calico Policy Controller Pod" @@ -169,9 +164,8 @@ brooklyn.catalog: kubernetes.pod.file: "classpath://io.brooklyn.clocker.kubernetes:kubernetes/policy-controller.yaml" kubernetes.pod.namespace: "kube-system" - template.substitutions: - kubernetes_url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") - etcd_endpoints: $brooklyn:entity("etcd-cluster").attributeWhenReady("etcd.urls") + kubernetes.url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") + etcd.endpoints: $brooklyn:entity("etcd-cluster").attributeWhenReady("etcd.urls") - id: prometheus-pod name: "Prometheus Monitoring Pod" @@ -187,13 +181,12 @@ brooklyn.catalog: kubernetes.pod.file: "classpath://io.brooklyn.clocker.kubernetes:kubernetes/prometheus.yaml" kubernetes.pod.namespace: "kube-system" - template.substitutions: - kubernetes_url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") + kubernetes.url: $brooklyn:entity("kubernetes-cluster").attributeWhenReady("kubernetes.url") - id: kubernetes-default-pods name: "Kubernetes Default Pods" description: | - Default set of Kubernetes pods to launch at startup + Default set of Kubernetes pods to launch at startup itemType: entity item: type: empty-software-process diff --git a/kubernetes/resources/kubernetes/kube-dns.yaml b/kubernetes/resources/kubernetes/kube-dns.yaml index 0b98cf2b..06b740f7 100644 --- a/kubernetes/resources/kubernetes/kube-dns.yaml +++ b/kubernetes/resources/kubernetes/kube-dns.yaml @@ -11,7 +11,7 @@ metadata: spec: selector: app: kube-dns - clusterIP: ${config['template.substitutions']['dns_service_ip']} + clusterIP: ${config['dns.service.ip']} ports: - name: dns port: 53 @@ -31,7 +31,7 @@ metadata: version: v20 kubernetes.io/cluster-service: "true" spec: - replicas: ${config['template.substitutions']['replicas']} + replicas: ${config['dns.replicas']} selector: app: kube-dns version: v20 @@ -72,9 +72,9 @@ spec: initialDelaySeconds: 30 timeoutSeconds: 5 args: - - --domain=${config['template.substitutions']['dns_service_domain']}.local. + - --domain=${config['dns.service.domain']}.local. - --dns-port=10053 - - --kube-master-url=${config['template.substitutions']['kubernetes_url']} + - --kube-master-url=${config['kubernetes.url']} ports: - containerPort: 10053 name: dns-local @@ -106,11 +106,11 @@ spec: memory: 50Mi args: - >- - -cmd=nslookup kubernetes.default.svc.${config['template.substitutions']['dns_service_domain']}.local 127.0.0.1 > /dev/null && - nslookup kubernetes.default.svc.${config['template.substitutions']['dns_service_domain']}.local 127.0.0.1:10053 > /dev/null + -cmd=nslookup kubernetes.default.svc.${config['dns.service.domain']}.local 127.0.0.1 > /dev/null && + nslookup kubernetes.default.svc.${config['dns.service.domain']}.local 127.0.0.1:10053 > /dev/null - -port=8080 - -quiet ports: - containerPort: 8080 protocol: TCP - dnsPolicy: Default \ No newline at end of file + dnsPolicy: Default diff --git a/kubernetes/resources/kubernetes/kubernetes-dashboard.yaml b/kubernetes/resources/kubernetes/kubernetes-dashboard.yaml index 1143d3a5..cbc5cb00 100644 --- a/kubernetes/resources/kubernetes/kubernetes-dashboard.yaml +++ b/kubernetes/resources/kubernetes/kubernetes-dashboard.yaml @@ -28,7 +28,7 @@ spec: - containerPort: 9090 protocol: TCP args: - - --apiserver-host=${config['template.substitutions']['kubernetes_url']} + - --apiserver-host=${config['kubernetes.url']} livenessProbe: httpGet: path: / diff --git a/kubernetes/resources/kubernetes/policy-controller.yaml b/kubernetes/resources/kubernetes/policy-controller.yaml index 69992f85..472b2311 100644 --- a/kubernetes/resources/kubernetes/policy-controller.yaml +++ b/kubernetes/resources/kubernetes/policy-controller.yaml @@ -29,9 +29,9 @@ spec: image: calico/kube-policy-controller:v0.3.0 env: - name: ETCD_ENDPOINTS - value: "${config['template.substitutions']['etcd_endpoints']}" + value: "${config['etcd.endpoints']}" - name: K8S_API - value: "${config['template.substitutions']['kubernetes_url']}" + value: "${config['kubernetes.url']}" - name: LEADER_ELECTION value: "true" - name: CONFIGURE_ETC_HOSTS diff --git a/kubernetes/resources/kubernetes/prometheus.yaml b/kubernetes/resources/kubernetes/prometheus.yaml index 7ce5ca59..9da52e36 100644 --- a/kubernetes/resources/kubernetes/prometheus.yaml +++ b/kubernetes/resources/kubernetes/prometheus.yaml @@ -83,7 +83,7 @@ data: - job_name: 'kubernetes-cluster' kubernetes_sd_configs: - api_servers: - - ${config['template.substitutions']['kubernetes_url']} + - ${config['kubernetes.url']} basic_auth: username: prometheus password: pr0m3th3us @@ -91,7 +91,7 @@ data: - job_name: 'kubernetes-nodes' kubernetes_sd_configs: - api_servers: - - ${config['template.substitutions']['kubernetes_url']} + - ${config['kubernetes.url']} basic_auth: username: prometheus password: pr0m3th3us @@ -109,7 +109,7 @@ data: - job_name: 'kubernetes-service-endpoints' kubernetes_sd_configs: - api_servers: - - ${config['template.substitutions']['kubernetes_url']} + - ${config['kubernetes.url']} basic_auth: username: prometheus password: pr0m3th3us @@ -138,4 +138,4 @@ data: target_label: kubernetes_namespace - source_labels: [__meta_kubernetes_service_name] action: replace - target_label: kubernetes_name \ No newline at end of file + target_label: kubernetes_name