Add a kube_tag label to control the k8s containers to pull

Separate the tag from which to pull from the kubernetes version.
With the current state the tag and the version happen to be the
the same. But, it is not decided yet in the fedoraproject how the
images are going to be tag. Finally, operators might want to try
their own container images with custom tags.

Depends-On: Icddb8ed1598f2ba1f782622f86fb6083953c3b3f
Implements: blueprint run-kube-as-container

Change-Id: I4c4bc055d7df5e65aede93464bff51e6d5971504
This commit is contained in:
Mathieu Velten 2017-08-08 11:43:59 +02:00
parent 005eeb575d
commit 46255dd4b1
12 changed files with 53 additions and 9 deletions

View File

@ -4,11 +4,11 @@
echo "configuring kubernetes (master)" echo "configuring kubernetes (master)"
atomic install --storage ostree --system --system-package=no --name=kubelet docker.io/openstackmagnum/kubernetes-kubelet:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kubelet docker.io/openstackmagnum/kubernetes-kubelet:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-proxy docker.io/openstackmagnum/kubernetes-proxy:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kube-proxy docker.io/openstackmagnum/kubernetes-proxy:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-apiserver docker.io/openstackmagnum/kubernetes-apiserver:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kube-apiserver docker.io/openstackmagnum/kubernetes-apiserver:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-controller-manager docker.io/openstackmagnum/kubernetes-controller-manager:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kube-controller-manager docker.io/openstackmagnum/kubernetes-controller-manager:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-scheduler docker.io/openstackmagnum/kubernetes-scheduler:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kube-scheduler docker.io/openstackmagnum/kubernetes-scheduler:${KUBE_TAG}
sed -i ' sed -i '
/^KUBE_ALLOW_PRIV=/ s/=.*/="--allow-privileged='"$KUBE_ALLOW_PRIV"'"/ /^KUBE_ALLOW_PRIV=/ s/=.*/="--allow-privileged='"$KUBE_ALLOW_PRIV"'"/

View File

@ -4,8 +4,8 @@
echo "configuring kubernetes (minion)" echo "configuring kubernetes (minion)"
atomic install --storage ostree --system --system-package=no --name=kubelet docker.io/openstackmagnum/kubernetes-kubelet:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kubelet docker.io/openstackmagnum/kubernetes-kubelet:${KUBE_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-proxy docker.io/openstackmagnum/kubernetes-proxy:${KUBE_VERSION} atomic install --storage ostree --system --system-package=no --name=kube-proxy docker.io/openstackmagnum/kubernetes-proxy:${KUBE_TAG}
CERT_DIR=/etc/kubernetes/certs CERT_DIR=/etc/kubernetes/certs
PROTOCOL=https PROTOCOL=https

View File

@ -38,6 +38,7 @@ write_files:
HTTPS_PROXY="$HTTPS_PROXY" HTTPS_PROXY="$HTTPS_PROXY"
NO_PROXY="$NO_PROXY" NO_PROXY="$NO_PROXY"
WAIT_CURL="$WAIT_CURL" WAIT_CURL="$WAIT_CURL"
KUBE_TAG="$KUBE_TAG"
KUBE_VERSION="$KUBE_VERSION" KUBE_VERSION="$KUBE_VERSION"
KUBE_DASHBOARD_VERSION="$KUBE_DASHBOARD_VERSION" KUBE_DASHBOARD_VERSION="$KUBE_DASHBOARD_VERSION"
TRUSTEE_USER_ID="$TRUSTEE_USER_ID" TRUSTEE_USER_ID="$TRUSTEE_USER_ID"

View File

@ -36,6 +36,7 @@ write_files:
HTTPS_PROXY="$HTTPS_PROXY" HTTPS_PROXY="$HTTPS_PROXY"
NO_PROXY="$NO_PROXY" NO_PROXY="$NO_PROXY"
WAIT_CURL="$WAIT_CURL" WAIT_CURL="$WAIT_CURL"
KUBE_TAG="$KUBE_TAG"
KUBE_VERSION="$KUBE_VERSION" KUBE_VERSION="$KUBE_VERSION"
TRUSTEE_USER_ID="$TRUSTEE_USER_ID" TRUSTEE_USER_ID="$TRUSTEE_USER_ID"
TRUSTEE_PASSWORD="$TRUSTEE_PASSWORD" TRUSTEE_PASSWORD="$TRUSTEE_PASSWORD"

View File

@ -79,6 +79,10 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'docker_volume_type', CONF.cinder.default_docker_volume_type) 'docker_volume_type', CONF.cinder.default_docker_volume_type)
extra_params['docker_volume_type'] = docker_volume_type extra_params['docker_volume_type'] = docker_volume_type
kube_tag = cluster_template.labels.get('kube_tag')
if kube_tag:
extra_params['kube_tag'] = kube_tag
return super(K8sFedoraTemplateDefinition, return super(K8sFedoraTemplateDefinition,
self).get_params(context, cluster_template, cluster, self).get_params(context, cluster_template, cluster,
extra_params=extra_params, extra_params=extra_params,

View File

@ -313,6 +313,11 @@ parameters:
type: string type: string
description: url for keystone description: url for keystone
kube_tag:
type: string
description: tag of the k8s containers used to provision the kubernetes cluster
default: v1.7.4
kube_version: kube_version:
type: string type: string
description: version of kubernetes used for kubernetes cluster description: version of kubernetes used for kubernetes cluster
@ -504,6 +509,7 @@ resources:
http_proxy: {get_param: http_proxy} http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy} https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy} no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version} kube_version: {get_param: kube_version}
kube_dashboard_version: {get_param: kube_dashboard_version} kube_dashboard_version: {get_param: kube_dashboard_version}
trustee_user_id: {get_param: trustee_user_id} trustee_user_id: {get_param: trustee_user_id}
@ -567,6 +573,7 @@ resources:
http_proxy: {get_param: http_proxy} http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy} https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy} no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version} kube_version: {get_param: kube_version}
trustee_user_id: {get_param: trustee_user_id} trustee_user_id: {get_param: trustee_user_id}
trustee_username: {get_param: trustee_username} trustee_username: {get_param: trustee_username}

