Skip to content

Commit

Permalink
Merge pull request #35 from banzaicloud/default-storage-class
Browse files Browse the repository at this point in the history
Make default storage class optional
  • Loading branch information
Ecsy authored Apr 29, 2019
2 parents 36dcf00 + d5cad80 commit 826e7f2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmd/pke/app/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ const (
FlagAzureLoadBalancerSku = "azure-loadbalancer-sku"
// FlagAzureRouteTableName the name of the route table attached to the subnet that the cluster is deployed in.
FlagAzureRouteTableName = "azure-route-table-name"

// FlagDisableDefaultStorageClass adds default storage class.
FlagDisableDefaultStorageClass = "disable-default-storage-class"
)

var (
Expand Down
9 changes: 8 additions & 1 deletion cmd/pke/app/phases/kubeadm/controlplane/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type ControlPlane struct {
azureRouteTableName string
azureExcludeMasterFromStandardLB bool
cidr string
disableDefaultStorageClass bool
}

func NewCommand(out io.Writer) *cobra.Command {
Expand Down Expand Up @@ -174,6 +175,8 @@ func (c *ControlPlane) RegisterFlags(flags *pflag.FlagSet) {
flags.Int32(constants.FlagPipelineOrganizationID, 0, "Organization ID to use with Pipeline API")
flags.Int32(constants.FlagPipelineClusterID, 0, "Cluster ID to use with Pipeline API")
flags.String(constants.FlagInfrastructureCIDR, "192.168.64.0/20", "network CIDR for the actual machine")
// Storage class
flags.Bool(constants.FlagDisableDefaultStorageClass, false, "Do not deploy a default storage class")

c.addHAControlPlaneFlags(flags)
}
Expand Down Expand Up @@ -549,6 +552,10 @@ func (c *ControlPlane) masterBootstrapParameters(cmd *cobra.Command) (err error)
return
}
c.cidr, err = cmd.Flags().GetString(constants.FlagInfrastructureCIDR)
if err != nil {
return
}
c.disableDefaultStorageClass, err = cmd.Flags().GetBool(constants.FlagDisableDefaultStorageClass)

return
}
Expand Down Expand Up @@ -637,7 +644,7 @@ func (c *ControlPlane) installMaster(out io.Writer) error {
}

// apply default storage class
if err := applyDefaultStorageClass(out, c.cloudProvider); err != nil {
if err := applyDefaultStorageClass(out, c.disableDefaultStorageClass, c.cloudProvider); err != nil {
return err
}

Expand Down
6 changes: 5 additions & 1 deletion cmd/pke/app/phases/kubeadm/controlplane/storage_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import (
"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
)

func applyDefaultStorageClass(out io.Writer, cloudProvider string) error {
func applyDefaultStorageClass(out io.Writer, disableDefaultStorageClass bool, cloudProvider string) error {
if disableDefaultStorageClass {
return nil
}

var err error
switch cloudProvider {
case constants.CloudProviderAmazon:
Expand Down
1 change: 1 addition & 0 deletions cmd/pke/docs/pke_install_master.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pke install master [flags]
--azure-vm-type string The type of azure nodes. Candidate values are: vmss and standard (default "standard")
--azure-vnet-name string The name of the VNet that the cluster is deployed in
--azure-vnet-resource-group string The name of the resource group that the Vnet is deployed in
--disable-default-storage-class Do not deploy a default storage class
-h, --help help for master
--image-repository string Prefix for image repository (default "banzaicloud")
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
Expand Down
1 change: 1 addition & 0 deletions cmd/pke/docs/pke_install_master_kubernetes-controlplane.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pke install master kubernetes-controlplane [flags]
--azure-vm-type string The type of azure nodes. Candidate values are: vmss and standard (default "standard")
--azure-vnet-name string The name of the VNet that the cluster is deployed in
--azure-vnet-resource-group string The name of the resource group that the Vnet is deployed in
--disable-default-storage-class Do not deploy a default storage class
-h, --help help for kubernetes-controlplane
--image-repository string Prefix for image repository (default "banzaicloud")
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
Expand Down
1 change: 1 addition & 0 deletions cmd/pke/docs/pke_install_single.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pke install single [flags]
--azure-vm-type string The type of azure nodes. Candidate values are: vmss and standard (default "standard")
--azure-vnet-name string The name of the VNet that the cluster is deployed in
--azure-vnet-resource-group string The name of the resource group that the Vnet is deployed in
--disable-default-storage-class Do not deploy a default storage class
-h, --help help for single
--image-repository string Prefix for image repository (default "banzaicloud")
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
Expand Down
1 change: 1 addition & 0 deletions cmd/pke/docs/pke_install_single_kubernetes-controlplane.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pke install single kubernetes-controlplane [flags]
--azure-vm-type string The type of azure nodes. Candidate values are: vmss and standard (default "standard")
--azure-vnet-name string The name of the VNet that the cluster is deployed in
--azure-vnet-resource-group string The name of the resource group that the Vnet is deployed in
--disable-default-storage-class Do not deploy a default storage class
-h, --help help for kubernetes-controlplane
--image-repository string Prefix for image repository (default "banzaicloud")
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
Expand Down

0 comments on commit 826e7f2

Please sign in to comment.