change hyperkube repository

This commit is contained in:
Smana 2016-06-15 20:25:58 +02:00
parent a4396cfca0
commit 247a1a6e6e
6 changed files with 49 additions and 19 deletions

View file

@ -1,9 +1,14 @@
kube_version: kube_checksum:
v1.2.2:
kube_apiserver: eb1bfd8b877052cbd1991b8c429a1d06661f4cb019905e20e128174f724e16de
kubectl: 473e6924569fba30d4a50cecdc2cae5f31d97d1f662463e85b74a472105dcff4
kubelet: f16827dc7e7c82f0e215f0fc73eb01e2dfe91a2ec83f9cbcaf8d37c91b64fd3b
v1.2.3: v1.2.3:
kube_apiserver_checksum: ebaeeeb72cb29b358337b330617a96355ff2d08a5a523fc1a81beba36cc9d6f9 kube_apiserver_checksum: ebaeeeb72cb29b358337b330617a96355ff2d08a5a523fc1a81beba36cc9d6f9
kubectl_checksum: 394853edd409a721bcafe4f1360009ef9f845050719fe7d6fc7176f45cc92a8c kubectl_checksum: 394853edd409a721bcafe4f1360009ef9f845050719fe7d6fc7176f45cc92a8c
kubelet_checksum: 633bb41c51c5c0df0645dd60ba82b12eba39d009eb87bae9227de7d9a89c0797 kubelet_checksum: 633bb41c51c5c0df0645dd60ba82b12eba39d009eb87bae9227de7d9a89c0797
v1.2.4: v1.2.4:
kube_apiserver_checksum: 6ac99b36b02968459e026fcfc234207c66064b5e11816b69dd8fc234b2ffec1e kube_apiserver: 6ac99b36b02968459e026fcfc234207c66064b5e11816b69dd8fc234b2ffec1e
kubectl_checksum: dac61fbd506f7a17540feca691cd8a9d9d628d59661eebce788a50511f578897 kubectl: dac61fbd506f7a17540feca691cd8a9d9d628d59661eebce788a50511f578897
kubelet_checksum: 4adaf40592248eef6fd4fa126464915ea41e624a70dc77178089760ed235e341 kubelet: 4adaf40592248eef6fd4fa126464915ea41e624a70dc77178089760ed235e341
kube_version: v1.2.4

View file

@ -76,7 +76,7 @@ downloads:
kubernetes_kubelet: kubernetes_kubelet:
version: "{{kube_version}}" version: "{{kube_version}}"
dest: kubernetes/bin/kubelet dest: kubernetes/bin/kubelet
sha256: "{{kubelet_checksum}}" sha256: "{{kube_checksum.kubelet}}"
source_url: "{{ kubelet_download_url }}" source_url: "{{ kubelet_download_url }}"
url: "{{ kubelet_download_url }}" url: "{{ kubelet_download_url }}"
owner: "kube" owner: "kube"
@ -84,7 +84,7 @@ downloads:
kubernetes_kubectl: kubernetes_kubectl:
dest: kubernetes/bin/kubectl dest: kubernetes/bin/kubectl
version: "{{kube_version}}" version: "{{kube_version}}"
sha256: "{{kubectl_checksum}}" sha256: "{{kube_checksum.kubectl}}"
source_url: "{{ kubectl_download_url }}" source_url: "{{ kubectl_download_url }}"
url: "{{ kubectl_download_url }}" url: "{{ kubectl_download_url }}"
owner: "kube" owner: "kube"
@ -92,7 +92,7 @@ downloads:
kubernetes_apiserver: kubernetes_apiserver:
dest: kubernetes/bin/kube-apiserver dest: kubernetes/bin/kube-apiserver
version: "{{kube_version}}" version: "{{kube_version}}"
sha256: "{{kube_apiserver_checksum}}" sha256: "{{kube_checksum.kube_apiserver}}"
source_url: "{{ apiserver_download_url }}" source_url: "{{ apiserver_download_url }}"
url: "{{ apiserver_download_url }}" url: "{{ apiserver_download_url }}"
owner: "kube" owner: "kube"

