Skip to content
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
13 changes: 13 additions & 0 deletions cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type CreateClusterOptions struct {

ControlPlaneVolumeSize int32
NodeVolumeSize int32
ControlPlaneVolumeType string
ContainerRuntime string
OutDir string
DisableSubnetTags bool
Expand Down Expand Up @@ -301,6 +302,9 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
cmd.Flags().Int32Var(&options.ControlPlaneVolumeSize, "control-plane-volume-size", options.ControlPlaneVolumeSize, "Instance volume size (in GB) for control-plane nodes")
cmd.Flags().Int32Var(&options.NodeVolumeSize, "node-volume-size", options.NodeVolumeSize, "Instance volume size (in GB) for worker nodes")

cmd.Flags().StringVar(&options.ControlPlaneVolumeType, "control-plane-volume-type", options.ControlPlaneVolumeType, "Instance volume type for control-plane nodes")
cmd.RegisterFlagCompletionFunc("control-plane-volume-type", completeStorageType)

cmd.Flags().StringVar(&options.NetworkID, "vpc", options.NetworkID, "Shared Network or VPC to use")
cmd.Flags().MarkDeprecated("vpc", "use --network-id instead")
cmd.RegisterFlagCompletionFunc("vpc", completeNetworkID)
Expand Down Expand Up @@ -616,6 +620,15 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr
}
}

if c.ControlPlaneVolumeType != "" {
for _, group := range controlPlanes {
if group.Spec.RootVolume == nil {
group.Spec.RootVolume = &api.InstanceRootVolumeSpec{}
}
group.Spec.RootVolume.Type = fi.PtrTo(c.ControlPlaneVolumeType)
}
}

if c.NodeVolumeSize != 0 {
for _, group := range nodes {
if group.Spec.RootVolume == nil {
Expand Down
5 changes: 5 additions & 0 deletions cmd/kops/create_cluster_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func TestCreateClusterCilium(t *testing.T) {
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/cilium-eni", "v1alpha2")
}

// TestCreateClusterVolumeType tests the control plane volume type flag
func TestCreateClusterVolumeType(t *testing.T) {
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/volume_type", "v1alpha2")
}

// TestCreateClusterOverride tests the override flag
func TestCreateClusterOverride(t *testing.T) {
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/overrides", "v1alpha2")
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/kops/validation/instancegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ func CrossValidateInstanceGroup(g *kops.InstanceGroup, cluster *kops.Cluster, cl
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "warmPool", "minSize"), warmPool.MinSize, "warm pool minSize cannot be negative"))
}
}
//TODO: Add RootVolume validation for other cloud providers ex. GCE

if g.Spec.Containerd != nil {
allErrs = append(allErrs, validateContainerdConfig(cluster, g.Spec.Containerd, field.NewPath("spec", "containerd"), false)...)
Expand All @@ -312,6 +313,10 @@ func ValidateControlPlaneInstanceGroup(g *kops.InstanceGroup, cluster *kops.Clus
return allErrs
}

func validateRootVolumeType(g *kops.InstanceGroup) {

}

var validUserDataTypes = []string{
"text/x-include-once-url",
"text/x-include-url",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: volume-types.example.com
spec:
api:
loadBalancer:
type: Public
authorization:
rbac: {}
channel: stable
cloudConfig: {}
cloudProvider: gce
configBase: memfs://tests/volume-types.example.com
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: control-plane-us-test-1a
name: a
manager:
backupRetentionDays: 90
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: control-plane-us-test-1a
name: a
manager:
backupRetentionDays: 90
memoryRequest: 100Mi
name: events
iam:
allowContainerRegistry: true
legacy: false
kubelet:
anonymousAuth: false
kubernetesApiAccess:
- 0.0.0.0/0
- ::/0
kubernetesVersion: v1.32.0
networking:
cni: {}
nonMasqueradeCIDR: 100.64.0.0/10
project: camilabustos-gke-dev-new
sshAccess:
- 0.0.0.0/0
- ::/0
subnets:
- cidr: 10.0.16.0/20
name: us-test
region: us-test
type: Public
topology:
dns:
type: None

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: volume-types.example.com
name: control-plane-us-test-1a
spec:
image: ubuntu-os-cloud/ubuntu-2404-noble-amd64-v20250606
machineType: e2-medium
maxSize: 1
minSize: 1
role: Master
rootVolumeSize: 32
rootVolumeType: pd-balanced
subnets:
- us-test
zones:
- us-test-1a

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: volume-types.example.com
name: nodes-us-test-1a
spec:
image: ubuntu-os-cloud/ubuntu-2404-noble-amd64-v20250606
machineType: e2-medium
maxSize: 1
minSize: 1
role: Node
rootVolumeSize: 64
subnets:
- us-test
zones:
- us-test-1a
9 changes: 9 additions & 0 deletions tests/integration/create_cluster/volume_type/options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ClusterName: volume-types.example.com
Zones:
- us-test-1a
CloudProvider: gce
Networking: cni
KubernetesVersion: v1.32.0
ControlPlaneVolumeSize: 32
ControlPlaneVolumeType: pd-balanced
NodeVolumeSize: 64
Loading