-
Notifications
You must be signed in to change notification settings - Fork 22
/
etcd_cluster_migrator.go
82 lines (75 loc) · 2.37 KB
/
etcd_cluster_migrator.go
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
package template
// TODO we install etcd-cluster-migrator in every case of HA masters. The etcd-cluster-migrator app
// does not have negative effects on Tenant Clusters that were already created using the HA masters
// setup. Already migrated Tenant Clusters can also safely run this app for the time being. The
// workaround here for now is only so we don't have to spent too much time implementing a proper
// managed app via our app catalogue, which only deploys the etcd-cluster-migrator on demand in
// case a Tenant Cluster is migrating automatically from 1 to 3 masters. See also the TODO issue below.
//
// https://github.com/giantswarm/giantswarm/issues/11397
const EtcdClusterMigratorService = `
[Unit]
Description=Install etcd-cluster-migrator
After=k8s-kubelet.service
Requires=k8s-kubelet.service
[Service]
Type=oneshot
ExecStart=/opt/bin/install-etcd-cluster-migrator
[Install]
WantedBy=multi-user.target
`
const EtcdClusterMigratorInstaller = `#!/bin/bash
export KUBECONFIG=/etc/kubernetes/kubeconfig/addons.yaml
for manifest in "etcd-cluster-migrator.yaml"
do
while
/opt/bin/kubectl apply -f /srv/$manifest
[ "$?" -ne "0" ]
do
echo "failed to apply /srv/$manifest, retrying in 10 sec"
sleep 10s
done
done
`
const EtcdClusterMigratorManifest = `
apiVersion: v1
data:
values: |
app:
baseDomain: {{.BaseDomain}}
image:
registry: {{.RegistryDomain}}
kind: ConfigMap
metadata:
name: etcd-cluster-migrator-chart-values
namespace: giantswarm
labels:
app: etcd-cluster-migrator
giantswarm.io/organization: giantswarm
giantswarm.io/managed-by: aws-operator
giantswarm.io/service-type: managed
---
apiVersion: application.giantswarm.io/v1alpha1
kind: Chart
metadata:
annotations:
chart-operator.giantswarm.io/force-helm-upgrade: "true"
labels:
app: etcd-cluster-migrator
chart-operator.giantswarm.io/version: 3.1.0
giantswarm.io/organization: giantswarm
giantswarm.io/managed-by: aws-operator
giantswarm.io/service-type: managed
name: etcd-cluster-migrator
namespace: giantswarm
spec:
config:
configMap:
name: etcd-cluster-migrator-chart-values
namespace: giantswarm
resourceVersion: ""
name: etcd-cluster-migrator
namespace: kube-system
tarballURL: https://giantswarm.github.io/giantswarm-playground-catalog/etcd-cluster-migrator-1.2.0.tgz
version: 1.2.0
`