View file

@ -31,7 +31,7 @@ dns_domain: "{{ cluster_name }}"
kube_proxy_mode: userspace kube_proxy_mode: userspace
hyperkube_image_repo: quay.io/smana/kubernetes-hyperkube hyperkube_image_repo: "quay.io/smana/kubernetes-hyperkube"
hyperkube_image_tag: "v1.2.4" hyperkube_image_tag: "v1.2.4"
# IP address of the DNS server. # IP address of the DNS server.

View file

@ -1,9 +1,14 @@
kube_version: kube_checksum:
v1.2.2:
kube_apiserver: eb1bfd8b877052cbd1991b8c429a1d06661f4cb019905e20e128174f724e16de
kubectl: 473e6924569fba30d4a50cecdc2cae5f31d97d1f662463e85b74a472105dcff4
kubelet: f16827dc7e7c82f0e215f0fc73eb01e2dfe91a2ec83f9cbcaf8d37c91b64fd3b
v1.2.3: v1.2.3:
kube_apiserver_checksum: ebaeeeb72cb29b358337b330617a96355ff2d08a5a523fc1a81beba36cc9d6f9 kube_apiserver_checksum: ebaeeeb72cb29b358337b330617a96355ff2d08a5a523fc1a81beba36cc9d6f9
kubectl_checksum: 394853edd409a721bcafe4f1360009ef9f845050719fe7d6fc7176f45cc92a8c kubectl_checksum: 394853edd409a721bcafe4f1360009ef9f845050719fe7d6fc7176f45cc92a8c
kubelet_checksum: 633bb41c51c5c0df0645dd60ba82b12eba39d009eb87bae9227de7d9a89c0797 kubelet_checksum: 633bb41c51c5c0df0645dd60ba82b12eba39d009eb87bae9227de7d9a89c0797
v1.2.4: v1.2.4:
kube_apiserver_checksum: 6ac99b36b02968459e026fcfc234207c66064b5e11816b69dd8fc234b2ffec1e kube_apiserver: 6ac99b36b02968459e026fcfc234207c66064b5e11816b69dd8fc234b2ffec1e
kubectl_checksum: dac61fbd506f7a17540feca691cd8a9d9d628d59661eebce788a50511f578897 kubectl: dac61fbd506f7a17540feca691cd8a9d9d628d59661eebce788a50511f578897
kubelet_checksum: 4adaf40592248eef6fd4fa126464915ea41e624a70dc77178089760ed235e341 kubelet: 4adaf40592248eef6fd4fa126464915ea41e624a70dc77178089760ed235e341
kube_version: v1.2.4

View file

@ -74,7 +74,7 @@ downloads:
- name: kubernetes-kubelet - name: kubernetes-kubelet
version: "{{kube_version}}" version: "{{kube_version}}"
dest: kubernetes/bin/kubelet dest: kubernetes/bin/kubelet
sha256: "{{kubelet_checksum}}" sha256: "{{kube_checksum.kubelet}}"
source_url: "{{ kube_download_url }}/kubelet" source_url: "{{ kube_download_url }}/kubelet"
url: "{{ kube_download_url }}/kubelet" url: "{{ kube_download_url }}/kubelet"
owner: "kube" owner: "kube"
@ -83,7 +83,7 @@ downloads:
- name: kubernetes-kubectl - name: kubernetes-kubectl
dest: kubernetes/bin/kubectl dest: kubernetes/bin/kubectl
version: "{{kube_version}}" version: "{{kube_version}}"
sha256: "{{kubectl_checksum}}" sha256: "{{kube_checksum.kubectl}}"
source_url: "{{ kube_download_url }}/kubectl" source_url: "{{ kube_download_url }}/kubectl"
url: "{{ kube_download_url }}/kubectl" url: "{{ kube_download_url }}/kubectl"
owner: "kube" owner: "kube"
@ -92,7 +92,7 @@ downloads:
- name: kubernetes-apiserver - name: kubernetes-apiserver
dest: kubernetes/bin/kube-apiserver dest: kubernetes/bin/kube-apiserver
version: "{{kube_version}}" version: "{{kube_version}}"
sha256: "{{kube_apiserver_checksum}}" sha256: "{{kube_checksum.kube_apiserver}}"
source_url: "{{ kube_download_url }}/kube-apiserver" source_url: "{{ kube_download_url }}/kube-apiserver"
url: "{{ kube_download_url }}/kube-apiserver" url: "{{ kube_download_url }}/kube-apiserver"
owner: "kube" owner: "kube"

