-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
author Karinna Iniguez <kngz@amazon.com> 1537555682 -0700 committer Karinna Iniguez <kngz@amazon.com> 1537817451 -0700 Add Storage to cluster Addons and describe bool flag define StorageClass object Call CreateDefaultStorageClass from create cluster function Refactor error handling and update Readme with new flag Move storage class creation after nodes join Set storageclass flag to true by default Call CreateDefaultStorageClass from create cluster function Move storage class creation after nodes join Set storageclass flag to true by default
- Loading branch information
1 parent
2986492
commit ba7c822
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package eks | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
corev1 "k8s.io/api/core/v1" | ||
storage "k8s.io/api/storage/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
clientset "k8s.io/client-go/kubernetes" | ||
) | ||
|
||
func (c *ClusterProvider) AddDefaultStorageClass(clientSet *clientset.Clientset) error { | ||
|
||
rp := corev1.PersistentVolumeReclaimRetain | ||
|
||
scb := &storage.StorageClass{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "StorageClass", | ||
APIVersion: "storage.k8s.io/v1", | ||
}, | ||
Provisioner: "kubernetes.io/aws-ebs", | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "gp2", | ||
Annotations: map[string]string{ | ||
"storageclass.kubernetes.io/is-default-class": "true", | ||
}, | ||
}, | ||
Parameters: map[string]string{ | ||
"type": "gp2", | ||
}, | ||
ReclaimPolicy: &rp, | ||
MountOptions: []string{"debug"}, | ||
} | ||
|
||
if _, err := clientSet.StorageV1().StorageClasses().Create(scb); err != nil { | ||
return errors.Wrap(err, "adding default StorageClass of gp2") | ||
} | ||
|
||
return nil | ||
} |