porkadot 0.1.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/porkadot/assets.rb +24 -0
  3. data/lib/porkadot/assets/bootstrap.rb +2 -2
  4. data/lib/porkadot/assets/etcd.rb +4 -1
  5. data/lib/porkadot/assets/etcd/etcd-server.yaml.erb +2 -0
  6. data/lib/porkadot/assets/kubelet.rb +3 -0
  7. data/lib/porkadot/assets/kubelet/config.yaml.erb +2 -0
  8. data/lib/porkadot/assets/kubelet/install-deps.sh.erb +21 -3
  9. data/lib/porkadot/assets/kubelet/install-pkgs.sh.erb +9 -1
  10. data/lib/porkadot/assets/kubernetes.rb +9 -0
  11. data/lib/porkadot/assets/kubernetes/manifests/coredns.yaml.erb +202 -0
  12. data/lib/porkadot/assets/kubernetes/manifests/dns-horizontal-autoscaler.yaml.erb +110 -0
  13. data/lib/porkadot/assets/kubernetes/manifests/flannel.yaml.erb +10 -10
  14. data/lib/porkadot/assets/kubernetes/manifests/kube-apiserver.secrets.yaml.erb +37 -0
  15. data/lib/porkadot/assets/kubernetes/manifests/kube-apiserver.yaml.erb +0 -36
  16. data/lib/porkadot/assets/kubernetes/manifests/kube-controller-manager.secrets.yaml.erb +16 -0
  17. data/lib/porkadot/assets/kubernetes/manifests/kube-controller-manager.yaml.erb +0 -15
  18. data/lib/porkadot/assets/kubernetes/manifests/kube-scheduler.yaml.erb +1 -1
  19. data/lib/porkadot/assets/kubernetes/manifests/kubelet-rubber-stamp.yaml.erb +11 -2
  20. data/lib/porkadot/assets/kubernetes/manifests/metallb.secrets.yaml.erb +13 -0
  21. data/lib/porkadot/assets/kubernetes/manifests/metallb.yaml.erb +116 -26
  22. data/lib/porkadot/assets/kubernetes/manifests/pod-checkpointer.yaml.erb +1 -1
  23. data/lib/porkadot/assets/kubernetes/manifests/porkadot.yaml.erb +23 -1
  24. data/lib/porkadot/assets/kubernetes/manifests/storage-version-migrator.yaml.erb +327 -0
  25. data/lib/porkadot/config.rb +8 -0
  26. data/lib/porkadot/configs/bootstrap.rb +13 -1
  27. data/lib/porkadot/configs/certs.rb +1 -1
  28. data/lib/porkadot/configs/certs/k8s.rb +6 -0
  29. data/lib/porkadot/configs/etcd.rb +7 -3
  30. data/lib/porkadot/configs/kubelet.rb +9 -1
  31. data/lib/porkadot/configs/kubernetes.rb +9 -0
  32. data/lib/porkadot/default.yaml +3 -2
  33. data/lib/porkadot/install/bootstrap.rb +7 -0
  34. data/lib/porkadot/install/kubelet.rb +4 -0
  35. data/lib/porkadot/install/kubernetes.rb +4 -0
  36. data/lib/porkadot/version.rb +1 -1
  37. metadata +8 -2
@@ -78,7 +78,7 @@ spec:
78
78
  spec:
79
79
  containers:
80
80
  - name: pod-checkpointer
81
- image: quay.io/coreos/pod-checkpointer:83e25e5968391b9eb342042c435d1b3eeddb2be1
81
+ image: yuanying/pod-checkpointer:v0.18.0
82
82
  command:
83
83
  - /checkpoint
84
84
  - --lock-file=/var/run/lock/pod-checkpointer.lock
@@ -36,7 +36,6 @@ spec:
36
36
  <%= k.to_s %>: <%= v %>
37
37
  <%- end -%>
38
38
  <%- _, port = global_config.k8s.control_plane_endpoint_host_and_port -%>
39
- loadBalancerIP: <%= host %>
40
39
  ports:
41
40
  - name: https
42
41
  port: <%= port %>
@@ -67,3 +66,26 @@ data:
67
66
  - context:
68
67
  cluster: local
69
68
  user: service-account
