Skip to content

Commit

Permalink
Merge pull request #7751 from saad-ali/updateHeapsterConfigs
Browse files Browse the repository at this point in the history
Enable GCM and GCL instead of InfluxDB on GCE
  • Loading branch information
a-robinson committed May 6, 2015
2 parents 7ce7568 + 4569de7 commit 0909cce
Show file tree
Hide file tree
Showing 20 changed files with 90 additions and 172 deletions.
4 changes: 2 additions & 2 deletions build/common.sh
Expand Up @@ -651,11 +651,11 @@ function kube::release::package_salt_tarball() {
cp -R "${KUBE_ROOT}/cluster/saltbase" "${release_stage}/"

# TODO(#3579): This is a temporary hack. It gathers up the yaml,
# yaml.in files in cluster/addons (minus any demos) and overlays
# yaml.in, json files in cluster/addons (minus any demos) and overlays
# them into kube-addons, where we expect them. (This pipeline is a
# fancy copy, stripping anything but the files we don't want.)
local objects
objects=$(cd "${KUBE_ROOT}/cluster/addons" && find . -name \*.yaml -or -name \*.yaml.in | grep -v demo)
objects=$(cd "${KUBE_ROOT}/cluster/addons" && find . \( -name \*.yaml -or -name \*.yaml.in -or -name \*.json \) | grep -v demo)
tar c -C "${KUBE_ROOT}/cluster/addons" ${objects} | tar x -C "${release_stage}/saltbase/salt/kube-addons"

kube::release::clean_cruft
Expand Down
Expand Up @@ -19,17 +19,14 @@ spec:
- image: gcr.io/google_containers/heapster:v0.11.0
name: heapster
env:
- name: "INFLUXDB_HOST"
value: "http://monitoring-influxdb"
- name: "SINK"
value: "influxdb"
volumeMounts:
- name: FLAGS
value: "--poll_duration=2m --stats_resolution=1m --sink=gcm --sink=gcl"
volumeMounts:
- name: ssl-certs
mountPath: /etc/ssl/certs
readOnly: true
volumes:
volumes:
- name: ssl-certs
source:
hostDir:
path: /etc/ssl/certs
hostPath:
path: /etc/ssl/certs

10 changes: 0 additions & 10 deletions cluster/addons/cluster-monitoring/grafana-service.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions cluster/addons/cluster-monitoring/heapster-controller.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions cluster/addons/cluster-monitoring/heapster-service.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions cluster/addons/cluster-monitoring/influxdb-grafana-controller.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions cluster/addons/cluster-monitoring/influxdb-service.yaml

This file was deleted.

Expand Up @@ -6,11 +6,9 @@ metadata:
kubernetes.io/cluster-service: "true"
name: monitoring-grafana
spec:
ports:
ports:
- port: 80
targetPort: 8080
selector:
name: influxGrafana
kubernetes.io/cluster-service: "true"


@@ -0,0 +1,32 @@
apiVersion: v1beta3
kind: ReplicationController
metadata:
labels:
name: heapster
kubernetes.io/cluster-service: "true"
name: monitoring-heapster-controller
spec:
replicas: 1
selector:
name: heapster
template:
metadata:
labels:
name: heapster
kubernetes.io/cluster-service: "true"
spec:
containers:
- image: gcr.io/google_containers/heapster:v0.11.0
name: heapster
env:
- name: FLAGS
value: "--poll_duration=2m --stats_resolution=1m --sink influxdb:http://monitoring-influxdb.default.kubernetes.local:8086"
volumeMounts:
- name: ssl-certs
mountPath: /etc/ssl/certs
readOnly: true
volumes:
- name: ssl-certs
hostPath:
path: "/etc/ssl/certs"

Expand Up @@ -18,17 +18,18 @@ spec:
containers:
- image: gcr.io/google_containers/heapster_influxdb:v0.3
name: influxdb
ports:
ports:
- containerPort: 8083
hostPort: 8083
- containerPort: 8086
hostPort: 8086
- name: grafana
image: gcr.io/google_containers/heapster_grafana:v0.7
- image: gcr.io/google_containers/heapster_grafana:v0.7
name: grafana
env:
- name: "INFLUXDB_EXTERNAL_URL"
value: '/api/v1beta1/proxy/services/monitoring-grafana/db/'
- name: "INFLUXDB_HOST"
value: 'monitoring-influxdb'
- name: "INFLUXDB_PORT"
value: '80'
- name: INFLUXDB_EXTERNAL_URL
value: /api/v1beta1/proxy/services/monitoring-grafana/db/
- name: INFLUXDB_HOST
value: monitoring-influxdb
- name: INFLUXDB_PORT
value: "80"

Expand Up @@ -3,12 +3,16 @@ kind: Service
metadata:
labels:
name: influxGrafana
kubernetes.io/cluster-service: "true"
name: monitoring-influxdb
spec:
ports:
- port: 80
ports:
- name: http
port: 8083
targetPort: 8083
- name: api
port: 8086
targetPort: 8086
selector:
name: influxGrafana


16 changes: 0 additions & 16 deletions cluster/addons/cluster-monitoring/v1beta3/heapster-service.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions cluster/addons/cluster-monitoring/v1beta3/influxdb-ui-service.yaml

This file was deleted.

7 changes: 5 additions & 2 deletions cluster/gce/config-default.sh
Expand Up @@ -50,8 +50,11 @@ ENABLE_DOCKER_REGISTRY_CACHE=true
# Optional: Install node monitoring.
ENABLE_NODE_MONITORING="${KUBE_ENABLE_NODE_MONITORING:-true}"

# Optional: When set to true, heapster, Influxdb and Grafana will be setup as part of the cluster bring up.
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-true}"
# Optional: Cluster monitoring to setup as part of the cluster bring up:
# none - No cluster monitoring setup
# influxdb - Heapster, InfluxDB, and Grafana
# google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-google}"

