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

Add option to mount ephemeral disks for image storage #95

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ func newDefaultCluster() *Cluster {
AwsEnvironment{
Enabled: false,
},
EphemeralImageStorage{
Enabled: false,
Disk: "xvdb",
Filesystem: "xfs",
},
WaitSignal{
Enabled: false,
MaxBatchSize: 1,
Expand Down Expand Up @@ -203,10 +208,11 @@ type Subnet struct {
}

type Experimental struct {
NodeDrainer NodeDrainer `yaml:"nodeDrainer"`
NodeLabel NodeLabel `yaml:"nodeLabel"`
AwsEnvironment AwsEnvironment `yaml:"awsEnvironment"`
WaitSignal WaitSignal `yaml:"waitSignal"`
NodeDrainer NodeDrainer `yaml:"nodeDrainer"`
NodeLabel NodeLabel `yaml:"nodeLabel"`
AwsEnvironment AwsEnvironment `yaml:"awsEnvironment"`
EphemeralImageStorage EphemeralImageStorage `yaml:"ephemeralImageStorage"`
WaitSignal WaitSignal `yaml:"waitSignal"`
}

type NodeDrainer struct {
Expand All @@ -227,6 +233,12 @@ type WaitSignal struct {
MaxBatchSize int `yaml:"maxBatchSize"`
}

type EphemeralImageStorage struct {
Enabled bool `yaml:"enabled"`
Disk string `yaml:"disk"`
Filesystem string `yaml:"filesystem"`
}

const (
vpcLogicalName = "VPC"
)
Expand Down
30 changes: 30 additions & 0 deletions config/templates/cloud-config-controller
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,36 @@ coreos:
http://localhost:8080/api/v1/nodes/$(hostname)"
{{end}}

{{if .Experimental.EphemeralImageStorage.Enabled}}
- name: format-ephemeral.service
command: start
content: |
[Unit]
Description=Formats the ephemeral drive
After=dev-{{.Experimental.EphemeralImageStorage.Disk}}.device
Requires=dev-{{.Experimental.EphemeralImageStorage.Disk}}.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/wipefs -f /dev/{{.Experimental.EphemeralImageStorage.Disk}}
ExecStart=/usr/sbin/mkfs.{{.Experimental.EphemeralImageStorage.Filesystem}} -f /dev/{{.Experimental.EphemeralImageStorage.Disk}}
- name: var-lib-docker.mount
command: start
content: |
[Unit]
Description=Mount ephemeral to /var/lib/docker
Requires=format-ephemeral.service
After=format-ephemeral.service
[Mount]
What=/dev/{{.Experimental.EphemeralImageStorage.Disk}}
{{if eq .ContainerRuntime "docker"}}
Where=/var/lib/docker
{{else if eq .ContainerRuntime "rkt"}}
Where=/var/lib/rkt
{{end}}
Type={{.Experimental.EphemeralImageStorage.Filesystem}}
{{end}}

{{if .SSHAuthorizedKeys}}
ssh_authorized_keys:
{{range $sshkey := .SSHAuthorizedKeys}}
Expand Down
30 changes: 30 additions & 0 deletions config/templates/cloud-config-worker
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,36 @@ coreos:
https://{{.ExternalDNSName}}:443/api/v1/nodes/$(hostname)"
{{end}}

{{if .Experimental.EphemeralImageStorage.Enabled}}
- name: format-ephemeral.service
command: start
content: |
[Unit]
Description=Formats the ephemeral drive
After=dev-{{.Experimental.EphemeralImageStorage.Disk}}.device
Requires=dev-{{.Experimental.EphemeralImageStorage.Disk}}.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/wipefs -f /dev/{{.Experimental.EphemeralImageStorage.Disk}}
ExecStart=/usr/sbin/mkfs.{{.Experimental.EphemeralImageStorage.Filesystem}} -f /dev/{{.Experimental.EphemeralImageStorage.Disk}}
- name: var-lib-docker.mount
command: start
content: |
[Unit]
Description=Mount ephemeral to /var/lib/docker
Requires=format-ephemeral.service
After=format-ephemeral.service
[Mount]
What=/dev/{{.Experimental.EphemeralImageStorage.Disk}}
{{if eq .ContainerRuntime "docker"}}
Where=/var/lib/docker
{{else if eq .ContainerRuntime "rkt"}}
Where=/var/lib/rkt
{{end}}
Type={{.Experimental.EphemeralImageStorage.Filesystem}}
{{end}}

{{if .SSHAuthorizedKeys}}
ssh_authorized_keys:
{{range $sshkey := .SSHAuthorizedKeys}}
Expand Down
3 changes: 3 additions & 0 deletions config/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ kmsKeyArn: "{{.KMSKeyARN}}"
# CFNSTACK: '{ "Ref" : "AWS::StackId" }'
# waitSignal:
# enabled: true
# # This option has not yet been tested with rkt as container runtime
# ephemeralImageStorage:
# enabled: true

# AWS Tags for cloudformation stack resources
#stackTags:
Expand Down