69
+ ---
70
+ apiVersion: v1
71
+ kind: ConfigMap
72
+ metadata:
73
+ name: kubeconfig-in-cluster-latest
74
+ namespace: kube-system
75
+ data:
76
+ kubeconfig: |
77
+ apiVersion: v1
78
+ clusters:
79
+ - name: local
80
+ cluster:
81
+ server: https://porkadot-kubernetes-latest:<%= port %>
82
+ certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
83
+ users:
84
+ - name: service-account
85
+ user:
86
+ # Use service account token
87
+ tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
88
+ contexts:
89
+ - context:
90
+ cluster: local
91
+ user: service-account
@@ -0,0 +1,327 @@
1
+ apiVersion: apiextensions.k8s.io/v1beta1
2
+ kind: CustomResourceDefinition
3
+ metadata:
4
+ name: storageversionmigrations.migration.k8s.io
5
+ spec:
6
+ group: migration.k8s.io
7
+ names:
8
+ kind: StorageVersionMigration
9
+ listKind: StorageVersionMigrationList
10
+ plural: storageversionmigrations
11
+ singular: storageversionmigration
12
+ scope: Cluster
13
+ subresources:
14
+ status: {}
15
+ version: v1alpha1
16
+ versions:
17
+ - name: v1alpha1
18
+ served: true
19
+ storage: true
20
+ "validation":
21
+ "openAPIV3Schema":
22
+ description: StorageVersionMigration represents a migration of stored data to
23
+ the latest storage version.
24
+ type: object
25
+ properties:
26
+ apiVersion:
27
+ description: 'APIVersion defines the versioned schema of this representation
28
+ of an object. Servers should convert recognized schemas to the latest
29
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
30
+ type: string
31
+ kind:
32
+ description: 'Kind is a string value representing the REST resource this
33
+ object represents. Servers may infer this from the endpoint the client
34
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
35
+ type: string
36
+ metadata:
37
+ type: object
38
+ spec:
39
+ description: Specification of the migration.
40
+ type: object
41
+ required:
42
+ - resource
43
+ properties:
44
+ continueToken:
45
+ description: The token used in the list options to get the next chunk
46
+ of objects to migrate. When the .status.conditions indicates the migration
47
+ is "Running", users can use this token to check the progress of the
48
+ migration.
49
+ type: string
50
+ resource:
51
+ description: The resource that is being migrated. The migrator sends
52
+ requests to the endpoint serving the resource. Immutable.
53
+ type: object
54
+ properties:
55
+ group:
56
+ description: The name of the group.
57
+ type: string
58
+ resource:
59
+ description: The name of the resource.
60
+ type: string
61
+ version:
62
+ description: The name of the version.
63
+ type: string
64
+ status:
65
+ description: Status of the migration.
66
+ type: object
67
+ properties:
68
+ conditions:
69
+ description: The latest available observations of the migration's current
70
+ state.
71
+ type: array
72
+ items:
73
+ description: Describes the state of a migration at a certain point.
74
+ type: object
75
+ required:
76
+ - status
77
+ - type
78
+ properties:
79
+ lastUpdateTime:
80
+ description: The last time this condition was updated.
81
+ type: string
82
+ format: date-time
83
+ message:
84
+ description: A human readable message indicating details about
85
+ the transition.
86
+ type: string
87
+ reason:
88
+ description: The reason for the condition's last transition.
89
+ type: string
90
+ status:
91
+ description: Status of the condition, one of True, False, Unknown.
92
+ type: string
93
+ type:
94
+ description: Type of the condition.
95
+ type: string
96
+ ---
97
+ apiVersion: apiextensions.k8s.io/v1beta1
98
+ kind: CustomResourceDefinition
99
+ metadata:
100
+ name: storagestates.migration.k8s.io
101
+ spec:
102
+ group: migration.k8s.io
103
+ names:
104
+ kind: StorageState
105
+ listKind: StorageStateList
106
+ plural: storagestates
107
+ singular: storagestate
108
+ scope: Cluster
109
+ subresources:
110
+ status: {}
111
+ version: v1alpha1
112
+ versions:
113
+ - name: v1alpha1
114
+ served: true
115
+ storage: true
116
+ "validation":
117
+ "openAPIV3Schema":
118
+ description: The state of the storage of a specific resource.
119
+ type: object
120
+ properties:
121
+ apiVersion:
122
+ description: 'APIVersion defines the versioned schema of this representation
123
+ of an object. Servers should convert recognized schemas to the latest
124
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
125
+ type: string
126
+ kind:
127
+ description: 'Kind is a string value representing the REST resource this
128
+ object represents. Servers may infer this from the endpoint the client
129
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
130
+ type: string
131
+ metadata:
132
+ description: The name must be "<.spec.resource.resouce>.<.spec.resource.group>".
133
+ type: object
134
+ spec:
135
+ description: Specification of the storage state.
136
+ type: object
137
+ properties:
138
+ resource:
139
+ description: The resource this storageState is about.
140
+ type: object
141
+ properties:
142
+ group:
143
+ description: The name of the group.
144
+ type: string
145
+ resource:
146
+ description: The name of the resource.
147
+ type: string
148
+ status:
149
+ description: Status of the storage state.
150
+ type: object
151
+ properties:
152
+ currentStorageVersionHash:
153
+ description: The hash value of the current storage version, as shown
154
+ in the discovery document served by the API server. Storage Version
155
+ is the version to which objects are converted to before persisted.
156
+ type: string
157
+ lastHeartbeatTime:
158
+ description: LastHeartbeatTime is the last time the storage migration
159
+ triggering controller checks the storage version hash of this resource
160
+ in the discovery document and updates this field.
161
+ type: string
162
+ format: date-time
163
+ persistedStorageVersionHashes:
164
+ description: The hash values of storage versions that persisted instances
165
+ of spec.resource might still be encoded in. "Unknown" is a valid value
166
+ in the list, and is the default value. It is not safe to upgrade or
167
+ downgrade to an apiserver binary that does not support all versions
168
+ listed in this field, or if "Unknown" is listed. Once the storage
169
+ version migration for this resource has completed, the value of this
170
+ field is refined to only contain the currentStorageVersionHash. Once
171
+ the apiserver has changed the storage version, the new storage version
172
+ is appended to the list.
173
+ type: array
174
+ items:
175
+ type: string
176
+ ---
177
+ apiVersion: v1
178
+ kind: Namespace
179
+ metadata:
180
+ name: kube-system
181
+ ---
182
+ kind: ClusterRole
183
+ apiVersion: rbac.authorization.k8s.io/v1
184
+ metadata:
185
+ name: storage-version-migration-trigger
186
+ rules:
187
+ - apiGroups: ["migration.k8s.io"]
188
+ resources: ["storagestates"]
189
+ verbs: ["watch", "get", "list", "delete", "create", "update"]
190
+ - apiGroups: ["migration.k8s.io"]
191
+ resources: ["storageversionmigrations"]
192
+ verbs: ["watch", "get", "list", "delete", "create"]
193
+ ---
194
+ kind: ClusterRole
195
+ apiVersion: rbac.authorization.k8s.io/v1
196
+ metadata:
197
+ name: storage-version-migration-crd-creator
198
+ rules:
199
+ - apiGroups: ["apiextensions.k8s.io"]
200
+ resources: ["customresourcedefinitions"]
201
+ verbs: ["create", "delete", "get"]
202
+ ---
203
+ kind: ClusterRole
204
+ apiVersion: rbac.authorization.k8s.io/v1
205
+ metadata:
206
+ name: storage-version-migration-initializer
207
+ rules:
208
+ - apiGroups: ["migration.k8s.io"]
209
+ resources: ["storageversionmigrations"]
210
+ verbs: ["create"]
211
+ ---
212
+ kind: ClusterRoleBinding
213
+ apiVersion: rbac.authorization.k8s.io/v1
214
+ metadata:
215
+ name: storage-version-migration-migrator
216
+ subjects:
217
+ - kind: ServiceAccount
218
+ name: default
219
+ namespace: kube-system
220
+ roleRef:
221
+ kind: ClusterRole
222
+ name: cluster-admin
223
+ apiGroup: rbac.authorization.k8s.io
224
+ ---
225
+ kind: ClusterRoleBinding
226
+ apiVersion: rbac.authorization.k8s.io/v1
227
+ metadata:
228
+ name: storage-version-migration-trigger
229
+ subjects:
230
+ - kind: ServiceAccount
231
+ name: default
232
+ namespace: kube-system
233
+ roleRef:
234
+ kind: ClusterRole
235
+ name: storage-version-migration-trigger
236
+ apiGroup: rbac.authorization.k8s.io
237
+ ---
238
+ kind: ClusterRoleBinding
239
+ apiVersion: rbac.authorization.k8s.io/v1
240
+ metadata:
241
+ name: storage-version-migration-crd-creator
242
+ subjects:
243
+ - kind: ServiceAccount
244
+ name: default
245
+ namespace: kube-system
246
+ roleRef:
247
+ kind: ClusterRole
248
+ name: storage-version-migration-crd-creator
249
+ apiGroup: rbac.authorization.k8s.io
250
+ ---
251
+ kind: ClusterRoleBinding
252
+ apiVersion: rbac.authorization.k8s.io/v1
253
+ metadata:
254
+ name: storage-version-migration-initializer
255
+ subjects:
256
+ - kind: ServiceAccount
257
+ name: default
258
+ namespace: kube-system
259
+ roleRef:
260
+ kind: ClusterRole
261
+ name: storage-version-migration-initializer
262
+ apiGroup: rbac.authorization.k8s.io
263
+ ---
264
+ apiVersion: apps/v1
265
+ kind: Deployment
266
+ metadata:
267
+ name: trigger
268
+ namespace: kube-system
269
+ labels:
270
+ app: trigger
271
+ spec:
272
+ replicas: 1
273
+ selector:
274
+ matchLabels:
275
+ app: trigger
276
+ template:
277
+ metadata:
278
+ labels:
279
+ app: trigger
280
+ spec:
281
+ containers:
282
+ - name: trigger
283
+ image: yuanying/storage-version-migration-trigger:v0.1
284
+ args:
285
+ - --kubeconfig=/etc/trigger/kubeconfig
286
+ volumeMounts:
287
+ - mountPath: /etc/trigger
288
+ name: kubeconfig
289
+ volumes:
290
+ - name: kubeconfig
291
+ configMap:
292
+ name: kubeconfig-in-cluster-latest
293
+ ---
294
+ apiVersion: apps/v1
295
+ kind: Deployment
296
+ metadata:
297
+ name: migrator
298
+ namespace: kube-system
299
+ labels:
300
+ app: migrator
301
+ spec:
302
+ replicas: 1
303
+ selector:
304
+ matchLabels:
305
+ app: migrator
306
+ template:
307
+ metadata:
308
+ labels:
309
+ app: migrator
310
+ spec:
311
+ containers:
312
+ - name: migrator
313
+ image: yuanying/storage-version-migration-migrator:v0.1
314
+ command:
315
+ - /migrator
316
+ - --v=2
317
+ - --alsologtostderr
318
+ - --kube-api-qps=40
319
+ - --kube-api-burst=1000
320
+ - --kubeconfig=/etc/migrator/kubeconfig
321
+ volumeMounts:
322
+ - mountPath: /etc/migrator
323
+ name: kubeconfig
324
+ volumes:
325
+ - name: kubeconfig
326
+ configMap:
327
+ name: kubeconfig-in-cluster-latest
@@ -81,6 +81,10 @@ module Porkadot
81
81
  File.expand_path(raw.local.assets_dir)