# Optional: Enable node logging.
ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"
Expand Down
7 changes: 5 additions & 2 deletions cluster/gce/config-test.sh
Expand Up @@ -49,8 +49,11 @@ ENABLE_DOCKER_REGISTRY_CACHE=true
# Optional: Install node monitoring.
ENABLE_NODE_MONITORING="${KUBE_ENABLE_NODE_MONITORING:-true}"

# Optional: When set to true, heapster will be setup as part of the cluster bring up.
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-true}"
# Optional: Cluster monitoring to setup as part of the cluster bring up:
# none - No cluster monitoring setup
# influxdb - Heapster, InfluxDB, and Grafana
# google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"

# Optional: Enable node logging.
ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"
Expand Down
4 changes: 2 additions & 2 deletions cluster/gce/coreos/helper.sh
Expand Up @@ -33,7 +33,7 @@ SERVER_BINARY_TAR_URL: $(yaml-quote ${SERVER_BINARY_TAR_URL})
SALT_TAR_URL: $(yaml-quote ${SALT_TAR_URL})
PORTAL_NET: $(yaml-quote ${PORTAL_NET})
ALLOCATE_NODE_CIDRS: $(yaml-quote ${ALLOCATE_NODE_CIDRS:-false})
ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-false})
ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-none})
ENABLE_NODE_MONITORING: $(yaml-quote ${ENABLE_NODE_MONITORING:-false})
ENABLE_CLUSTER_LOGGING: $(yaml-quote ${ENABLE_CLUSTER_LOGGING:-false})
ENABLE_NODE_LOGGING: $(yaml-quote ${ENABLE_NODE_LOGGING:-false})
Expand All @@ -59,7 +59,7 @@ INSTANCE_PREFIX=$(yaml-quote ${INSTANCE_PREFIX})
NODE_INSTANCE_PREFIX=$(yaml-quote ${NODE_INSTANCE_PREFIX})
SERVER_BINARY_TAR_URL=$(yaml-quote ${SERVER_BINARY_TAR_URL})
PORTAL_NET=$(yaml-quote ${PORTAL_NET})
ENABLE_CLUSTER_MONITORING=$(yaml-quote ${ENABLE_CLUSTER_MONITORING:-false})
ENABLE_CLUSTER_MONITORING=$(yaml-quote ${ENABLE_CLUSTER_MONITORING:-none})
ENABLE_NODE_MONITORING=$(yaml-quote ${ENABLE_NODE_MONITORING:-false})
ENABLE_CLUSTER_LOGGING=$(yaml-quote ${ENABLE_CLUSTER_LOGGING:-false})
ENABLE_NODE_LOGGING=$(yaml-quote ${ENABLE_NODE_LOGGING:-false})
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/debian/helper.sh
Expand Up @@ -31,7 +31,7 @@ SERVER_BINARY_TAR_URL: $(yaml-quote ${SERVER_BINARY_TAR_URL})
SALT_TAR_URL: $(yaml-quote ${SALT_TAR_URL})
PORTAL_NET: $(yaml-quote ${PORTAL_NET})
ALLOCATE_NODE_CIDRS: $(yaml-quote ${ALLOCATE_NODE_CIDRS:-false})
ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-false})
ENABLE_CLUSTER_MONITORING: $(yaml-quote ${ENABLE_CLUSTER_MONITORING:-none})
ENABLE_NODE_MONITORING: $(yaml-quote ${ENABLE_NODE_MONITORING:-false})
ENABLE_CLUSTER_LOGGING: $(yaml-quote ${ENABLE_CLUSTER_LOGGING:-false})
ENABLE_NODE_LOGGING: $(yaml-quote ${ENABLE_NODE_LOGGING:-false})
Expand Down
19 changes: 15 additions & 4 deletions cluster/saltbase/salt/kube-addons/init.sls
@@ -1,8 +1,19 @@
{% if pillar.get('enable_cluster_monitoring', '').lower() == 'true' %}
/etc/kubernetes/addons/cluster-monitoring:
{% if pillar.get('enable_cluster_monitoring', '').lower() == 'influxdb' %}
/etc/kubernetes/addons/cluster-monitoring/influxdb:
file.recurse:
- source: salt://kube-addons/cluster-monitoring
- include_pat: E@^.+\.yaml$
- source: salt://kube-addons/cluster-monitoring/influxdb
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- user: root
- group: root
- dir_mode: 755
- file_mode: 644
{% endif %}

