Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop cloud provider specific cloud-configs #1802

Merged
merged 1 commit into from
Jun 6, 2024
Merged
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
6 changes: 0 additions & 6 deletions docs/howto-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ Get(machine *v1alpha1.Machine) (instance.Instance, error)

In case the instance cannot be found, the returned error has to be `github.com/kubermatic/machine-controller/pkg/cloudprovider/errors.ErrInstanceNotFound` for proper evaluation by the machine controller.

```go
GetCloudConfig(spec v1alpha1.MachineSpec) (config string, name string, err error)
```

`GetCloudConfig` will return the cloud provider specific cloud-config, which gets consumed by the kubelet.

```go
Create(machine *v1alpha1.Machine, data *cloud.MachineCreateDeleteData, userdata string) (instance.Instance, error)
```
Expand Down
4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/alibaba/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@ func (p *provider) Get(_ context.Context, _ *zap.SugaredLogger, machine *cluster
return nil, fmt.Errorf("instance %v is not ready", foundInstance.InstanceId)
}

func (p *provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (config string, name string, err error) {
return "", "", nil
}

func (p *provider) Create(_ context.Context, _ *zap.SugaredLogger, machine *clusterv1alpha1.Machine, data *cloudprovidertypes.ProviderData, userdata string) (instance.Instance, error) {
c, pc, err := p.getConfig(machine.Spec.ProviderSpec)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/anexia/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,6 @@ func (p *provider) Get(ctx context.Context, log *zap.SugaredLogger, machine *clu
return &instance, nil
}

func (p *provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (string, string, error) {
return "", "", nil
}

func (p *provider) Cleanup(ctx context.Context, log *zap.SugaredLogger, machine *clusterv1alpha1.Machine, data *cloudprovidertypes.ProviderData) (isDeleted bool, retErr error) {
if inst, err := p.Get(ctx, log, machine, data); err != nil {
if cloudprovidererrors.IsNotFound(err) {
Expand Down
22 changes: 0 additions & 22 deletions pkg/cloudprovider/provider/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -917,28 +917,6 @@ func (p *provider) get(ctx context.Context, machine *clusterv1alpha1.Machine) (*
return nil, cloudprovidererrors.ErrInstanceNotFound
}

func (p *provider) GetCloudConfig(spec clusterv1alpha1.MachineSpec) (config string, name string, err error) {
c, _, _, err := p.getConfig(spec.ProviderSpec)
if err != nil {
return "", "", fmt.Errorf("failed to parse config: %w", err)
}

cc := &awstypes.CloudConfig{
Global: awstypes.GlobalOpts{
VPC: c.VpcID,
SubnetID: c.SubnetID,
Zone: c.AvailabilityZone,
},
}

s, err := awstypes.CloudConfigToString(cc)
if err != nil {
return "", "", fmt.Errorf("failed to convert cloud-config to string: %w", err)
}

return s, "aws", nil
}

func (p *provider) MachineMetricsLabels(machine *clusterv1alpha1.Machine) (map[string]string, error) {
labels := make(map[string]string)

Expand Down
83 changes: 0 additions & 83 deletions pkg/cloudprovider/provider/aws/types/cloudconfig.go

This file was deleted.

71 changes: 0 additions & 71 deletions pkg/cloudprovider/provider/aws/types/cloudconfig_test.go

This file was deleted.

12 changes: 0 additions & 12 deletions pkg/cloudprovider/provider/aws/types/testdata/simple-config.golden

This file was deleted.

38 changes: 0 additions & 38 deletions pkg/cloudprovider/provider/azure/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,44 +932,6 @@ func (p *provider) get(ctx context.Context, log *zap.SugaredLogger, machine *clu
return &azureVM{vm: vm, ipAddresses: ipAddresses, status: status}, nil
}

func (p *provider) GetCloudConfig(spec clusterv1alpha1.MachineSpec) (config string, name string, err error) {
c, _, err := p.getConfig(spec.ProviderSpec)
if err != nil {
return "", "", fmt.Errorf("failed to parse config: %w", err)
}

var avSet string
if c.AssignAvailabilitySet == nil && c.AvailabilitySet != "" ||
c.AssignAvailabilitySet != nil && *c.AssignAvailabilitySet && c.AvailabilitySet != "" {
avSet = c.AvailabilitySet
}

cc := &azuretypes.CloudConfig{
Cloud: "AZUREPUBLICCLOUD",
TenantID: c.TenantID,
SubscriptionID: c.SubscriptionID,
AADClientID: c.ClientID,
AADClientSecret: c.ClientSecret,
ResourceGroup: c.ResourceGroup,
VnetResourceGroup: c.VNetResourceGroup,
Location: c.Location,
VNetName: c.VNetName,
SubnetName: c.SubnetName,
LoadBalancerSku: c.LoadBalancerSku,
RouteTableName: c.RouteTableName,
PrimaryAvailabilitySetName: avSet,
SecurityGroupName: c.SecurityGroupName,
UseInstanceMetadata: true,
}

s, err := azuretypes.CloudConfigToString(cc)
if err != nil {
return "", "", fmt.Errorf("failed to convert cloud-config to string: %w", err)
}

return s, "azure", nil
}

func validateDiskSKUs(_ context.Context, c *config, sku compute.ResourceSku) error {
if c.OSDiskSKU != nil || c.DataDiskSKU != nil {
if c.OSDiskSKU != nil {
Expand Down
50 changes: 0 additions & 50 deletions pkg/cloudprovider/provider/azure/types/cloudconfig.go

This file was deleted.

4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/baremetal/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ func (p provider) Get(ctx context.Context, _ *zap.SugaredLogger, machine *cluste
}, nil
}

func (p provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (config string, name string, err error) {
return "", "", nil
}

func (p provider) Create(ctx context.Context, _ *zap.SugaredLogger, machine *clusterv1alpha1.Machine, data *cloudprovidertypes.ProviderData, userdata string) (instance.Instance, error) {
c, _, err := p.getConfig(machine.Spec.ProviderSpec)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/digitalocean/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,6 @@ func (p *provider) MigrateUID(ctx context.Context, _ *zap.SugaredLogger, machine
return nil
}

func (p *provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (config string, name string, err error) {
return "", "", nil
}

func (p *provider) MachineMetricsLabels(machine *clusterv1alpha1.Machine) (map[string]string, error) {
labels := make(map[string]string)

Expand Down
4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/edge/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ func (p *provider) Get(_ context.Context, _ *zap.SugaredLogger, _ *clusterv1alph
return CloudProviderInstance{}, nil
}

func (p *provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (string, string, error) {
return "", "", nil
}

// Create creates a cloud instance according to the given machine.
func (p *provider) Create(_ context.Context, _ *zap.SugaredLogger, _ *clusterv1alpha1.Machine, _ *cloudprovidertypes.ProviderData, _ string) (instance.Instance, error) {
return CloudProviderInstance{}, nil
Expand Down
4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/equinixmetal/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,6 @@ func (p *provider) MigrateUID(_ context.Context, log *zap.SugaredLogger, machine
return nil
}

func (p *provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (config string, name string, err error) {
return "", "", nil
}

func (p *provider) MachineMetricsLabels(machine *clusterv1alpha1.Machine) (map[string]string, error) {
labels := make(map[string]string)

Expand Down
4 changes: 0 additions & 4 deletions pkg/cloudprovider/provider/fake/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ func (p *provider) Get(_ context.Context, _ *zap.SugaredLogger, _ *clusterv1alph
return CloudProviderInstance{}, nil
}

func (p *provider) GetCloudConfig(_ clusterv1alpha1.MachineSpec) (string, string, error) {
return "", "", nil
}

// Create creates a cloud instance according to the given machine.
func (p *provider) Create(_ context.Context, _ *zap.SugaredLogger, _ *clusterv1alpha1.Machine, _ *cloudprovidertypes.ProviderData, _ string) (instance.Instance, error) {
return CloudProviderInstance{}, nil
Expand Down
Loading