82
82
  end
83
83
 
84
+ def secrets_root_dir
85
+ File.join(self.assets_dir, 'secrets')
86
+ end
87
+
84
88
  end
85
89
 
86
90
  module ConfigUtils
@@ -102,6 +106,10 @@ module Porkadot
102
106
  end
103
107
  alias path asset_path
104
108
 
109
+ def secrets_path file
110
+ File.join(self.target_secrets_path, file.to_s)
111
+ end
112
+
105
113
  def method_missing name, *args
106
114
  return nil if self.raw.nil?
107
115
  self.raw[name]
@@ -16,6 +16,10 @@ module Porkadot; module Configs
16
16
  def target_path
17
17
  File.join(bootstrap_config.target_path, 'kubelet')
18
18
  end
19
+
20
+ def target_secrets_path
21
+ File.join(bootstrap_config.target_secrets_path, 'kubelet')
22
+ end
19
23
  end
20
24
 
21
25
  include Porkadot::ConfigUtils
@@ -31,12 +35,20 @@ module Porkadot; module Configs
31
35
  File.join(self.config.assets_dir, 'bootstrap')
32
36
  end
33
37
 
38
+ def target_secrets_path
39
+ File.join(self.config.secrets_root_dir, 'bootstrap')
40
+ end
41
+
34
42
  def bootstrap_path