{% if pillar.get('enable_cluster_monitoring', '').lower() == 'google' %}
/etc/kubernetes/addons/cluster-monitoring/google:
file.recurse:
- source: salt://kube-addons/cluster-monitoring/google
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- user: root
- group: root
- dir_mode: 755
Expand Down
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/kube-addons/kube-addons.sh
Expand Up @@ -110,7 +110,7 @@ while read line; do
create-kubeconfig-secret "${token}" "${username}"
done < /srv/kubernetes/known_tokens.csv

for obj in $(find /etc/kubernetes/addons -name \*.yaml); do
for obj in $(find /etc/kubernetes/addons \( -name \*.yaml -o -name \*.json \)); do
start_addon ${obj} 100 10 &
echo "++ addon ${obj} starting in pid $! ++"
done
Expand Down
7 changes: 3 additions & 4 deletions test/e2e/monitoring.go
Expand Up @@ -68,9 +68,8 @@ var (
"monitoring-influx-grafana-controller": false,
}
expectedServices = map[string]bool{
influxdbService: false,
"monitoring-heapster": false,
"monitoring-grafana": false,
influxdbService: false,
"monitoring-grafana": false,
}
)

Expand Down Expand Up @@ -209,7 +208,7 @@ func testMonitoringUsingHeapsterInfluxdb(c *client.Client) {
if !ok {
Failf("failed to get master http client")
}
proxyUrl := fmt.Sprintf("%s/api/v1beta3/proxy/namespaces/default/services/%s/", getMasterHost(), influxdbService)
proxyUrl := fmt.Sprintf("%s/api/v1beta3/proxy/namespaces/default/services/%s:api/", getMasterHost(), influxdbService)
config := &influxdb.ClientConfig{
Host: proxyUrl,
// TODO(vishh): Infer username and pw from the Pod spec.
Expand Down

0 comments on commit 0909cce

Please sign in to comment.