Use variables for hyperkube and kube version

Introduce HYPERKUBE_IMAGE_REPO variable which is set to CoreOS
hyperkube by default. Also remove "_coreos.0" from script as it can be a
different build number. This number should be included in the kubernetes
version parameters and not in scripts.

With this, it is possible to use any combination of hyperkube image with
any tags. by default we use the CoreOS one.

Partially-Implements: blueprint support-insecure-registry
Partially-Implements: blueprint coreos-best-pratice
Change-Id: Ie0fbed4b160fa972cfe130c252e87765690e2f5f
This commit is contained in:
Kevin Lefevre 2017-01-31 15:25:58 +01:00 committed by ArchiFleKs
parent faed9a18ed
commit 8b3ebbe8bf
12 changed files with 32 additions and 8 deletions

View File

@ -48,7 +48,7 @@ write_files:
hostNetwork: true
containers:
- name: kube-apiserver
image: gcr.io/google_containers/hyperkube:${KUBE_VERSION}
image: ${HYPERKUBE_IMAGE_REPO}:${KUBE_VERSION}
command:
- /hyperkube
- apiserver

View File

@ -43,7 +43,7 @@ write_files:
hostNetwork: true
containers:
- name: kube-controller-manager
image: gcr.io/google_containers/hyperkube:${KUBE_VERSION}
image: ${HYPERKUBE_IMAGE_REPO}:${KUBE_VERSION}
command:
- /hyperkube
- controller-manager

View File

@ -33,7 +33,7 @@ write_files:
hostNetwork: true
containers:
- name: kube-proxy
image: gcr.io/google_containers/hyperkube:${KUBE_VERSION}
image: ${HYPERKUBE_IMAGE_REPO}:${KUBE_VERSION}
command:
- /hyperkube
- proxy

View File

@ -42,7 +42,7 @@ write_files:
hostNetwork: true
containers:
- name: kube-proxy
image: gcr.io/google_containers/hyperkube:${KUBE_VERSION}
image: ${HYPERKUBE_IMAGE_REPO}:${KUBE_VERSION}
command:
- /hyperkube
- proxy

View File

@ -34,7 +34,7 @@ write_files:
hostNetwork: true
containers:
- name: kube-scheduler
image: gcr.io/google_containers/hyperkube:${KUBE_VERSION}
image: ${HYPERKUBE_IMAGE_REPO}:${KUBE_VERSION}
command:
- /hyperkube
- scheduler

View File

@ -28,7 +28,8 @@ write_files:
CONF_FILE=/etc/systemd/system/kubelet.service
cat > $CONF_FILE <<EOF
[Service]
Environment=KUBELET_VERSION=${KUBE_VERSION}_coreos.0
Environment=KUBELET_VERSION=${KUBE_VERSION}
Environment=KUBELET_ACI=${HYPERKUBE_IMAGE_REPO}
ExecStart=/usr/lib/coreos/kubelet-wrapper \
--api-servers=http://127.0.0.1:8080 \
--address=0.0.0.0 \

View File

@ -40,7 +40,8 @@ write_files:
CONF_FILE=/etc/systemd/system/kubelet.service
cat > $CONF_FILE <<EOF
[Service]
Environment=KUBELET_VERSION=${KUBE_VERSION}_coreos.0
Environment=KUBELET_VERSION=${KUBE_VERSION}
Environment=KUBELET_ACI=${HYPERKUBE_IMAGE_REPO}
ExecStart=/usr/lib/coreos/kubelet-wrapper \
--api-servers=${KUBE_MASTER_URI} \
--address=0.0.0.0 \

View File

@ -41,3 +41,4 @@ write_files:
SYSTEM_PODS_TIMEOUT="$SYSTEM_PODS_TIMEOUT"
KUBE_CERTS_PATH="$KUBE_CERTS_PATH"
HOST_CERTS_PATH="$HOST_CERTS_PATH"
HYPERKUBE_IMAGE_REPO="$HYPERKUBE_IMAGE_REPO"

View File

@ -42,3 +42,4 @@ write_files:
INSECURE_REGISTRY_URL="$INSECURE_REGISTRY_URL"
KUBE_CERTS_PATH="$KUBE_CERTS_PATH"
HOST_CERTS_PATH="$HOST_CERTS_PATH"
HYPERKUBE_IMAGE_REPO="$HYPERKUBE_IMAGE_REPO"

View File

@ -211,7 +211,13 @@ parameters:
kube_version:
type: string
description: version of kubernetes used for kubernetes cluster
default: v1.2.0
default: v1.5.2_coreos.1
hyperkube_image_repo:
type: string
description: >
Docker registry used for hyperkube image
default: quay.io/coreos/hyperkube
registry_enabled:
type: boolean
@ -384,6 +390,7 @@ resources:
trustee_password: {get_param: trustee_password}
trust_id: {get_param: trust_id}
auth_url: {get_param: auth_url}
hyperkube_image_repo: {get_param: hyperkube_image_repo}
######################################################################
#
@ -427,6 +434,7 @@ resources:
trustee_password: {get_param: trustee_password}
trust_id: {get_param: trust_id}
auth_url: {get_param: auth_url}
hyperkube_image_repo: {get_param: hyperkube_image_repo}
outputs:

View File

@ -113,6 +113,11 @@ parameters:
type: string
description: version of kubernetes used for kubernetes cluster
hyperkube_image_repo:
type: string
description: >
Docker registry used for hyperkube image
cluster_uuid:
type: string
description: identifier for the cluster this template is generating
@ -234,6 +239,7 @@ resources:
"$AUTH_URL": {get_param: auth_url}
"$KUBE_CERTS_PATH": "/etc/kubernetes/ssl"
"$HOST_CERTS_PATH": "/usr/share/ca-certificates"
"$HYPERKUBE_IMAGE_REPO": {get_param: hyperkube_image_repo}
configure_etcd:
type: OS::Heat::SoftwareConfig

View File

@ -57,6 +57,11 @@ parameters:
type: string
description: version of kubernetes used for kubernetes cluster
hyperkube_image_repo:
type: string
description: >
Docker registry used for hyperkube image
kube_master_ip:
type: string
description: IP address of the Kubernetes master server.
@ -166,6 +171,7 @@ resources:
"$AUTH_URL": {get_param: auth_url}
"$KUBE_CERTS_PATH": "/etc/kubernetes/ssl"
"$HOST_CERTS_PATH": "/usr/share/ca-certificates"
"$HYPERKUBE_IMAGE_REPO": {get_param: hyperkube_image_repo}
write_kubeconfig:
type: OS::Heat::SoftwareConfig