Skip to content

Commit

Permalink
Update manifests with custom namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
camilb committed Aug 13, 2018
1 parent ae5a3ca commit 2f90e0a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
7 changes: 3 additions & 4 deletions deploy
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ echo -e "${BLUE}Creating ${ORANGE}${NAMESPACE} ${BLUE}namespace."
kubectl create namespace "$NAMESPACE"

#Set namespace in various resources
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/kube-state-metrics/kube-state-metrics-rbac.yaml
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s-rbac.yaml
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s.yaml
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml
for n in $(egrep -lir --include=*.{yaml,sh} "CUSTOM_NAMESPACE" .); do
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' $n
done

kctl() {
kubectl --namespace "$NAMESPACE" "$@"
Expand Down
2 changes: 1 addition & 1 deletion manifests/grafana/grafana-datasources.cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data:
"name": "prometheus",
"orgId": 1,
"type": "prometheus",
"url": "http://prometheus-k8s.monitoring.svc:9090",
"url": "http://prometheus-k8s.CUSTOM_NAMESPACE.svc:9090",
"version": 1
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
alertmanager: main
namespaceSelector:
matchNames:
- monitoring
- CUSTOM_NAMESPACE
endpoints:
- port: web
interval: 30s
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
k8s-app: kube-state-metrics
namespaceSelector:
matchNames:
- monitoring
- CUSTOM_NAMESPACE
endpoints:
- port: http-metrics
interval: 30s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
k8s-app: node-exporter
namespaceSelector:
matchNames:
- monitoring
- CUSTOM_NAMESPACE
endpoints:
- port: http-metrics
interval: 30s
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
prometheus: k8s
namespaceSelector:
matchNames:
- monitoring
- CUSTOM_NAMESPACE
endpoints:
- port: web
interval: 30s
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
provider: kubernetes
namespaceSelector:
matchNames:
- kube-system
- default
endpoints:
- port: https
interval: 30s
Expand Down
7 changes: 3 additions & 4 deletions teardown
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ kctl() {
}

#Set namespace in various resources
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/kube-state-metrics/kube-state-metrics-rbac.yaml
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s-rbac.yaml
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus/prometheus-k8s.yaml
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' manifests/prometheus-operator/prometheus-operator-cluster-role-binding.yaml
for n in $(egrep -lir --include=*.{yaml,sh} "CUSTOM_NAMESPACE" .); do
sed -i -e 's,CUSTOM_NAMESPACE,'"$NAMESPACE"',g' $n
done

kctl delete -f manifests/node-exporter
kctl delete -f manifests/kube-state-metrics
Expand Down

0 comments on commit 2f90e0a

Please sign in to comment.