Merge pull request #635 from kubernetes-incubator/download_images

Download images as dependencies of roles
This commit is contained in:
Antoine Legrand 2016-11-22 14:53:12 +01:00 committed by GitHub
commit b60d5647a2
9 changed files with 87 additions and 17 deletions

View file

@ -0,0 +1,5 @@
---
dependencies:
- role: download
file: "{{ downloads.dnsmasq }}"
when: not skip_dnsmasq|default(false)

View file

@ -24,7 +24,6 @@ calico_version: v1.0.0-beta
calico_cni_version: v1.4.2 calico_cni_version: v1.4.2
weave_version: v1.6.1 weave_version: v1.6.1
flannel_version: v0.6.2 flannel_version: v0.6.2
flannel_server_helper_version: 0.1
pod_infra_version: 3.0 pod_infra_version: 3.0
# Download URL's # Download URL's
@ -40,8 +39,6 @@ etcd_checksum: "385afd518f93e3005510b7aaa04d38ee4a39f06f5152cd33bb86d4f0c94c7485
etcd_deployment_type: "docker" etcd_deployment_type: "docker"
etcd_image_repo: "quay.io/coreos/etcd" etcd_image_repo: "quay.io/coreos/etcd"
etcd_image_tag: "{{ etcd_version }}" etcd_image_tag: "{{ etcd_version }}"
flannel_server_helper_image_repo: "gcr.io/google_containers/flannel-server-helper"
flannel_server_helper_image_tag: "{{ flannel_server_helper_version }}"
flannel_image_repo: "quay.io/coreos/flannel" flannel_image_repo: "quay.io/coreos/flannel"
flannel_image_tag: "{{ flannel_version }}" flannel_image_tag: "{{ flannel_version }}"
calicoctl_image_repo: "calico/ctl" calicoctl_image_repo: "calico/ctl"
@ -52,10 +49,28 @@ calico_node_image_repo: "calico/node"
calico_node_image_tag: "{{ calico_version }}" calico_node_image_tag: "{{ calico_version }}"
calico_cni_image_repo: "calico/cni" calico_cni_image_repo: "calico/cni"
calico_cni_image_tag: "{{ calico_cni_version }}" calico_cni_image_tag: "{{ calico_cni_version }}"
calico_policy_image_repo: "calico/kube-policy-controller"
calico_policy_image_tag: latest
exechealthz_version: 1.1
exechealthz_image_repo: "gcr.io/google_containers/exechealthz-amd64"
exechealthz_image_tag: "{{ exechealthz_version }}"
hyperkube_image_repo: "quay.io/coreos/hyperkube" hyperkube_image_repo: "quay.io/coreos/hyperkube"
hyperkube_image_tag: "{{ kube_version }}_coreos.0" hyperkube_image_tag: "{{ kube_version }}_coreos.0"
pod_infra_image_repo: "gcr.io/google_containers/pause-amd64" pod_infra_image_repo: "gcr.io/google_containers/pause-amd64"
pod_infra_image_tag: "{{ pod_infra_version }}" pod_infra_image_tag: "{{ pod_infra_version }}"
nginx_image_repo: nginx
nginx_image_tag: 1.11.4-alpine
dnsmasq_version: 2.72
dnsmasq_image_repo: "andyshinn/dnsmasq"
dnsmasq_image_tag: "{{ dnsmasq_version }}"
kubednsmasq_version: 1.3
kubednsmasq_image_repo: "gcr.io/google_containers/kube-dnsmasq-amd64"
kubednsmasq_image_tag: "{{ kubednsmasq_version }}"
kubedns_version: 1.7
kubedns_image_repo: "gcr.io/google_containers/kubedns-amd64"
kubedns_image_tag: "{{ kubedns_version }}"
test_image_repo: busybox
test_image_tag: latest
downloads: downloads:
weave: weave:
@ -88,11 +103,6 @@ downloads:
repo: "{{ flannel_image_repo }}" repo: "{{ flannel_image_repo }}"
tag: "{{ flannel_image_tag }}" tag: "{{ flannel_image_tag }}"
enabled: "{{ kube_network_plugin == 'flannel' or kube_network_plugin == 'canal' }}" enabled: "{{ kube_network_plugin == 'flannel' or kube_network_plugin == 'canal' }}"
flannel_server_helper:
container: true
repo: "{{ flannel_server_helper_image_repo }}"
tag: "{{ flannel_server_helper_image_tag }}"
enabled: "{{ kube_network_plugin == 'flannel' or kube_network_plugin == 'canal' }}"
calicoctl: calicoctl:
container: true container: true
repo: "{{ calicoctl_image_repo }}" repo: "{{ calicoctl_image_repo }}"
@ -108,10 +118,39 @@ downloads:
repo: "{{ calico_cni_image_repo }}" repo: "{{ calico_cni_image_repo }}"
tag: "{{ calico_cni_image_tag }}" tag: "{{ calico_cni_image_tag }}"
enabled: "{{ kube_network_plugin == 'calico' or kube_network_plugin == 'canal' }}" enabled: "{{ kube_network_plugin == 'calico' or kube_network_plugin == 'canal' }}"
calico_policy:
container: true
repo: "{{ calico_policy_image_repo }}"
tag: "{{ calico_policy_image_tag }}"
enabled: "{{ kube_network_plugin == 'canal' }}"
pod_infra: pod_infra:
container: true container: true
repo: "{{ pod_infra_image_repo }}" repo: "{{ pod_infra_image_repo }}"
tag: "{{ pod_infra_image_tag }}" tag: "{{ pod_infra_image_tag }}"
nginx:
container: true
repo: "{{ nginx_image_repo }}"
tag: "{{ nginx_image_tag }}"
dnsmasq:
container: true
repo: "{{ dnsmasq_image_repo }}"
tag: "{{ dnsmasq_image_tag }}"
kubednsmasq:
container: true
repo: "{{ kubednsmasq_image_repo }}"
tag: "{{ kubednsmasq_image_tag }}"
kubedns:
container: true
repo: "{{ kubedns_image_repo }}"
tag: "{{ kubedns_image_tag }}"
testbox:
container: true
repo: "{{ test_image_repo }}"
tag: "{{ test_image_tag }}"
exechealthz:
container: true
repo: "{{ exechealthz_image_repo }}"
tag: "{{ exechealthz_image_tag }}"
download: download:
container: "{{ file.container|default('false') }}" container: "{{ file.container|default('false') }}"

