forked from nishanthvasudevan/kubernetes-distro-packages
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_kubernetes.sh
executable file
·219 lines (201 loc) · 10 KB
/
build_kubernetes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/bin/bash
K8S_VERSION=${K8S_VERSION:-1.1.2}
rm -rf kubernetes/source/kubernetes/v$K8S_VERSION
rm -f kubernetes/master/kubernetes-master-$K8S_VERSION-1.x86_64.rpm
rm -f kubernetes/master/kubernetes-node-$K8S_VERSION-1.x86_64.rpm
rm -f kubernetes/master/kubernetes-master_$K8S_VERSION_amd64.deb
rm -f kubernetes/master/kubernetes-node_$K8S_VERSION_amd64.deb
mkdir -p kubernetes/source/kubernetes/v$K8S_VERSION
cd kubernetes/source/kubernetes/v$K8S_VERSION
curl -L https://storage.googleapis.com/kubernetes-release/release/v$K8S_VERSION/kubernetes.tar.gz | tar xvz
# Nightly
# https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v$K8S_VERSION/kubernetes.tar.gz
tar xfvz kubernetes/server/kubernetes-server-linux-amd64.tar.gz
cd ../../../../
#build_deb_master
# deb
# /etc/init.d/
# --deb-init FILEPATH (deb only) Add FILEPATH as an init script
# --deb-default FILEPATH (deb only) Add FILEPATH as /etc/default configuration
# --deb-upstart FILEPATH (deb only) Add FILEPATH as an upstart script
fpm -s dir -n "kubernetes-master" \
-p kubernetes/builds \
-C ./kubernetes/master -v $K8S_VERSION \
-t deb \
-a amd64 \
-d "dpkg (>= 1.17)" \
--after-install kubernetes/master/scripts/deb/after-install.sh \
--before-install kubernetes/master/scripts/deb/before-install.sh \
--after-remove kubernetes/master/scripts/deb/after-remove.sh \
--before-remove kubernetes/master/scripts/deb/before-remove.sh \
--deb-init kubernetes/master/services/initd/kube-apiserver \
--deb-init kubernetes/master/services/initd/kube-controller-manager \
--deb-init kubernetes/master/services/initd/kube-scheduler \
--deb-init kubernetes/master/services/initd/kubelet \
--deb-default kubernetes/master/initd_config/kube-apiserver \
--deb-default kubernetes/master/initd_config/kube-controller-manager \
--deb-default kubernetes/master/initd_config/kube-scheduler \
--deb-default kubernetes/master/initd_config/kubelet \
--license "Apache Software License 2.0" \
--maintainer "Kismatic, Inc. <[email protected]>" \
--vendor "Kismatic, Inc." \
--description "Kubernetes master binaries and services" \
--url "https://www.kismatic.com" \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-apiserver=/usr/bin/kube-apiserver \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-controller-manager=/usr/bin/kube-controller-manager \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-scheduler=/usr/bin/kube-scheduler \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubectl=/usr/bin/kubectl \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubelet=/usr/bin/kubelet \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/hyperkube=/usr/bin/hyperkube \
etc/kubernetes/manifests
# systemd version
fpm -s dir -n "kubernetes-master" \
-p kubernetes/builds/systemd \
-C ./kubernetes/master -v "$K8S_VERSION~systemd" \
-t deb \
-a amd64 \
-d "dpkg (>= 1.17)" \
--after-install kubernetes/master/scripts/deb/systemd/after-install.sh \
--before-install kubernetes/master/scripts/deb/systemd/before-install.sh \
--after-remove kubernetes/master/scripts/deb/systemd/after-remove.sh \
--before-remove kubernetes/master/scripts/deb/systemd/before-remove.sh \
--license "Apache Software License 2.0" \
--maintainer "Kismatic, Inc. <[email protected]>" \
--vendor "Kismatic, Inc." \
--description "Kubernetes master binaries and services" \
--url "https://www.kismatic.com" \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-apiserver=/usr/bin/kube-apiserver \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-controller-manager=/usr/bin/kube-controller-manager \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-scheduler=/usr/bin/kube-scheduler \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubectl=/usr/bin/kubectl \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubelet=/usr/bin/kubelet \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/hyperkube=/usr/bin/hyperkube \
services/systemd/kube-apiserver.service=/lib/systemd/system/kube-apiserver.service \
services/systemd/kube-controller-manager.service=/lib/systemd/system/kube-controller-manager.service \
services/systemd/kube-scheduler.service=/lib/systemd/system/kube-scheduler.service \
services/systemd/kubelet.service=/lib/systemd/system/kubelet.service \
etc/kubernetes/master/kubelet.conf \
etc/kubernetes/master/apiserver.conf \
etc/kubernetes/master/config.conf \
etc/kubernetes/master/controller-manager.conf \
etc/kubernetes/master/scheduler.conf \
etc/kubernetes/manifests
# post launch script for addons
# skydns enable
# Kubernetes installs do not configure the nodes' resolv.conf files to use the cluster DNS by default, because that process is inherently environment-specific.
# This should probably be implemented eventually.
#build_deb_node
# services
# deps etcd, docker (etcd.service, docker.service)
# kube-proxy.service
# kube-kubelet.service
# cadvisor.service?
# TODO later
# /var/lib/kubelet/kubernetes_auth
# {"BearerToken": "SF839TwEqeyO2mwbOtQMZFJ8nQIu7asb", "Insecure": true }
fpm -s dir -n "kubernetes-node" \
-p kubernetes/builds \
-C ./kubernetes/node -v $K8S_VERSION \
-t deb \
-a amd64 \
-d "dpkg (>= 1.17)" \
--after-install kubernetes/node/scripts/deb/after-install.sh \
--before-install kubernetes/node/scripts/deb/before-install.sh \
--after-remove kubernetes/node/scripts/deb/after-remove.sh \
--before-remove kubernetes/node/scripts/deb/before-remove.sh \
--deb-default kubernetes/node/initd_config/kubelet \
--deb-default kubernetes/node/initd_config/kube-proxy \
--deb-init kubernetes/node/services/initd/kubelet \
--deb-init kubernetes/node/services/initd/kube-proxy \
--license "Apache Software License 2.0" \
--maintainer "Kismatic, Inc. <[email protected]>" \
--vendor "Kismatic, Inc." \
--description "Kubernetes node binaries and services" \
--url "https://www.kismatic.com" \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubelet=/usr/bin/kubelet \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-proxy=/usr/bin/kube-proxy \
etc/kubernetes/manifests
# systemd version
fpm -s dir -n "kubernetes-node" \
-p kubernetes/builds/systemd \
-C ./kubernetes/node -v "$K8S_VERSION~systemd" \
-t deb \
-a amd64 \
-d "dpkg (>= 1.17)" \
--after-install kubernetes/node/scripts/deb/systemd/after-install.sh \
--before-install kubernetes/node/scripts/deb/systemd/before-install.sh \
--after-remove kubernetes/node/scripts/deb/systemd/after-remove.sh \
--before-remove kubernetes/node/scripts/deb/systemd/before-remove.sh \
--config-files etc/kubernetes/node \
--license "Apache Software License 2.0" \
--maintainer "Kismatic, Inc. <[email protected]>" \
--vendor "Kismatic, Inc." \
--description "Kubernetes node binaries and services" \
--url "https://www.kismatic.com" \
etc/kubernetes/node/config.conf \
etc/kubernetes/node/kubelet.conf \
etc/kubernetes/node/kube-proxy.conf \
services/systemd/kubelet.service=/lib/systemd/system/kubelet.service \
services/systemd/kube-proxy.service=/lib/systemd/system/kube-proxy.service \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubelet=/usr/bin/kubelet \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-proxy=/usr/bin/kube-proxy \
etc/kubernetes/manifests
# build_rpm_master
# rpm
# /lib/systemd/system
fpm -s dir -n "kubernetes-master" \
-p kubernetes/builds \
-C ./kubernetes/master -v $K8S_VERSION \
-d 'docker >= 1.3.0' \
-t rpm --rpm-os linux \
-a x86_64 \
--after-install kubernetes/master/scripts/rpm/after-install.sh \
--before-install kubernetes/master/scripts/rpm/before-install.sh \
--after-remove kubernetes/master/scripts/rpm/after-remove.sh \
--before-remove kubernetes/master/scripts/rpm/before-remove.sh \
--config-files etc/kubernetes/master \
--license "Apache Software License 2.0" \
--maintainer "Kismatic, Inc. <[email protected]>" \
--vendor "Kismatic, Inc." \
--description "Kubernetes master binaries and services" \
--url "https://www.kismatic.com" \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-apiserver=/usr/bin/kube-apiserver \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-controller-manager=/usr/bin/kube-controller-manager \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-scheduler=/usr/bin/kube-scheduler \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubectl=/usr/bin/kubectl \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubelet=/usr/bin/kubelet \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/hyperkube=/usr/bin/hyperkube \
services/systemd/kube-apiserver.service=/lib/systemd/system/kube-apiserver.service \
services/systemd/kube-controller-manager.service=/lib/systemd/system/kube-controller-manager.service \
services/systemd/kube-scheduler.service=/lib/systemd/system/kube-scheduler.service \
services/systemd/kubelet.service=/lib/systemd/system/kubelet.service \
etc/kubernetes/master/kubelet.conf \
etc/kubernetes/master/apiserver.conf \
etc/kubernetes/master/config.conf \
etc/kubernetes/master/controller-manager.conf \
etc/kubernetes/master/scheduler.conf \
etc/kubernetes/manifests
fpm -s dir -n "kubernetes-node" \
-p kubernetes/builds \
-C ./kubernetes/node -v $K8S_VERSION \
-d 'docker >= 1.3.0' \
-a x86_64 \
-t rpm --rpm-os linux \
--after-install kubernetes/node/scripts/rpm/after-install.sh \
--before-install kubernetes/node/scripts/rpm/before-install.sh \
--after-remove kubernetes/node/scripts/rpm/after-remove.sh \
--before-remove kubernetes/node/scripts/rpm/before-remove.sh \
--config-files etc/kubernetes/node \
--license "Apache Software License 2.0" \
--maintainer "Kismatic, Inc. <[email protected]>" \
--vendor "Kismatic, Inc." \
--description "Kubernetes node binaries and services" \
--url "https://www.kismatic.com" \
etc/kubernetes/node/config.conf \
etc/kubernetes/node/kubelet.conf \
etc/kubernetes/node/kube-proxy.conf \
services/systemd/kubelet.service=/lib/systemd/system/kubelet.service \
services/systemd/kube-proxy.service=/lib/systemd/system/kube-proxy.service \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kubelet=/usr/bin/kubelet \
../source/kubernetes/v$K8S_VERSION/kubernetes/server/bin/kube-proxy=/usr/bin/kube-proxy \
etc/kubernetes/manifests