Browse Source

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
changes/40/491740/8
Mathieu Velten 4 years ago
parent
commit
46255dd4b1
  1. 10
      magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh
  2. 4
      magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh
  3. 1
      magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml
  4. 1
      magnum/drivers/common/templates/kubernetes/fragments/write-heat-params.yaml
  5. 4
      magnum/drivers/heat/k8s_fedora_template_def.py
  6. 7
      magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml
  7. 5
      magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml
  8. 5
      magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml
  9. 7
      magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml
  10. 5
      magnum/drivers/k8s_fedora_ironic_v1/templates/kubemaster.yaml
  11. 5
      magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion_software_configs.yaml
  12. 8
      magnum/tests/unit/drivers/test_template_definition.py

10
magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh

@ -4,11 +4,11 @@
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=kube-proxy docker.io/openstackmagnum/kubernetes-proxy:${KUBE_VERSION}
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-controller-manager docker.io/openstackmagnum/kubernetes-controller-manager:${KUBE_VERSION}
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=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_TAG}
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_TAG}
atomic install --storage ostree --system --system-package=no --name=kube-scheduler docker.io/openstackmagnum/kubernetes-scheduler:${KUBE_TAG}
sed -i '
/^KUBE_ALLOW_PRIV=/ s/=.*/="--allow-privileged='"$KUBE_ALLOW_PRIV"'"/

4
magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh

@ -4,8 +4,8 @@
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=kube-proxy docker.io/openstackmagnum/kubernetes-proxy:${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_TAG}
CERT_DIR=/etc/kubernetes/certs
PROTOCOL=https

1
magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml

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

1
magnum/drivers/common/templates/kubernetes/fragments/write-heat-params.yaml

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

4
magnum/drivers/heat/k8s_fedora_template_def.py

@ -79,6 +79,10 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'docker_volume_type', CONF.cinder.default_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,
self).get_params(context, cluster_template, cluster,
extra_params=extra_params,

7
magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml

@ -313,6 +313,11 @@ parameters:
type: string
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:
type: string
description: version of kubernetes used for kubernetes cluster
@ -504,6 +509,7 @@ resources:
http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version}
kube_dashboard_version: {get_param: kube_dashboard_version}
trustee_user_id: {get_param: trustee_user_id}
@ -567,6 +573,7 @@ resources:
http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version}
trustee_user_id: {get_param: trustee_user_id}
trustee_username: {get_param: trustee_username}

5
magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml

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

5
magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml

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

7
magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml

@ -316,6 +316,11 @@ parameters:
type: string
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:
type: string
description: version of kubernetes used for kubernetes cluster
@ -477,6 +482,7 @@ resources:
http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version}
kube_dashboard_version: {get_param: kube_dashboard_version}
trustee_user_id: {get_param: trustee_user_id}
@ -560,6 +566,7 @@ resources:
http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy}
kube_tag: {get_param: kube_tag}
kube_version: {get_param: kube_version}
trustee_user_id: {get_param: trustee_user_id}
trustee_username: {get_param: trustee_username}

5
magnum/drivers/k8s_fedora_ironic_v1/templates/kubemaster.yaml

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

5
magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion_software_configs.yaml

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

8
magnum/tests/unit/drivers/test_template_definition.py

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

Loading…
Cancel
Save