-
Notifications
You must be signed in to change notification settings - Fork 22
Fix volume attachments while upgrade (v12 v13) #999
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cloudconfig | ||
|
||
const NVMEUdevRule = `KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="/opt/ebs-nvme-mapping /dev/%k", SYMLINK+="%c" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. udev rule that calls script on any events with nvme that will create/delete sylinks with name that was specified in EBS e.g. |
||
` | ||
|
||
const NVMEUdevScript = `#!/bin/bash | ||
vol=$(nvme id-ctrl --raw-binary "$1" | cut -c3073-3104 | tr -s ' ' | sed 's/ $//g') | ||
vol=${vol#/dev/} | ||
if [[ -n "$vol" ]]; then | ||
echo ${vol/xvd/sd} ${vol/sd/xvd} | ||
fi | ||
` | ||
|
||
const NVMEUdevTriggerUnit = `[Unit] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This unit only necessary on the first boot, because udev rule was just added and we need to retrigger udev. |
||
Description=Reload AWS EBS NVMe rules | ||
Requires=coreos-setup-environment.service | ||
After=coreos-setup-environment.service | ||
Before=user-config.target | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
EnvironmentFile=-/etc/environment | ||
ExecStart=/usr/bin/udevadm control --reload-rules | ||
ExecStart=/usr/bin/udevadm trigger -y "nvme[0-9]*n[0-9]*" | ||
ExecStart=/usr/bin/udevadm settle | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ const Instance = `{{define "instance"}} | |
{{ .Instance.Master.Instance.ResourceName }}: | ||
Type: "AWS::EC2::Instance" | ||
Description: Master instance | ||
DependsOn: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Problem was that VM did not depend on volumes to it was immediately created with etcd as first disk and in that time docker disk was resized (takes 3-5 minutes) and then docker disk attached as second disk and mounted to This dependency makes sure that VM will wait to both volumes to be ready before get started. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very good catch, thanks! |
||
- DockerVolume | ||
- EtcdVolume | ||
Properties: | ||
AvailabilityZone: {{ .Instance.Master.AZ }} | ||
IamInstanceProfile: !Ref MasterInstanceProfile | ||
|
@@ -19,25 +22,21 @@ const Instance = `{{define "instance"}} | |
Value: {{ .Instance.Cluster.ID }}-master | ||
DockerVolume: | ||
Type: AWS::EC2::Volume | ||
DependsOn: | ||
- {{ .Instance.Master.Instance.ResourceName }} | ||
Properties: | ||
Encrypted: true | ||
Size: 100 | ||
Size: 50 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm rolling master docker disk size to 50GB, because we don't really need 100GB on master node. 100GB only needed for workers. This prevents unnecessary delay (3-5 minutes caused by resizing) while upgrade. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes makes sense to leave the volume at 50GB for masters. Great that it avoids the delay. |
||
VolumeType: gp2 | ||
AvailabilityZone: !GetAtt {{ .Instance.Master.Instance.ResourceName }}.AvailabilityZone | ||
AvailabilityZone: {{ .Instance.Master.AZ }} | ||
Tags: | ||
- Key: Name | ||
Value: {{ .Instance.Master.DockerVolume.Name }} | ||
EtcdVolume: | ||
Type: AWS::EC2::Volume | ||
DependsOn: | ||
- {{ .Instance.Master.Instance.ResourceName }} | ||
Properties: | ||
Encrypted: true | ||
Size: 100 | ||
VolumeType: gp2 | ||
AvailabilityZone: !GetAtt {{ .Instance.Master.Instance.ResourceName }}.AvailabilityZone | ||
AvailabilityZone: {{ .Instance.Master.AZ }} | ||
Tags: | ||
- Key: Name | ||
Value: {{ .Instance.Master.EtcdVolume.Name }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cloudconfig | ||
|
||
const NVMEUdevRule = `KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="/opt/ebs-nvme-mapping /dev/%k", SYMLINK+="%c" | ||
` | ||
|
||
const NVMEUdevScript = `#!/bin/bash | ||
vol=$(nvme id-ctrl --raw-binary "$1" | cut -c3073-3104 | tr -s ' ' | sed 's/ $//g') | ||
vol=${vol#/dev/} | ||
if [[ -n "$vol" ]]; then | ||
echo ${vol/xvd/sd} ${vol/sd/xvd} | ||
fi | ||
` | ||
|
||
const NVMEUdevTriggerUnit = `[Unit] | ||
Description=Reload AWS EBS NVMe rules | ||
Requires=coreos-setup-environment.service | ||
After=coreos-setup-environment.service | ||
Before=user-config.target | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
EnvironmentFile=-/etc/environment | ||
ExecStart=/usr/bin/udevadm control --reload-rules | ||
ExecStart=/usr/bin/udevadm trigger -y "nvme[0-9]*n[0-9]*" | ||
ExecStart=/usr/bin/udevadm settle | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ const Instance = `{{define "instance"}} | |
{{ .Instance.Master.Instance.ResourceName }}: | ||
Type: "AWS::EC2::Instance" | ||
Description: Master instance | ||
DependsOn: | ||
- DockerVolume | ||
- EtcdVolume | ||
Properties: | ||
AvailabilityZone: {{ .Instance.Master.AZ }} | ||
IamInstanceProfile: !Ref MasterInstanceProfile | ||
|
@@ -19,25 +22,21 @@ const Instance = `{{define "instance"}} | |
Value: {{ .Instance.Cluster.ID }}-master | ||
DockerVolume: | ||
Type: AWS::EC2::Volume | ||
DependsOn: | ||
- {{ .Instance.Master.Instance.ResourceName }} | ||
Properties: | ||
Encrypted: true | ||
Size: 100 | ||
Size: 50 | ||
VolumeType: gp2 | ||
AvailabilityZone: !GetAtt {{ .Instance.Master.Instance.ResourceName }}.AvailabilityZone | ||
AvailabilityZone: {{ .Instance.Master.AZ }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because the master resource now depends on the volumes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, otherwise it has curcular error :( |
||
Tags: | ||
- Key: Name | ||
Value: {{ .Instance.Master.DockerVolume.Name }} | ||
EtcdVolume: | ||
Type: AWS::EC2::Volume | ||
DependsOn: | ||
- {{ .Instance.Master.Instance.ResourceName }} | ||
Properties: | ||
Encrypted: true | ||
Size: 100 | ||
VolumeType: gp2 | ||
AvailabilityZone: !GetAtt {{ .Instance.Master.Instance.ResourceName }}.AvailabilityZone | ||
AvailabilityZone: {{ .Instance.Master.AZ }} | ||
Tags: | ||
- Key: Name | ||
Value: {{ .Instance.Master.EtcdVolume.Name }} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-e
file exists (any type), because/dev/xvdc
is symlink in case NVMe and block device in casem3