summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Filatov <s.s.filatov94@gmail.com>2018-07-31 11:51:07 +0300
committerSergey Filatov <s.s.filatov94@gmail.com>2018-08-31 18:20:26 +0300
commit0cf61dfb7412f05fd98f597f3f451e3f1dcd8c08 (patch)
tree74e033dcd4ec5e87fa9a40eb061d58ae0cf28dd5
parentfff1d722df5386a523576baf404165014d29585b (diff)
Add prometheus & grafana container image tags
To upgrade cluster we need to be able to set image tags so this change adds to labels for corresponding containers Task: 23314 Story: 2003171 Change-Id: I4cd0270a69fb889c59bdb28966821adb11fd0292
Notes
Notes (review): Code-Review+2: Feilong Wang <flwang@catalyst.net.nz> Code-Review+1: Erik Olof Gunnar Andersson <eandersson@blizzard.com> Code-Review+2: Spyros Trigazis <strigazi@gmail.com> Workflow+1: Spyros Trigazis <strigazi@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 10 Sep 2018 07:43:43 +0000 Reviewed-on: https://review.openstack.org/591507 Project: openstack/magnum Branch: refs/heads/master
-rw-r--r--doc/source/user/index.rst2
-rw-r--r--magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh4
-rw-r--r--magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml2
-rw-r--r--magnum/drivers/heat/k8s_fedora_template_def.py4
-rw-r--r--magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml12
-rw-r--r--magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml10
-rw-r--r--magnum/tests/unit/drivers/test_template_definition.py12
-rw-r--r--releasenotes/notes/grafana_prometheus_tag_label-78540ea106677485.yaml5
8 files changed, 47 insertions, 4 deletions
diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst
index 5ae5b45..dcbd246 100644
--- a/doc/source/user/index.rst
+++ b/doc/source/user/index.rst
@@ -1075,7 +1075,7 @@ _`container_infra_prefix`
1075 Images that must be mirrored: 1075 Images that must be mirrored:
1076 1076
1077 * docker.io/coredns/coredns:1.0.1 1077 * docker.io/coredns/coredns:1.0.1
1078 * docker.io/grafana/grafana:latest 1078 * docker.io/grafana/grafana:5.1.5
1079 * docker.io/openstackmagnum/kubernetes-apiserver 1079 * docker.io/openstackmagnum/kubernetes-apiserver
1080 * docker.io/openstackmagnum/kubernetes-controller-manager 1080 * docker.io/openstackmagnum/kubernetes-controller-manager
1081 * docker.io/openstackmagnum/kubernetes-kubelet 1081 * docker.io/openstackmagnum/kubernetes-kubelet
diff --git a/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
index 84283bb..3eb770e 100644
--- a/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
+++ b/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
@@ -220,7 +220,7 @@ spec:
220 serviceAccountName: prometheus 220 serviceAccountName: prometheus
221 containers: 221 containers:
222 - name: prometheus 222 - name: prometheus
223 image: ${CONTAINER_INFRA_PREFIX:-docker.io/prom/}prometheus:v1.8.2 223 image: ${CONTAINER_INFRA_PREFIX:-docker.io/prom/}prometheus:${PROMETHEUS_TAG}
224 args: 224 args:
225 - '-storage.local.retention=6h' 225 - '-storage.local.retention=6h'
226 - '-storage.local.memory-chunks=500000' 226 - '-storage.local.memory-chunks=500000'
@@ -314,7 +314,7 @@ spec:
314 role: db 314 role: db
315 spec: 315 spec:
316 containers: 316 containers:
317 - image: ${CONTAINER_INFRA_PREFIX:-docker.io/grafana/}grafana:4.6.3 317 - image: ${CONTAINER_INFRA_PREFIX:-docker.io/grafana/}grafana:${GRAFANA_TAG}
318 imagePullPolicy: Always 318 imagePullPolicy: Always
319 name: grafana 319 name: grafana
320 env: 320 env:
diff --git a/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml b/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml
index cd99025..23a22ed 100644
--- a/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml
+++ b/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml
@@ -76,3 +76,5 @@ write_files:
76 OCTAVIA_ENABLED="$OCTAVIA_ENABLED" 76 OCTAVIA_ENABLED="$OCTAVIA_ENABLED"
77 KUBE_SERVICE_ACCOUNT_KEY="$KUBE_SERVICE_ACCOUNT_KEY" 77 KUBE_SERVICE_ACCOUNT_KEY="$KUBE_SERVICE_ACCOUNT_KEY"
78 KUBE_SERVICE_ACCOUNT_PRIVATE_KEY="$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY" 78 KUBE_SERVICE_ACCOUNT_PRIVATE_KEY="$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY"
79 PROMETHEUS_TAG="$PROMETHEUS_TAG"
80 GRAFANA_TAG="$GRAFANA_TAG"
diff --git a/magnum/drivers/heat/k8s_fedora_template_def.py b/magnum/drivers/heat/k8s_fedora_template_def.py
index 51145c0..f1aa235 100644
--- a/magnum/drivers/heat/k8s_fedora_template_def.py
+++ b/magnum/drivers/heat/k8s_fedora_template_def.py
@@ -109,7 +109,9 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
109 'calico_tag', 'calico_cni_tag', 109 'calico_tag', 'calico_cni_tag',
110 'calico_kube_controllers_tag', 'calico_ipv4pool', 110 'calico_kube_controllers_tag', 'calico_ipv4pool',
111 'etcd_tag', 'flannel_tag', 111 'etcd_tag', 'flannel_tag',
112 'cloud_provider_enabled'] 112 'cloud_provider_enabled',
113 'prometheus_tag',
114 'grafana_tag']
113 115
114 for label in label_list: 116 for label in label_list:
115 label_value = cluster.labels.get(label) 117 label_value = cluster.labels.get(label)
diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml
index bacc15a..0f7ff3d 100644
--- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml
+++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml
@@ -494,6 +494,16 @@ parameters:
494 description: Enable or disable the openstack kubernetes cloud provider 494 description: Enable or disable the openstack kubernetes cloud provider
495 default: true 495 default: true
496 496
497 prometheus_tag:
498 type: string
499 description: tag of the prometheus container
500 default: v1.8.2
501
502 grafana_tag:
503 type: string
504 description: tag of grafana container
505 default: 5.1.5
506
497resources: 507resources:
498 508
499 ###################################################################### 509 ######################################################################
@@ -718,6 +728,8 @@ resources:
718 octavia_enabled: {get_param: octavia_enabled} 728 octavia_enabled: {get_param: octavia_enabled}
719 kube_service_account_key: {get_param: kube_service_account_key} 729 kube_service_account_key: {get_param: kube_service_account_key}
720 kube_service_account_private_key: {get_param: kube_service_account_private_key} 730 kube_service_account_private_key: {get_param: kube_service_account_private_key}
731 prometheus_tag: {get_param: prometheus_tag}
732 grafana_tag: {get_param: grafana_tag}
721 733
722 734
723 ###################################################################### 735 ######################################################################
diff --git a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml
index 7ed4b17..dfe6edd 100644
--- a/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml
+++ b/magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml
@@ -391,6 +391,14 @@ parameters:
391 type: boolean 391 type: boolean
392 description: Enable or disable the openstack kubernetes cloud provider 392 description: Enable or disable the openstack kubernetes cloud provider
393 393
394 prometheus_tag:
395 type: string
396 description: tag of prometheus container
397
398 grafana_tag:
399 type: string
400 description: tag of grafana container
401
394resources: 402resources:
395 403
396 master_wait_handle: 404 master_wait_handle:
@@ -501,6 +509,8 @@ resources:
501 "$OCTAVIA_ENABLED": {get_param: octavia_enabled} 509 "$OCTAVIA_ENABLED": {get_param: octavia_enabled}
502 "$KUBE_SERVICE_ACCOUNT_KEY": {get_param: kube_service_account_key} 510 "$KUBE_SERVICE_ACCOUNT_KEY": {get_param: kube_service_account_key}
503 "$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY": {get_param: kube_service_account_private_key} 511 "$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY": {get_param: kube_service_account_private_key}
512 "$PROMETHEUS_TAG": {get_param: prometheus_tag}
513 "$GRAFANA_TAG": {get_param: grafana_tag}
504 514
505 install_openstack_ca: 515 install_openstack_ca:
506 type: OS::Heat::SoftwareConfig 516 type: OS::Heat::SoftwareConfig
diff --git a/magnum/tests/unit/drivers/test_template_definition.py b/magnum/tests/unit/drivers/test_template_definition.py
index 1024a13..edbf9dc 100644
--- a/magnum/tests/unit/drivers/test_template_definition.py
+++ b/magnum/tests/unit/drivers/test_template_definition.py
@@ -373,6 +373,10 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
373 'cloud_provider_enabled') 373 'cloud_provider_enabled')
374 service_cluster_ip_range = mock_cluster.labels.get( 374 service_cluster_ip_range = mock_cluster.labels.get(
375 'service_cluster_ip_range') 375 'service_cluster_ip_range')
376 prometheus_tag = mock_cluster.labels.get(
377 'prometheus_tag')
378 grafana_tag = mock_cluster.labels.get(
379 'grafana_tag')
376 380
377 k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition() 381 k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
378 382
@@ -423,6 +427,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
423 'kube_service_account_key': 'public_key', 427 'kube_service_account_key': 'public_key',
424 'kube_service_account_private_key': 'private_key', 428 'kube_service_account_private_key': 'private_key',
425 'portal_network_cidr': service_cluster_ip_range, 429 'portal_network_cidr': service_cluster_ip_range,
430 'prometheus_tag': prometheus_tag,
431 'grafana_tag': grafana_tag,
426 }} 432 }}
427 mock_get_params.assert_called_once_with(mock_context, 433 mock_get_params.assert_called_once_with(mock_context,
428 mock_cluster_template, 434 mock_cluster_template,
@@ -546,6 +552,10 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
546 'cloud_provider_enabled') 552 'cloud_provider_enabled')
547 service_cluster_ip_range = mock_cluster.labels.get( 553 service_cluster_ip_range = mock_cluster.labels.get(
548 'service_cluster_ip_range') 554 'service_cluster_ip_range')
555 prometheus_tag = mock_cluster.labels.get(
556 'prometheus_tag')
557 grafana_tag = mock_cluster.labels.get(
558 'grafana_tag')
549 559
550 k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition() 560 k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
551 561
@@ -598,6 +608,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
598 'kube_service_account_key': 'public_key', 608 'kube_service_account_key': 'public_key',
599 'kube_service_account_private_key': 'private_key', 609 'kube_service_account_private_key': 'private_key',
600 'portal_network_cidr': service_cluster_ip_range, 610 'portal_network_cidr': service_cluster_ip_range,
611 'prometheus_tag': prometheus_tag,
612 'grafana_tag': grafana_tag,
601 }} 613 }}
602 mock_get_params.assert_called_once_with(mock_context, 614 mock_get_params.assert_called_once_with(mock_context,
603 mock_cluster_template, 615 mock_cluster_template,
diff --git a/releasenotes/notes/grafana_prometheus_tag_label-78540ea106677485.yaml b/releasenotes/notes/grafana_prometheus_tag_label-78540ea106677485.yaml
new file mode 100644
index 0000000..4f5dd94
--- /dev/null
+++ b/releasenotes/notes/grafana_prometheus_tag_label-78540ea106677485.yaml
@@ -0,0 +1,5 @@
1---
2features:
3 - |
4 Add 'grafana_tag' and 'prometheus_tag' labels for the k8s_fedora_atomic driver.
5 Grafana defaults to 5.1.5 and Prometheus defaults to v1.8.2.