View File

@ -206,6 +206,10 @@ parameters:
type: string type: string
description: no proxies for docker description: no proxies for docker
kube_tag:
type: string
description: tag of the k8s containers used to provision the kubernetes cluster
kube_version: kube_version:
type: string type: string
description: version of kubernetes used for kubernetes cluster description: version of kubernetes used for kubernetes cluster
@ -322,6 +326,7 @@ resources:
"$HTTP_PROXY": {get_param: http_proxy} "$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy} "$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy} "$NO_PROXY": {get_param: no_proxy}
"$KUBE_TAG": {get_param: kube_tag}
"$KUBE_VERSION": {get_param: kube_version} "$KUBE_VERSION": {get_param: kube_version}
"$KUBE_DASHBOARD_VERSION": {get_param: kube_dashboard_version} "$KUBE_DASHBOARD_VERSION": {get_param: kube_dashboard_version}
"$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]} "$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]}

View File

@ -169,6 +169,10 @@ parameters:
type: string type: string
description: no proxies for docker description: no proxies for docker
kube_tag:
type: string
description: tag of the k8s containers used to provision the kubernetes cluster
kube_version: kube_version:
type: string type: string
description: version of kubernetes used for kubernetes cluster description: version of kubernetes used for kubernetes cluster
@ -269,6 +273,7 @@ resources:
$HTTP_PROXY: {get_param: http_proxy} $HTTP_PROXY: {get_param: http_proxy}
$HTTPS_PROXY: {get_param: https_proxy} $HTTPS_PROXY: {get_param: https_proxy}
$NO_PROXY: {get_param: no_proxy} $NO_PROXY: {get_param: no_proxy}
$KUBE_TAG: {get_param: kube_tag}
$KUBE_VERSION: {get_param: kube_version} $KUBE_VERSION: {get_param: kube_version}
$WAIT_CURL: {get_attr: [minion_wait_handle, curl_cli]} $WAIT_CURL: {get_attr: [minion_wait_handle, curl_cli]}
$TRUSTEE_USER_ID: {get_param: trustee_user_id} $TRUSTEE_USER_ID: {get_param: trustee_user_id}

View File

@ -316,6 +316,11 @@ parameters:
type: string type: string
description: url for keystone description: url for keystone
kube_tag:
type: string
description: tag of the k8s containers used to provision the kubernetes cluster
default: v1.7.4
kube_version: kube_version:
type: string type: string
description: version of kubernetes used for kubernetes cluster description: version of kubernetes used for kubernetes cluster
@ -477,6 +482,7 @@ resources:
http_proxy: {get_param: http_proxy} http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy} https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy} no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version} kube_version: {get_param: kube_version}
kube_dashboard_version: {get_param: kube_dashboard_version} kube_dashboard_version: {get_param: kube_dashboard_version}
trustee_user_id: {get_param: trustee_user_id} trustee_user_id: {get_param: trustee_user_id}
@ -560,6 +566,7 @@ resources:
http_proxy: {get_param: http_proxy} http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy} https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy} no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version} kube_version: {get_param: kube_version}
trustee_user_id: {get_param: trustee_user_id} trustee_user_id: {get_param: trustee_user_id}
trustee_username: {get_param: trustee_username} trustee_username: {get_param: trustee_username}