View file

@ -10,6 +10,8 @@ kubednsmasq_image_repo: "gcr.io/google_containers/kube-dnsmasq-amd64"
kubednsmasq_image_tag: "{{ kubednsmasq_version }}" kubednsmasq_image_tag: "{{ kubednsmasq_version }}"
exechealthz_image_repo: "gcr.io/google_containers/exechealthz-amd64" exechealthz_image_repo: "gcr.io/google_containers/exechealthz-amd64"
exechealthz_image_tag: "{{ exechealthz_version }}" exechealthz_image_tag: "{{ exechealthz_version }}"
calico_policy_image_repo: "calico/kube-policy-controller"
calico_policy_image_tag: latest
# SSL # SSL
etcd_cert_dir: "/etc/ssl/etcd/ssl" etcd_cert_dir: "/etc/ssl/etcd/ssl"

View file

@ -23,7 +23,7 @@ spec:
hostNetwork: true hostNetwork: true
containers: containers:
- name: calico-policy-controller - name: calico-policy-controller
image: calico/kube-policy-controller:latest image: {{ calico_policy_image_repo }}:{{ calico_policy_image_tag }}
env: env:
- name: ETCD_ENDPOINTS - name: ETCD_ENDPOINTS
value: "{{ etcd_access_endpoint }}" value: "{{ etcd_access_endpoint }}"

View file

