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
This commit is contained in:
Sergey Filatov 2018-07-31 11:51:07 +03:00
parent fff1d722df
commit 0cf61dfb74
8 changed files with 47 additions and 4 deletions

View File

@ -1075,7 +1075,7 @@ _`container_infra_prefix`
Images that must be mirrored:
* docker.io/coredns/coredns:1.0.1
* docker.io/grafana/grafana:latest
* docker.io/grafana/grafana:5.1.5
* docker.io/openstackmagnum/kubernetes-apiserver
* docker.io/openstackmagnum/kubernetes-controller-manager
* docker.io/openstackmagnum/kubernetes-kubelet

View File

@ -220,7 +220,7 @@ spec:
serviceAccountName: prometheus
containers:
- name: prometheus
image: ${CONTAINER_INFRA_PREFIX:-docker.io/prom/}prometheus:v1.8.2
image: ${CONTAINER_INFRA_PREFIX:-docker.io/prom/}prometheus:${PROMETHEUS_TAG}
args:
- '-storage.local.retention=6h'
- '-storage.local.memory-chunks=500000'
@ -314,7 +314,7 @@ spec:
role: db
spec:
containers:
- image: ${CONTAINER_INFRA_PREFIX:-docker.io/grafana/}grafana:4.6.3
- image: ${CONTAINER_INFRA_PREFIX:-docker.io/grafana/}grafana:${GRAFANA_TAG}
imagePullPolicy: Always
name: grafana
env:

View File

@ -76,3 +76,5 @@ write_files:
OCTAVIA_ENABLED="$OCTAVIA_ENABLED"
KUBE_SERVICE_ACCOUNT_KEY="$KUBE_SERVICE_ACCOUNT_KEY"
KUBE_SERVICE_ACCOUNT_PRIVATE_KEY="$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY"
PROMETHEUS_TAG="$PROMETHEUS_TAG"
GRAFANA_TAG="$GRAFANA_TAG"

View File

@ -109,7 +109,9 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'calico_tag', 'calico_cni_tag',
'calico_kube_controllers_tag', 'calico_ipv4pool',
'etcd_tag', 'flannel_tag',
'cloud_provider_enabled']
'cloud_provider_enabled',
'prometheus_tag',
'grafana_tag']
for label in label_list:
label_value = cluster.labels.get(label)

View File

@ -494,6 +494,16 @@ parameters:
description: Enable or disable the openstack kubernetes cloud provider
default: true
prometheus_tag:
type: string
description: tag of the prometheus container
default: v1.8.2
grafana_tag:
type: string
description: tag of grafana container
default: 5.1.5
resources:
######################################################################
@ -718,6 +728,8 @@ resources:
octavia_enabled: {get_param: octavia_enabled}
kube_service_account_key: {get_param: kube_service_account_key}
kube_service_account_private_key: {get_param: kube_service_account_private_key}
prometheus_tag: {get_param: prometheus_tag}
grafana_tag: {get_param: grafana_tag}
######################################################################

View File

@ -391,6 +391,14 @@ parameters:
type: boolean
description: Enable or disable the openstack kubernetes cloud provider
prometheus_tag:
type: string
description: tag of prometheus container
grafana_tag:
type: string
description: tag of grafana container
resources:
master_wait_handle:
@ -501,6 +509,8 @@ resources:
"$OCTAVIA_ENABLED": {get_param: octavia_enabled}
"$KUBE_SERVICE_ACCOUNT_KEY": {get_param: kube_service_account_key}
"$KUBE_SERVICE_ACCOUNT_PRIVATE_KEY": {get_param: kube_service_account_private_key}
"$PROMETHEUS_TAG": {get_param: prometheus_tag}
"$GRAFANA_TAG": {get_param: grafana_tag}
install_openstack_ca:
type: OS::Heat::SoftwareConfig

View File

@ -373,6 +373,10 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'cloud_provider_enabled')
service_cluster_ip_range = mock_cluster.labels.get(
'service_cluster_ip_range')
prometheus_tag = mock_cluster.labels.get(
'prometheus_tag')
grafana_tag = mock_cluster.labels.get(
'grafana_tag')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -423,6 +427,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'kube_service_account_key': 'public_key',
'kube_service_account_private_key': 'private_key',
'portal_network_cidr': service_cluster_ip_range,
'prometheus_tag': prometheus_tag,
'grafana_tag': grafana_tag,
}}
mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template,
@ -546,6 +552,10 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'cloud_provider_enabled')
service_cluster_ip_range = mock_cluster.labels.get(
'service_cluster_ip_range')
prometheus_tag = mock_cluster.labels.get(
'prometheus_tag')
grafana_tag = mock_cluster.labels.get(
'grafana_tag')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -598,6 +608,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'kube_service_account_key': 'public_key',
'kube_service_account_private_key': 'private_key',
'portal_network_cidr': service_cluster_ip_range,
'prometheus_tag': prometheus_tag,
'grafana_tag': grafana_tag,
}}
mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template,

View File

@ -0,0 +1,5 @@
---
features:
- |
Add 'grafana_tag' and 'prometheus_tag' labels for the k8s_fedora_atomic driver.
Grafana defaults to 5.1.5 and Prometheus defaults to v1.8.2.