Skip to content

Commit

Permalink
Do not use template.substitutions in pod resources
Browse files Browse the repository at this point in the history
  • Loading branch information
grkvlt committed Dec 6, 2016
1 parent 5d50de5 commit b711fac
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 30 deletions.
25 changes: 9 additions & 16 deletions kubernetes/catalog/kubernetes/pods.bom
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions kubernetes/resources/kubernetes/kube-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
dnsPolicy: Default
2 changes: 1 addition & 1 deletion kubernetes/resources/kubernetes/kubernetes-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: /
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/resources/kubernetes/policy-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions kubernetes/resources/kubernetes/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ data:
- job_name: 'kubernetes-cluster'
kubernetes_sd_configs:
- api_servers:
- ${config['template.substitutions']['kubernetes_url']}
- ${config['kubernetes.url']}
basic_auth:
username: prometheus
password: pr0m3th3us
role: apiserver
- job_name: 'kubernetes-nodes'
kubernetes_sd_configs:
- api_servers:
- ${config['template.substitutions']['kubernetes_url']}
- ${config['kubernetes.url']}
basic_auth:
username: prometheus
password: pr0m3th3us
Expand All @@ -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
Expand Down Expand Up @@ -138,4 +138,4 @@ data:
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_service_name]
action: replace
target_label: kubernetes_name
target_label: kubernetes_name

0 comments on commit b711fac

Please sign in to comment.