@ -5,3 +5,17 @@ dependencies:
- role: download - role: download
file: "{{ downloads.pod_infra }}" file: "{{ downloads.pod_infra }}"
- role: kubernetes/secrets - role: kubernetes/secrets
- role: download
file: "{{ downloads.nginx }}"
when: is_kube_master == false and loadbalancer_apiserver_localhost|default(false)
- role: download
file: "{{ downloads.testbox }}"
- role: download
file: "{{ downloads.kubednsmasq }}"
when: not skip_dnsmasq_k8s|default(false)
- role: download
file: "{{ downloads.kubedns }}"
when: not skip_dnsmasq_k8s|default(false)
- role: download
file: "{{ downloads.exechealthz }}"
when: not skip_dnsmasq_k8s|default(false)

View file

@ -1,7 +1,5 @@
--- ---
dependencies: dependencies:
- role: download
file: "{{ downloads.flannel_server_helper }}"
- role: download - role: download
file: "{{ downloads.flannel }}" file: "{{ downloads.flannel }}"
- role: download - role: download
@ -10,3 +8,5 @@ dependencies:
file: "{{ downloads.calicoctl }}" file: "{{ downloads.calicoctl }}"
- role: download - role: download
file: "{{ downloads.calico_cni }}" file: "{{ downloads.calico_cni }}"
- role: download
file: "{{ downloads.calico_policy }}"

View file

@ -1,6 +1,4 @@
--- ---
dependencies: dependencies:
- role: download
file: "{{ downloads.flannel_server_helper }}"
- role: download - role: download
file: "{{ downloads.flannel }}" file: "{{ downloads.flannel }}"

View file

@ -1,6 +1,6 @@
--- ---
- hosts: all - hosts: all
become: false become: true
gather_facts: no gather_facts: no
vars: vars:
@ -24,11 +24,13 @@
- name: errors_info - name: errors_info
cmd: journalctl -p err --no-pager cmd: journalctl -p err --no-pager
- name: etcd_info - name: etcd_info
cmd: etcdctl --debug cluster-health cmd: etcdctl --peers={{ etcd_access_addresses }} cluster-health
- name: weave_info - name: weave_info
cmd: weave report | jq "." cmd: weave report
- name: weave_logs - name: weave_logs
cmd: docker logs weave cmd: docker logs weave
- name: kube_describe_all
cmd: kubectl describe all --all-namespaces
- name: kubedns_logs - name: kubedns_logs
cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kubedns -o jsonpath={.items..metadata.name}`; cmd: "for i in `kubectl get pods --all-namespaces -l k8s-app=kubedns -o jsonpath={.items..metadata.name}`;
do kubectl logs ${i} --namespace kube-system kubedns; done" do kubectl logs ${i} --namespace kube-system kubedns; done"
@ -70,6 +72,12 @@
- /var/log/calico/confd/current - /var/log/calico/confd/current
tasks: tasks:
- set_fact:
etcd_access_addresses: |-
{% for item in groups['etcd'] -%}
https://{{ item }}:2379{% if not loop.last %},{% endif %}
{%- endfor %}
- name: Storing commands output - name: Storing commands output
shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}" shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}"
register: output register: output

View file

@ -1,6 +1,10 @@
--- ---
- hosts: node1 - hosts: node1
vars:
test_image_repo: busybox
test_image_tag: latest
tasks: tasks:
- name: Force binaries directory for CoreOS - name: Force binaries directory for CoreOS
@ -13,7 +17,7 @@
when: ansible_os_family != "CoreOS" when: ansible_os_family != "CoreOS"
- name: Run a replica controller composed of 2 pods - name: Run a replica controller composed of 2 pods
shell: "{{bin_dir}}/kubectl run test --image=busybox --replicas=2 --command -- tail -f /dev/null" shell: "{{bin_dir}}/kubectl run test --image={{test_image_repo}}:{{test_image_tag}} --replicas=2 --command -- tail -f /dev/null"
- name: Pods are running - name: Pods are running
shell: "{{bin_dir}}/kubectl get pods --no-headers -o json" shell: "{{bin_dir}}/kubectl get pods --no-headers -o json"