Skip to content

Commit

Permalink
OpenStack: Support enabling cloud drive
Browse files Browse the repository at this point in the history
Signed-off-by: Waleed Malik <[email protected]>
  • Loading branch information
ahmedwaleedmalik committed Jul 23, 2024
1 parent 7a3746a commit b9c8814
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/cloud-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ network: ""
computeAPIVersion: ""
# set trust-device-path flag for kubelet
trustDevicePath: false
# set to true to store metadata on a configuration drive instead of the metadata service
configDrive: false
# set root disk size
rootDiskSizeGB: 50
# set root disk volume type
Expand Down
7 changes: 7 additions & 0 deletions pkg/cloudprovider/provider/openstack/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type Config struct {
FloatingIPPool string
AvailabilityZone string
TrustDevicePath bool
ConfigDrive bool
RootDiskSizeGB *int
RootDiskVolumeType string
NodeVolumeAttachLimit *uint
Expand Down Expand Up @@ -267,6 +268,11 @@ func (p *provider) getConfig(provSpec clusterv1alpha1.ProviderSpec) (*Config, *p
return nil, nil, nil, err
}

cfg.ConfigDrive, _, err = p.configVarResolver.GetConfigVarBoolValue(rawConfig.ConfigDrive)
if err != nil {
return nil, nil, nil, err
}

cfg.ComputeAPIVersion, err = p.configVarResolver.GetConfigVarStringValue(rawConfig.ComputeAPIVersion)
if err != nil {
return nil, nil, nil, err
Expand Down Expand Up @@ -611,6 +617,7 @@ func (p *provider) Create(ctx context.Context, log *zap.SugaredLogger, machine *
Name: machine.Spec.Name,
FlavorRef: flavor.ID,
UserData: []byte(userdata),
ConfigDrive: &cfg.ConfigDrive,
SecurityGroups: securityGroups,
AvailabilityZone: cfg.AvailabilityZone,
Networks: []osservers.Network{{UUID: network.ID}},
Expand Down
1 change: 1 addition & 0 deletions pkg/cloudprovider/provider/openstack/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type RawConfig struct {
RootDiskVolumeType providerconfigtypes.ConfigVarString `json:"rootDiskVolumeType,omitempty"`
NodeVolumeAttachLimit *uint `json:"nodeVolumeAttachLimit"`
ServerGroup providerconfigtypes.ConfigVarString `json:"serverGroup"`
ConfigDrive providerconfigtypes.ConfigVarBool `json:"configDrive,omitempty"`
// This tag is related to server metadata, not compute server's tag
Tags map[string]string `json:"tags,omitempty"`
}
Expand Down

0 comments on commit b9c8814

Please sign in to comment.