Skip to content

Commit

Permalink
remove unneeded objects
Browse files Browse the repository at this point in the history
  • Loading branch information
kon-angelo committed Nov 19, 2024
1 parent 0cb7e16 commit 4602368
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 277 deletions.
51 changes: 1 addition & 50 deletions hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Resource Types:
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.ControlPlaneConfig">ControlPlaneConfig</a>
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.DNSRecordConfig">DNSRecordConfig</a>
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.InfrastructureConfig">InfrastructureConfig</a>
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.WorkerConfig">WorkerConfig</a>
Expand Down Expand Up @@ -230,52 +228,6 @@ Storage
</tr>
</tbody>
</table>
<h3 id="azure.provider.extensions.gardener.cloud/v1alpha1.DNSRecordConfig">DNSRecordConfig
</h3>
<p>
<p>DNSRecordConfig is the provider-specific configuration for DNSRecords.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code></br>
string</td>
<td>
<code>
azure.provider.extensions.gardener.cloud/v1alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code></br>
string
</td>
<td><code>DNSRecordConfig</code></td>
</tr>
<tr>
<td>
<code>cloudConfiguration</code></br>
<em>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.CloudConfiguration">
CloudConfiguration
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>CloudConfiguration contains config that controls which cloud to connect to.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="azure.provider.extensions.gardener.cloud/v1alpha1.InfrastructureConfig">InfrastructureConfig
</h3>
<p>
Expand Down Expand Up @@ -621,8 +573,7 @@ string
<p>
(<em>Appears on:</em>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.BackupBucketConfig">BackupBucketConfig</a>,
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.CloudProfileConfig">CloudProfileConfig</a>,
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.DNSRecordConfig">DNSRecordConfig</a>)
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.CloudProfileConfig">CloudProfileConfig</a>)
</p>
<p>
<p>CloudConfiguration contains detailed config for the cloud to connect to. Currently we only support selection of well-
Expand Down
16 changes: 0 additions & 16 deletions pkg/apis/azure/helper/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,6 @@ func BackupConfigFromBackupBucket(backupBucket *extensionsv1alpha1.BackupBucket)
return backupConfig, nil
}

// DNSRecordConfigFromDNSRecord decodes the provider specific config from a given DNSRecord object.
func DNSRecordConfigFromDNSRecord(dnsRecord *extensionsv1alpha1.DNSRecord) (api.DNSRecordConfig, error) {
dnsRecordConfig := api.DNSRecordConfig{}
if dnsRecord != nil && dnsRecord.Spec.ProviderConfig != nil {
dnsJson, err := dnsRecord.Spec.ProviderConfig.MarshalJSON()
if err != nil {
return dnsRecordConfig, err
}

if _, _, err := decoder.Decode(dnsJson, nil, &dnsRecordConfig); err != nil {
return dnsRecordConfig, err
}
}
return dnsRecordConfig, nil
}

// InfrastructureStateFromRaw extracts the state from the Infrastructure. If no state was available, it returns a "zero" value InfrastructureState object.
func InfrastructureStateFromRaw(raw *runtime.RawExtension) (*api.InfrastructureState, error) {
state := &api.InfrastructureState{}
Expand Down
12 changes: 1 addition & 11 deletions pkg/apis/azure/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ var (

// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CloudProfileConfig{},
&InfrastructureConfig{},
&InfrastructureStatus{},
&InfrastructureState{},
&ControlPlaneConfig{},
&WorkerStatus{},
&WorkerConfig{},
&BackupBucketConfig{},
&DNSRecordConfig{},
)
scheme.AddKnownTypes(SchemeGroupVersion, &CloudProfileConfig{}, &InfrastructureConfig{}, &InfrastructureStatus{}, &InfrastructureState{}, &ControlPlaneConfig{}, &WorkerStatus{}, &WorkerConfig{}, &BackupBucketConfig{})
return nil
}
27 changes: 0 additions & 27 deletions pkg/apis/azure/types_dnsrecord.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/apis/azure/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&WorkerConfig{},
&WorkerStatus{},
&BackupBucketConfig{},
&DNSRecordConfig{},
)
return nil
}
29 changes: 0 additions & 29 deletions pkg/apis/azure/v1alpha1/types_dnsrecord.go

This file was deleted.

30 changes: 0 additions & 30 deletions pkg/apis/azure/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions pkg/apis/azure/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions pkg/apis/azure/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions pkg/azure/client/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package client

import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy"
Expand Down Expand Up @@ -75,8 +74,6 @@ func NewAzureClientFactory(authCredentials *internal.ClientAuth, options ...Azur
option(factory)
}

fmt.Printf("AAAAAAAAAa %v", factory.clientOpts.Cloud)

return *factory, nil
}

Expand Down
19 changes: 0 additions & 19 deletions pkg/controller/dnsrecord/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller"
"github.com/gardener/gardener/extensions/pkg/controller/dnsrecord"
"github.com/gardener/gardener/extensions/pkg/util"
Expand Down Expand Up @@ -90,29 +89,11 @@ func (a *actuator) Reconcile(ctx context.Context, log logr.Logger, dns *extensio

// Delete deletes the DNSRecord.
func (a *actuator) Delete(ctx context.Context, log logr.Logger, dns *extensionsv1alpha1.DNSRecord, _ *extensionscontroller.Cluster) error {
dnsRecordConfig, err := helper.DNSRecordConfigFromDNSRecord(dns)
if err != nil {
return err
}

var azCloudConfiguration cloud.Configuration
// Unlike for the other actuators, both of the values used to determine the cloud instance might be nil - usually the region would not be.
// Default to the public cloud in this case.
if dnsRecordConfig.CloudConfiguration != nil || dns.Spec.Region != nil {
azCloudConfiguration, err = azureclient.AzureCloudConfiguration(dnsRecordConfig.CloudConfiguration, dns.Spec.Region)
if err != nil {
return err
}
} else {
azCloudConfiguration = cloud.AzurePublic
}

clientFactory, err := DefaultAzureClientFactoryFunc(
ctx,
a.client,
dns.Spec.SecretRef,
true,
azureclient.WithCloudConfiguration(azCloudConfiguration),
)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 4602368

Please sign in to comment.