35
43
  File.join(self.target_path, 'bootstrap')
36
44
  end
37
45
 
46
+ def bootstrap_secrets_path
47
+ File.join(self.target_secrets_path, 'bootstrap')
48
+ end
49
+
38
50
  def secrets_path
39
- File.join(self.bootstrap_path, 'secrets')
51
+ File.join(self.bootstrap_secrets_path, 'secrets')
40
52
  end
41
53
 
42
54
  def kubeconfig_path
@@ -5,7 +5,7 @@ module Porkadot; module Configs
5
5
  module CertsUtils
6
6
 
7
7
  def certs_root_dir
8
- File.join(self.config.assets_dir, 'certs')
8
+ File.join(self.config.secrets_root_dir, 'certs')
9
9
  end
10
10
 
11
11
  def ipaddr?(addr)
@@ -33,6 +33,12 @@ module Porkadot; module Configs; class Certs
33
33
  DNS:kubernetes.default
34
34
  DNS:kubernetes.default.svc
35
35
  DNS:kubernetes.default.svc.#{self.config.k8s.networking.dns_domain}
36
+ DNS:porkadot-kubernetes
37
+ DNS:porkadot-kubernetes.kube-system
38
+ DNS:porkadot-kubernetes.kube-system.svc
39
+ DNS:porkadot-kubernetes-latest
40
+ DNS:porkadot-kubernetes-latest.kube-system
41
+ DNS:porkadot-kubernetes-latest.kube-system.svc
36
42
  DNS:localhost
37
43
  IP:#{self.config.k8s.networking.kubernetes_ip}
38
44
  IP:127.0.0.1