Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Adds default storage classes for Azure, AWS and vSphere #287

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions jobs/apply-specs/spec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ templates:
specs/metrics-server/resource-reader.yml: specs/metrics-server/resource-reader.yml
specs/metrics-server/secrets.yml.erb: specs/metrics-server/secrets.yml
specs/storage-class-gce.yml: specs/storage-class-gce.yml
specs/storage-class-aws.yml: specs/storage-class-aws.yml
specs/storage-class-azure.yml: specs/storage-class-azure.yml
specs/storage-class-vsphere.yml: specs/storage-class-vsphere.yml

packages:
- kubernetes
Expand Down
15 changes: 15 additions & 0 deletions jobs/apply-specs/templates/bin/deploy-specs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ main() {
apply_spec "storage-class-gce.yml"
<% end %>
<% end %>
<% cloud_provider.if_p('cloud-provider.type') do |p| %>
<% if p == 'aws' %>
apply_spec "storage-class-aws.yml"
<% end %>
<% end %>
<% cloud_provider.if_p('cloud-provider.type') do |p| %>
<% if p == 'azure' %>
apply_spec "storage-class-azure.yml"
<% end %>
<% end %>
<% cloud_provider.if_p('cloud-provider.type') do |p| %>
<% if p == 'vsphere' %>
apply_spec "storage-class-vsphere.yml"
<% end %>
<% end %>
<% end %>
echo "System specs added successfully."

Expand Down
9 changes: 9 additions & 0 deletions jobs/apply-specs/templates/specs/storage-class-aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
9 changes: 9 additions & 0 deletions jobs/apply-specs/templates/specs/storage-class-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/azure-disk
parameters:
skuName: Standard_LRS
10 changes: 10 additions & 0 deletions jobs/apply-specs/templates/specs/storage-class-vsphere.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/vsphere-volume
parameters:
diskformat: thin
fstype: ext3
63 changes: 63 additions & 0 deletions spec/apply_specs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@

it 'does not apply the standard storage class by default' do
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-gce.yml"')
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-aws.yml"')
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-azure.yml"')
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-vsphere.yml"')
end

context 'Mutiple CAs' do
Expand Down Expand Up @@ -121,6 +124,63 @@
end
end

context 'on AWS' do
let(:link_spec) do
{
'cloud-provider' => {
'instances' => [],
'properties' => {
'cloud-provider' => {
'type' => 'aws'
}
}
}
}
end

it 'applies the standard storage class' do
expect(rendered_deploy_specs).to include('apply_spec "storage-class-aws.yml"')
end
end

context 'on Azure' do
let(:link_spec) do
{
'cloud-provider' => {
'instances' => [],
'properties' => {
'cloud-provider' => {
'type' => 'azure'
}
}
}
}
end

it 'applies the standard storage class' do
expect(rendered_deploy_specs).to include('apply_spec "storage-class-azure.yml"')
end
end

context 'on vSphere' do
let(:link_spec) do
{
'cloud-provider' => {
'instances' => [],
'properties' => {
'cloud-provider' => {
'type' => 'vsphere'
}
}
}
}
end

it 'applies the standard storage class' do
expect(rendered_deploy_specs).to include('apply_spec "storage-class-vsphere.yml"')
end
end

context 'on non-GCE' do
let(:link_spec) do
{
Expand Down Expand Up @@ -152,6 +212,9 @@

it 'does not apply the standard storage class' do
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-gce.yml"')
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-aws.yml"')
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-azure.yml"')
expect(rendered_deploy_specs).to_not include('apply_spec "storage-class-vsphere.yml"')
end
end

Expand Down