View file

@ -15,11 +15,14 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Foobar. If not, see <http://www.gnu.org/licenses/>. # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
import os
import sys import sys
import hashlib import hashlib
import urllib2 import urllib2
import yaml import yaml
import argparse import argparse
import shutil
from re import sub
def get_remote_sha256_sum(url, max_file_size=100*1024*1024): def get_remote_sha256_sum(url, max_file_size=100*1024*1024):
@ -55,11 +58,22 @@ def get_kube_sha256(version, download_url, binaries):
for k in binaries: for k in binaries:
s = get_remote_sha256_sum(download_url + '/' + k) s = get_remote_sha256_sum(download_url + '/' + k)
kube_sha256[k] = s kube_sha256[k] = s
kube_sha256[k + '_checksum'] = kube_sha256.pop(k) kube_sha256['kube_apiserver'] = kube_sha256.pop('kube-apiserver')
kube_sha256['kube_apiserver_checksum'] = kube_sha256.pop('kube-apiserver_checksum')
return(kube_sha256) return(kube_sha256)
def file_sub(file, regex, string):
"Substitute string in a file"
shutil.move(file, file + '~')
f = open(file + '~', 'r')
data = f.read()
o = open(file, 'w')
o.write(sub(regex, string, data))
f.close()
o.close()
os.remove(file + '~')
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='change_k8s_version', prog='change_k8s_version',
@ -70,16 +84,22 @@ if __name__ == '__main__':
'-v', '--version', dest='kube_version', required=True, '-v', '--version', dest='kube_version', required=True,
help="kubernetes version" help="kubernetes version"
) )
parser.add_argument(
'-r', '--repository', dest='docker_repository', required=True,
help="hyperkube docker repository"
)
args = parser.parse_args() args = parser.parse_args()
file_sub('../roles/kubernetes/node/defaults/main.yml', r'.*hyperkube_image_repo.*', 'hyperkube_image_repo: "%s"' % args.docker_repository)
file_sub('../roles/kubernetes/node/defaults/main.yml', r'.*hyperkube_image_tag.*', 'hyperkube_image_tag: "%s"' % args.kube_version)
kube_binaries = ['kubelet', 'kubectl', 'kube-apiserver'] kube_binaries = ['kubelet', 'kubectl', 'kube-apiserver']
kargo_root = ".."
var_files = ['../roles/uploads/defaults/kube_versions.yml', '../roles/download/defaults/kube_versions.yml'] var_files = ['../roles/uploads/defaults/kube_versions.yml', '../roles/download/defaults/kube_versions.yml']
kube_download_url = "https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/amd64" % args.kube_version kube_download_url = "https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/amd64" % args.kube_version
new = get_kube_sha256(args.kube_version, kube_download_url, kube_binaries) new = get_kube_sha256(args.kube_version, kube_download_url, kube_binaries)
for f in var_files: for f in var_files:
current = read_vars(f) current = read_vars(f)
current['kube_version'][args.kube_version] = new current['kube_checksum'][args.kube_version] = new
with open(f, 'w') as out: with open(f, 'w') as out:
out.write(yaml.dump(current, indent=4, default_flow_style=False)) out.write(yaml.dump(current, indent=4, default_flow_style=False))