Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 15cfc3f

Browse files
Merge pull request #1608 from HotelsDotCom/v0.13.0-rc.2-prep1
v0.13.0-rc.2
2 parents 5d06844 + 4a59648 commit 15cfc3f

File tree

12 files changed

+40
-116
lines changed

12 files changed

+40
-116
lines changed

build

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ TAG=$(git describe --exact-match --abbrev=0 --tags "${COMMIT}" 2> /dev/null || t
66
BRANCH=$(git branch | grep \* | cut -d ' ' -f2 | sed -e 's/[^a-zA-Z0-9+=._:/-]*//g' || true)
77
OUTPUT_PATH=${OUTPUT_PATH:-"bin/kube-aws"}
88
VERSION=""
9-
KUBERNETES_VERSION="v1.13.5"
9+
ETCD_VERSION="v3.2.26"
10+
KUBERNETES_VERSION="v1.13.6"
1011

1112
if [ -z "$TAG" ]; then
1213
[[ -n "$BRANCH" ]] && VERSION="${BRANCH}/"
@@ -42,4 +43,4 @@ fi
4243
if [[ ! "${BUILD_GOARCH:-}" == "" ]];then
4344
export GOARCH=$BUILD_GOARCH
4445
fi
45-
go build -ldflags "-X github.com/kubernetes-incubator/kube-aws/pkg/model.VERSION=${VERSION} -X github.com/kubernetes-incubator/kube-aws/pkg/api.KUBERNETES_VERSION=${KUBERNETES_VERSION}" -a -tags netgo -installsuffix netgo -o "$OUTPUT_PATH" ./
46+
go build -ldflags "-X github.com/kubernetes-incubator/kube-aws/pkg/model.VERSION=${VERSION} -X github.com/kubernetes-incubator/kube-aws/pkg/api.KUBERNETES_VERSION=${KUBERNETES_VERSION} -X github.com/kubernetes-incubator/kube-aws/pkg/api.ETCD_VERSION=${ETCD_VERSION}" -a -tags netgo -installsuffix netgo -o "$OUTPUT_PATH" ./

builtin/files/cluster.yaml.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -759,10 +759,10 @@ worker:
759759
# instanceProfile:
760760
# arn: "arn:aws:iam::YOURACCOUNTID:instance-profile/INSTANCEPROFILENAME"
761761
#
762-
# # The version of etcd to be used. Set to e.g. "3.2.1" to use etcd3
762+
# # The version of etcd to be used.
763763
# # CAUTION: Increasing etcd version will permanently change the state of etcd and a cloud formation rollback, will not succeed due to etcd
764764
# being unable to downgrade.
765-
# version: 3.2.13
765+
# version: 3.2.26
766766
#
767767
# snapshot:
768768
# # Set to true to periodically take an etcd snapshot

builtin/files/etcdadm/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ AWS_SECRET_ACCESS_KEY=... \
1414
ETCDADM_AWSCLI_DOCKER_IMAGE=quay.io/coreos/awscli \
1515
# Required settings
1616
AWS_DEFAULT_REGION=ap-northeast-1 \
17-
ETCD_VERSION=3.2.13 \
1817
ETCD_DATA_DIR=/var/lib/etcd \
1918
ETCD_INITIAL_CLUSTER=etcd0=http://127.0.0.1:3080,etcd1=http://127.0.0.1:3180,etcd2=http://127.0.0.1:3280 \
2019
ETCDCTL_ENDPOINTS=http://127.0.0.1:3079,etcd1=http://127.0.0.1:3179,etcd2=http://127.0.0.1:3279, \

builtin/files/etcdadm/test

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ RestartSec=10s
9898
TimeoutStartSec=0
9999
LimitNOFILE=40000
100100
101-
Environment="ETCD_IMAGE_TAG=v3.2.13"
101+
Environment="ETCD_IMAGE_TAG=v3.2.26"
102102
Environment="ETCD_NAME=%m"
103103
Environment="ETCD_USER=etcd"
104104
Environment="ETCD_DATA_DIR=/var/lib/etcd"

builtin/files/userdata/cloud-config-controller

-4
Original file line numberDiff line numberDiff line change
@@ -3366,11 +3366,7 @@ write_files:
33663366
- --secure-port=443
33673367
- --enable-bootstrap-token-auth=true
33683368
- --token-auth-file=/etc/kubernetes/auth/tokens.csv
3369-
{{if .Etcd.Version.Is3}}
33703369
- --storage-backend=etcd3
3371-
{{else}}
3372-
- --storage-backend=etcd2
3373-
{{end}}
33743370
- --kubelet-preferred-address-types=InternalIP,Hostname,ExternalIP
33753371
{{if .Experimental.AuditLog.Enabled}}
33763372
- --audit-log-maxage={{.Experimental.AuditLog.MaxAge}}

builtin/files/userdata/cloud-config-etcd

+19-26
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,13 @@ coreos:
263263
ExecStart=/bin/sleep 3600
264264
TimeoutStartSec=900
265265
{{ end -}}
266-
{{if .Etcd.DisasterRecovery.SupportsEtcdVersion .Etcd.Version -}}
267266
- name: etcdadm-reconfigure.service
268267
enable: true
269268
content: |
270269
[Unit]
271270
Description=etcdadm reconfigure runner
272-
BindsTo={{.Etcd.SystemdUnitName}}
273-
Before={{.Etcd.SystemdUnitName}}
271+
BindsTo=etcd-member.service
272+
Before=etcd-member.service
274273
Wants=cfn-etcd-environment.service
275274
After=cfn-etcd-environment.service
276275
After=network.target
@@ -286,7 +285,7 @@ coreos:
286285
ExecStartPre=/usr/bin/systemctl is-active cfn-etcd-environment.service
287286
ExecStartPre=/usr/bin/mkdir -p /var/run/coreos/etcdadm/snapshots
288287
ExecStart=/opt/bin/etcdadm reconfigure
289-
{{if .Etcd.DisasterRecovery.IsAutomatedForEtcdVersion .Etcd.Version -}}
288+
{{if .Etcd.DisasterRecovery.Automated -}}
290289
ExecStartPost=/usr/bin/systemctl start etcdadm-check.timer
291290
{{end -}}
292291
TimeoutStartSec=120
@@ -296,8 +295,8 @@ coreos:
296295
content: |
297296
[Unit]
298297
Description=etcdadm update status
299-
BindsTo={{.Etcd.SystemdUnitName}}
300-
After={{.Etcd.SystemdUnitName}}
298+
BindsTo=etcd-member.service
299+
After=etcd-member.service
301300
After=network.target
302301

303302
[Service]
@@ -307,11 +306,10 @@ coreos:
307306
EnvironmentFile=-/etc/etcd-environment
308307
EnvironmentFile=-/var/run/coreos/etcdadm-environment
309308
ExecStart=/opt/bin/etcdadm member_status_set_started
310-
{{if .Etcd.Snapshot.IsAutomatedForEtcdVersion .Etcd.Version -}}
309+
{{if .Etcd.Snapshot.Automated -}}
311310
ExecStartPost=/usr/bin/systemctl start etcdadm-save.timer
312311
{{end -}}
313312
TimeoutStartSec=120
314-
{{- end}}
315313

316314
- name: etcdadm-check.service
317315
enable: true
@@ -323,11 +321,11 @@ coreos:
323321
Type=oneshot
324322
EnvironmentFile=-/etc/etcd-environment
325323
EnvironmentFile=-/var/run/coreos/etcdadm-environment
326-
ExecStartPre=/usr/bin/systemctl is-active {{.Etcd.SystemdUnitName}}
324+
ExecStartPre=/usr/bin/systemctl is-active etcd-member.service
327325
ExecStart=/opt/bin/etcdadm check
328326
TimeoutStartSec=120
329327

330-
{{if .Etcd.DisasterRecovery.IsAutomatedForEtcdVersion .Etcd.Version -}}
328+
{{if .Etcd.DisasterRecovery.Automated -}}
331329
- name: etcdadm-check.timer
332330
enable: true
333331
content: |
@@ -354,11 +352,11 @@ coreos:
354352
Type=oneshot
355353
EnvironmentFile=-/etc/etcd-environment
356354
EnvironmentFile=-/var/run/coreos/etcdadm-environment
357-
ExecStartPre=/usr/bin/systemctl is-active {{.Etcd.SystemdUnitName}}
355+
ExecStartPre=/usr/bin/systemctl is-active etcd-member.service
358356
ExecStart=/opt/bin/etcdadm save
359357
TimeoutStartSec=300
360358

361-
{{if .Etcd.Snapshot.IsAutomatedForEtcdVersion .Etcd.Version -}}
359+
{{if .Etcd.Snapshot.Automated -}}
362360
- name: etcdadm-save.timer
363361
enable: true
364362
content: |
@@ -375,7 +373,7 @@ coreos:
375373
WantedBy=timers.target
376374
{{- end}}
377375

378-
- name: {{.Etcd.SystemdUnitName}}
376+
- name: etcd-member.service
379377
drop-ins:
380378
- name: 20-aws-cluster.conf
381379
content: |
@@ -386,12 +384,9 @@ coreos:
386384
Wants=decrypt-assets.service
387385
After=decrypt-assets.service
388386
{{- end}}
389-
{{if .Etcd.DisasterRecovery.SupportsEtcdVersion .Etcd.Version -}}
390-
{{/* can be `Wants` if you like etcd-member to not stop when etcdadm-reconfigure failed */}}
391387
BindsTo=etcdadm-reconfigure.service etcdadm-update-status.service
392388
After=etcdadm-reconfigure.service
393389
Before=etcdadm-update-status.service
394-
{{end -}}
395390

396391
[Service]
397392
EnvironmentFile=-/etc/etcd-environment
@@ -403,32 +398,30 @@ coreos:
403398
ExecStartPre=/usr/bin/systemctl is-active decrypt-assets.service
404399
{{- end}}
405400
ExecStartPre=/usr/bin/chown -R etcd:etcd /var/lib/etcd2
406-
{{if .Etcd.Version.Is3 }}
407401
- name: 40-version.conf
408402
content: |
409403
[Service]
410-
Environment="ETCD_IMAGE_TAG=v{{.Etcd.Version}}"
404+
Environment="ETCD_IMAGE_TAG={{.Etcd.Version}}"
411405
- name: 40-auto-compaction.conf
412406
content: |
413407
[Service]
414408
Environment="ETCD_AUTO_COMPACTION_RETENTION=1"
415-
{{end}}
416409
enable: true
417410
command: start
418411

419412
- name: var-lib-etcd2.mount
420413
enable: true
421414
content: |
422415
[Unit]
423-
Before={{.Etcd.SystemdUnitName}}
416+
Before=etcd-member.service
424417

425418
[Mount]
426419
What=/dev/xvdf
427420
Where=/var/lib/etcd2
428421
Type=ext4
429422

430423
[Install]
431-
RequiredBy={{.Etcd.SystemdUnitName}}
424+
RequiredBy=etcd-member.service
432425

433426
- name: format-etcd2-volume.service
434427
enable: true
@@ -453,7 +446,7 @@ coreos:
453446
content: |
454447
[Unit]
455448
Description=decrypt etcd2 tls assets using amazon kms
456-
Before={{.Etcd.SystemdUnitName}}
449+
Before=etcd-member.service
457450

458451
[Service]
459452
Restart=on-failure
@@ -484,16 +477,16 @@ coreos:
484477
ExecStart=-/usr/bin/rkt rm --uuid-file=/var/run/coreos/decrypt-assets.uuid
485478

486479
[Install]
487-
RequiredBy={{.Etcd.SystemdUnitName}}
480+
RequiredBy=etcd-member.service
488481
{{ end }}
489482

490483
{{ if .WaitSignal.Enabled }}
491484
- name: cfn-signal.service
492485
command: start
493486
content: |
494487
[Unit]
495-
Wants={{.Etcd.SystemdUnitName}}
496-
After={{.Etcd.SystemdUnitName}}
488+
Wants=etcd-member.service
489+
After=etcd-member.service
497490
{{ if .EtcdMigrationEnabled -}}
498491
After=import-existing-etcd-state.service
499492
{{ end -}}
@@ -504,7 +497,7 @@ coreos:
504497
RestartSec=10
505498

506499
EnvironmentFile={{.EtcdNodeEnvFileName}}
507-
ExecStartPre=/usr/bin/systemctl is-active {{.Etcd.SystemdUnitName}}
500+
ExecStartPre=/usr/bin/systemctl is-active etcd-member.service
508501
{{ if .EtcdMigrationEnabled -}}
509502
ExecStartPre=/usr/bin/systemctl is-active import-existing-etcd-state.service
510503
{{ end -}}

core/root/cluster.go

+4
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ func (cl *Cluster) create(cfSvc *cloudformation.CloudFormation) error {
482482
return err
483483
}
484484

485+
logger.Infof("Creating cluster %s with Kubernetes %s and etcd %s ...", cl.Cfg.ClusterName, cl.Cfg.K8sVer, cl.Cfg.Etcd.Version())
486+
485487
q := make(chan struct{}, 1)
486488
defer func() { q <- struct{}{} }()
487489

@@ -736,6 +738,8 @@ func (cl *Cluster) update(cfSvc *cloudformation.CloudFormation, targets Operatio
736738
return "", err
737739
}
738740

741+
logger.Infof("Updating cluster %s with Kubernetes %s and etcd %s ...", cl.Cfg.ClusterName, cl.Cfg.K8sVer, cl.Cfg.Etcd.Version())
742+
739743
q := make(chan struct{}, 1)
740744
defer func() { q <- struct{}{} }()
741745

pkg/api/cluster.go

+2-11
Original file line numberDiff line numberDiff line change
@@ -839,17 +839,8 @@ func (e EtcdSettings) Validate() error {
839839
return err
840840
}
841841

842-
if e.Etcd.Version().Is3() {
843-
if e.Etcd.DisasterRecovery.Automated && !e.Etcd.Snapshot.Automated {
844-
return errors.New("`etcd.disasterRecovery.automated` is set to true but `etcd.snapshot.automated` is not - automated disaster recovery requires snapshot to be also automated")
845-
}
846-
} else {
847-
if e.Etcd.DisasterRecovery.Automated {
848-
return errors.New("`etcd.disasterRecovery.automated` is set to true for enabling automated disaster recovery. However the feature is available only for etcd version 3")
849-
}
850-
if e.Etcd.Snapshot.Automated {
851-
return errors.New("`etcd.snapshot.automated` is set to true for enabling automated snapshot. However the feature is available only for etcd version 3")
852-
}
842+
if e.Etcd.DisasterRecovery.Automated && !e.Etcd.Snapshot.Automated {
843+
return errors.New("`etcd.disasterRecovery.automated` is set to true but `etcd.snapshot.automated` is not - automated disaster recovery requires snapshot to be also automated")
853844
}
854845

855846
return nil

pkg/api/etcd.go

+3-31
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type Etcd struct {
3030
UnknownKeys `yaml:",inline"`
3131
}
3232

33-
type EtcdVersion string
33+
var ETCD_VERSION string = "v99.99"
3434

3535
type EtcdDisasterRecovery struct {
3636
Automated bool `yaml:"automated,omitempty"`
@@ -41,23 +41,10 @@ type UserSuppliedArgs struct {
4141
AutoCompactionRetention int `yaml:"autoCompactionRetention,omitempty"`
4242
}
4343

44-
// Supported returns true when the disaster recovery feature provided by etcdadm can be enabled on the specified version of etcd
45-
func (r EtcdDisasterRecovery) SupportsEtcdVersion(etcdVersion EtcdVersion) bool {
46-
return etcdVersion.Is3()
47-
}
48-
49-
func (r EtcdDisasterRecovery) IsAutomatedForEtcdVersion(etcdVersion EtcdVersion) bool {
50-
return etcdVersion.Is3() && r.Automated
51-
}
52-
5344
type EtcdSnapshot struct {
5445
Automated bool `yaml:"automated,omitempty"`
5546
}
5647

57-
func (s EtcdSnapshot) IsAutomatedForEtcdVersion(etcdVersion EtcdVersion) bool {
58-
return etcdVersion.Is3() && s.Automated
59-
}
60-
6148
func NewDefaultEtcd() Etcd {
6249
return Etcd{
6350
EC2Instance: EC2Instance{
@@ -160,13 +147,6 @@ func (e Etcd) SecurityGroupRefs() []string {
160147
return refs
161148
}
162149

163-
func (e Etcd) SystemdUnitName() string {
164-
if e.Version().Is3() {
165-
return "etcd-member.service"
166-
}
167-
return "etcd2.service"
168-
}
169-
170150
func ValidateQuotaBackendBytes(bytes int) error {
171151
if bytes > MaxQuotaBackendBytes {
172152
return fmt.Errorf("quotaBackendBytes: %v is higher than the maximum allowed value 8,589,934,592", bytes)
@@ -201,17 +181,9 @@ func (e Etcd) FormatOpts() string {
201181
}
202182

203183
// Version returns the version of etcd (e.g. `3.2.1`) to be used for this etcd cluster
204-
func (e Etcd) Version() EtcdVersion {
184+
func (e Etcd) Version() string {
205185
if e.Cluster.Version != "" {
206186
return e.Cluster.Version
207187
}
208-
return "3.2.13"
209-
}
210-
211-
func (v EtcdVersion) Is3() bool {
212-
return strings.HasPrefix(string(v), "3")
213-
}
214-
215-
func (v EtcdVersion) String() string {
216-
return string(v)
188+
return ETCD_VERSION
217189
}

pkg/api/etcd_cluster.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package api
33
import "fmt"
44

55
type EtcdCluster struct {
6-
InternalDomainName string `yaml:"internalDomainName,omitempty"`
7-
MemberIdentityProvider string `yaml:"memberIdentityProvider,omitempty"`
8-
HostedZone Identifier `yaml:"hostedZone,omitempty"`
9-
ManageRecordSets *bool `yaml:"manageRecordSets,omitempty"`
10-
KMSKeyARN string `yaml:"kmsKeyArn,omitempty"`
11-
Version EtcdVersion `yaml:"version,omitempty"`
6+
InternalDomainName string `yaml:"internalDomainName,omitempty"`
7+
MemberIdentityProvider string `yaml:"memberIdentityProvider,omitempty"`
8+
HostedZone Identifier `yaml:"hostedZone,omitempty"`
9+
ManageRecordSets *bool `yaml:"manageRecordSets,omitempty"`
10+
KMSKeyARN string `yaml:"kmsKeyArn,omitempty"`
11+
Version string `yaml:"version,omitempty"`
1212
}
1313

1414
const (

pkg/api/etcd_test.go

-8
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,10 @@ func TestEtcd(t *testing.T) {
3636
t.Errorf("name tag key incorrect, expected: kube-aws:etcd:name, got: %s", etcdTest.NameTagKey())
3737
}
3838

39-
if etcdTest.Version() != "3.2.13" {
40-
t.Errorf("etcd version incorrect, epxected: 3.2.13, got: %s", etcdTest.Version())
41-
}
42-
4339
if !etcdTest.NodeShouldHaveEIP() {
4440
t.Error("expected: true, got: false")
4541
}
4642

47-
if etcdTest.SystemdUnitName() != "etcd-member.service" {
48-
t.Errorf("etcd systemd unit name incorrect, expected: etcd-member.service, got %s", etcdTest.SystemdUnitName())
49-
}
50-
5143
if etcdTest.SecurityGroupRefs()[0] != `{"Fn::ImportValue" : {"Fn::Sub" : "${NetworkStackName}-EtcdSecurityGroup"}}` {
5244
t.Errorf("etcd security group refs incorrect, expected: `{'Fn::ImportValue' : {'Fn::Sub' : '${NetworkStackName}-EtcdSecurityGroup'}}`, got: %s", etcdTest.SecurityGroupRefs()[0])
5345
}

0 commit comments

Comments
 (0)