Add helm installation option as docker and host type

helm_deployment_type: docker

helm_deployment_type: host
This commit is contained in:
Seungkyu Ahn 2017-06-21 11:30:15 +09:00
parent 586d2a41ce
commit 62ef4db61b
5 changed files with 35 additions and 6 deletions

View file

@ -123,6 +123,7 @@ etcd_deployment_type: docker
kubelet_deployment_type: docker kubelet_deployment_type: docker
cert_management: script cert_management: script
vault_deployment_type: docker vault_deployment_type: docker
helm_deployment_type: docker
# K8s image pull policy (imagePullPolicy) # K8s image pull policy (imagePullPolicy)
k8s_image_pull_policy: IfNotPresent k8s_image_pull_policy: IfNotPresent

View file

@ -31,6 +31,7 @@ pod_infra_version: 3.0
# Download URL's # Download URL's
etcd_download_url: "https://storage.googleapis.com/kargo/{{etcd_version}}_etcd" etcd_download_url: "https://storage.googleapis.com/kargo/{{etcd_version}}_etcd"
helm_download_url: "https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get"
# Checksums # Checksums
etcd_checksum: "385afd518f93e3005510b7aaa04d38ee4a39f06f5152cd33bb86d4f0c94c7485" etcd_checksum: "385afd518f93e3005510b7aaa04d38ee4a39f06f5152cd33bb86d4f0c94c7485"
@ -92,7 +93,9 @@ kibana_version: "v4.6.1"
kibana_image_repo: "gcr.io/google_containers/kibana" kibana_image_repo: "gcr.io/google_containers/kibana"
kibana_image_tag: "{{ kibana_version }}" kibana_image_tag: "{{ kibana_version }}"
helm_version: "v2.2.2" helm_version: "v2.5.0"
# Possible values: host, docker
helm_deployment_type: "docker"
helm_image_repo: "lachlanevenson/k8s-helm" helm_image_repo: "lachlanevenson/k8s-helm"
helm_image_tag: "{{ helm_version }}" helm_image_tag: "{{ helm_version }}"
tiller_version: "{{ helm_version }}" tiller_version: "{{ helm_version }}"
@ -229,9 +232,16 @@ downloads:
tag: "{{ kibana_image_tag }}" tag: "{{ kibana_image_tag }}"
sha256: "{{ kibana_digest_checksum|default(None) }}" sha256: "{{ kibana_digest_checksum|default(None) }}"
helm: helm:
container: true container: >-
{%- if helm_deployment_type == 'docker' -%}true{%- else -%}false{%- endif -%}
repo: "{{ helm_image_repo }}" repo: "{{ helm_image_repo }}"
tag: "{{ helm_image_tag }}" tag: "{{ helm_image_tag }}"
version: "{{helm_version}}"
dest: "get_helm.sh"
source_url: "{{ helm_download_url }}"
url: "{{ helm_download_url }}"
owner: "root"
mode: "0755"
sha256: "{{ helm_digest_checksum|default(None) }}" sha256: "{{ helm_digest_checksum|default(None) }}"
tiller: tiller:
container: true container: true

View file

@ -109,6 +109,7 @@ etcd_deployment_type: docker
kubelet_deployment_type: docker kubelet_deployment_type: docker
cert_management: script cert_management: script
vault_deployment_type: docker vault_deployment_type: docker
helm_deployment_type: docker
# K8s image pull policy (imagePullPolicy) # K8s image pull policy (imagePullPolicy)
k8s_image_pull_policy: IfNotPresent k8s_image_pull_policy: IfNotPresent

View file

@ -2,18 +2,34 @@
- name: Helm | Make sure HELM_HOME directory exists - name: Helm | Make sure HELM_HOME directory exists
file: path={{ helm_home_dir }} state=directory file: path={{ helm_home_dir }} state=directory
- name: Helm | Set up helm launcher - name: Helm | Remove helm
file:
path: "{{ bin_dir }}/helm"
state: absent
- name: Helm | Set up docker helm launcher
template: template:
src: helm-container.j2 src: helm-container.j2
dest: "{{ bin_dir }}/helm" dest: "{{ bin_dir }}/helm"
owner: root owner: root
mode: 0755 mode: 0755
register: helm_container when: helm_deployment_type == "docker"
- name: Helm | Set up binary helm launcher
shell: "{{local_release_dir}}/{{downloads.helm.dest}} --version {{ helm_version }}"
when: helm_deployment_type == "host"
- name: Helm | Install/upgrade helm - name: Helm | Install/upgrade helm
command: "{{ bin_dir }}/helm init --upgrade --tiller-image={{ tiller_image_repo }}:{{ tiller_image_tag }}" command: "{{ bin_dir }}/helm init --upgrade --tiller-image={{ tiller_image_repo }}:{{ tiller_image_tag }}"
when: helm_container.changed when: inventory_hostname == groups['kube-master'][0]
- name: Helm | Set up bash completion
shell: "umask 022 && {{ bin_dir }}/helm completion >/etc/bash_completion.d/helm.sh"
when: ( not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
and helm_version < "v2.4.0" )
- name: Helm | Set up bash completion - name: Helm | Set up bash completion
shell: "umask 022 && {{ bin_dir }}/helm completion bash >/etc/bash_completion.d/helm.sh" shell: "umask 022 && {{ bin_dir }}/helm completion bash >/etc/bash_completion.d/helm.sh"
when: ( helm_container.changed and not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] ) when: ( not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
and helm_version >= "v2.4.0" )

View file

@ -9,3 +9,4 @@
{% endfor -%} {% endfor -%}
{{ helm_image_repo }}:{{ helm_image_tag}} \ {{ helm_image_repo }}:{{ helm_image_tag}} \
"$@" "$@"