View File

@ -190,6 +190,10 @@ parameters:
type: string type: string
description: no proxies for docker description: no proxies for docker
kube_tag:
type: string
description: tag of the k8s containers used to provision the kubernetes cluster
kube_version: kube_version:
type: string type: string
description: version of kubernetes used for kubernetes cluster description: version of kubernetes used for kubernetes cluster
@ -286,6 +290,7 @@ resources:
"$HTTP_PROXY": {get_param: http_proxy} "$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy} "$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy} "$NO_PROXY": {get_param: no_proxy}
"$KUBE_TAG": {get_param: kube_tag}
"$KUBE_VERSION": {get_param: kube_version} "$KUBE_VERSION": {get_param: kube_version}
"$KUBE_DASHBOARD_VERSION": {get_param: kube_dashboard_version} "$KUBE_DASHBOARD_VERSION": {get_param: kube_dashboard_version}
"$WAIT_CURL": {get_param: wc_curl_cli} "$WAIT_CURL": {get_param: wc_curl_cli}

View File

@ -124,6 +124,10 @@ parameters:
type: string type: string
description: no proxies for docker description: no proxies for docker
kube_tag:
type: string
description: tag of the k8s containers used to provision the kubernetes cluster
kube_version: kube_version:
type: string type: string
description: version of kubernetes used for kubernetes cluster description: version of kubernetes used for kubernetes cluster
@ -207,6 +211,7 @@ resources:
$HTTP_PROXY: {get_param: http_proxy} $HTTP_PROXY: {get_param: http_proxy}
$HTTPS_PROXY: {get_param: https_proxy} $HTTPS_PROXY: {get_param: https_proxy}
$NO_PROXY: {get_param: no_proxy} $NO_PROXY: {get_param: no_proxy}
$KUBE_TAG: {get_param: kube_tag}
$KUBE_VERSION: {get_param: kube_version} $KUBE_VERSION: {get_param: kube_version}
$WAIT_CURL: {get_param: wc_curl_cli} $WAIT_CURL: {get_param: wc_curl_cli}
$TRUSTEE_DOMAIN_ID: {get_param: trustee_domain_id} $TRUSTEE_DOMAIN_ID: {get_param: trustee_domain_id}

View File

@ -270,6 +270,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
'docker_volume_type') 'docker_volume_type')
etcd_volume_size = mock_cluster_template.labels.get( etcd_volume_size = mock_cluster_template.labels.get(
'etcd_volume_size') 'etcd_volume_size')
kube_tag = mock_cluster_template.labels.get('kube_tag')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition() k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -293,7 +294,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
'username': 'fake_user', 'username': 'fake_user',
'tenant_name': 'fake_tenant', 'tenant_name': 'fake_tenant',
'magnum_url': mock_osc.magnum_url.return_value, 'magnum_url': mock_osc.magnum_url.return_value,
'region_name': mock_osc.cinder_region_name.return_value}} 'region_name': mock_osc.cinder_region_name.return_value,
'kube_tag': kube_tag}}
mock_get_params.assert_called_once_with(mock_context, mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template, mock_cluster_template,
mock_cluster, mock_cluster,
@ -350,6 +352,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
'docker_volume_type') 'docker_volume_type')
etcd_volume_size = mock_cluster_template.labels.get( etcd_volume_size = mock_cluster_template.labels.get(
'etcd_volume_size') 'etcd_volume_size')
kube_tag = mock_cluster_template.labels.get('kube_tag')
k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition() k8s_def = k8sa_tdef.AtomicK8sTemplateDefinition()
@ -375,7 +378,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseTemplateDefinitionTestCase):
'magnum_url': mock_osc.magnum_url.return_value, 'magnum_url': mock_osc.magnum_url.return_value,
'region_name': mock_osc.cinder_region_name.return_value, 'region_name': mock_osc.cinder_region_name.return_value,
'loadbalancing_protocol': 'HTTP', 'loadbalancing_protocol': 'HTTP',
'kubernetes_port': 8080}} 'kubernetes_port': 8080,
'kube_tag': kube_tag}}
mock_get_params.assert_called_once_with(mock_context, mock_get_params.assert_called_once_with(mock_context,
mock_cluster_template, mock_cluster_template,
mock_cluster, mock_cluster,