diff --git a/docs/cloud-provider.md b/docs/cloud-provider.md index 74edb7a4a..24979afd7 100644 --- a/docs/cloud-provider.md +++ b/docs/cloud-provider.md @@ -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 diff --git a/pkg/cloudprovider/provider/openstack/provider.go b/pkg/cloudprovider/provider/openstack/provider.go index 542bf1893..37d81d02c 100644 --- a/pkg/cloudprovider/provider/openstack/provider.go +++ b/pkg/cloudprovider/provider/openstack/provider.go @@ -103,6 +103,7 @@ type Config struct { FloatingIPPool string AvailabilityZone string TrustDevicePath bool + ConfigDrive bool RootDiskSizeGB *int RootDiskVolumeType string NodeVolumeAttachLimit *uint @@ -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 @@ -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}}, diff --git a/pkg/cloudprovider/provider/openstack/types/types.go b/pkg/cloudprovider/provider/openstack/types/types.go index b6d33369a..17aed61ee 100644 --- a/pkg/cloudprovider/provider/openstack/types/types.go +++ b/pkg/cloudprovider/provider/openstack/types/types.go @@ -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"` }