Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBurger committed Mar 28, 2024
1 parent a14d6a6 commit b2c4ac8
Show file tree
Hide file tree
Showing 29 changed files with 934 additions and 113 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
github.com/google/go-cmp v0.6.0
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.29.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
go.uber.org/atomic v1.10.0
Expand Down Expand Up @@ -120,7 +121,6 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
Expand Down
124 changes: 124 additions & 0 deletions hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
</p>
Resource Types:
<ul><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.BackupBucketConfig">BackupBucketConfig</a>
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.CloudProfileConfig">CloudProfileConfig</a>
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.ControlPlaneConfig">ControlPlaneConfig</a>
Expand All @@ -20,6 +22,52 @@ Resource Types:
</li><li>
<a href="#azure.provider.extensions.gardener.cloud/v1alpha1.WorkerStatus">WorkerStatus</a>
</li></ul>
<h3 id="azure.provider.extensions.gardener.cloud/v1alpha1.BackupBucketConfig">BackupBucketConfig
</h3>
<p>
<p>BackupBucketConfig is the provider-specific configuration for backup buckets</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>BackupBucketConfig</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.CloudProfileConfig">CloudProfileConfig
</h3>
<p>
Expand Down Expand Up @@ -105,6 +153,20 @@ logical names and versions to provider-specific identifiers.</p>
<p>MachineTypes is a list of machine types complete with provider specific information.</p>
</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.ControlPlaneConfig">ControlPlaneConfig
Expand Down Expand Up @@ -478,6 +540,68 @@ string
</tr>
</tbody>
</table>
<h3 id="azure.provider.extensions.gardener.cloud/v1alpha1.BackupEntryConfig">BackupEntryConfig
</h3>
<p>
<p>BackupEntryConfig is the provider-specific configuration for backup entries</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<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.CloudConfiguration">CloudConfiguration
</h3>
<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.BackupEntryConfig">BackupEntryConfig</a>)
</p>
<p>
<p>CloudConfiguration contains detailed config for the cloud to connect to. Currently we only support selection of well-
known Azure-instances by name, but this could be extended in future to support private clouds.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>name</code></br>
<em>
string
</em>
</td>
<td>
<p>Name is the name of the cloud to connect to, e.g. &ldquo;AzurePublic&rdquo; or &ldquo;AzureChina&rdquo;.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="azure.provider.extensions.gardener.cloud/v1alpha1.CloudControllerManagerConfig">CloudControllerManagerConfig
</h3>
<p>
Expand Down
24 changes: 24 additions & 0 deletions pkg/apis/azure/helper/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,30 @@ func CloudProfileConfigFromCluster(cluster *controller.Cluster) (*api.CloudProfi
return cloudProfileConfig, nil
}

// BackupBucketConfigFromBackupBucket TODO
func BackupBucketConfigFromBackupBucket(backupBucket *extensionsv1alpha1.BackupBucket) (*api.BackupBucketConfig, error) {
var backupBucketConfig *api.BackupBucketConfig
if backupBucket != nil && backupBucket.Spec.DefaultSpec.ProviderConfig != nil {
backupBucketConfig = &api.BackupBucketConfig{}
if _, _, err := decoder.Decode(backupBucket.Spec.ProviderConfig.Raw, nil, backupBucketConfig); err != nil {
return nil, err
}
}
return backupBucketConfig, nil
}

// BackupEntryConfigFromBackupBucket TODO
func BackupEntryConfigFromBackupEntry(backupEntry *extensionsv1alpha1.BackupEntry) (*api.BackupEntryConfig, error) {
var backupEntryConfig *api.BackupEntryConfig
if backupEntry != nil && backupEntry.Spec.DefaultSpec.ProviderConfig != nil {
backupEntryConfig = &api.BackupEntryConfig{}
if _, _, err := decoder.Decode(backupEntry.Spec.ProviderConfig.Raw, nil, backupEntryConfig); err != nil {
return nil, err
}
}
return backupEntryConfig, 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
2 changes: 2 additions & 0 deletions pkg/apis/azure/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ControlPlaneConfig{},
&WorkerStatus{},
&WorkerConfig{},
&BackupBucketConfig{},
&BackupEntryConfig{},
)
return nil
}
28 changes: 28 additions & 0 deletions pkg/apis/azure/types_backup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0

package azure

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// InfrastructureConfig infrastructure configuration resource
type BackupBucketConfig struct {
metav1.TypeMeta
// CloudConfiguration contains config that controls which cloud to connect to.
CloudConfiguration *CloudConfiguration
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// BackupEntryConfig is the provider-specific configuration for backup entries
type BackupEntryConfig struct {
metav1.TypeMeta
// CloudConfiguration contains config that controls which cloud to connect to.
// +optional
CloudConfiguration *CloudConfiguration
}
9 changes: 9 additions & 0 deletions pkg/apis/azure/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ type CloudProfileConfig struct {
MachineImages []MachineImages
// MachineTypes is a list of machine types complete with provider specific information.
MachineTypes []MachineType
// CloudConfiguration contains config that controls which cloud to connect to.
CloudConfiguration *CloudConfiguration
}

// CloudConfiguration contains detailed config for the cloud to connect to. Currently we only support selection of well-
// known Azure-instances by name, but this could be extended in future to support private clouds.
type CloudConfiguration struct {
// Name is the name of the cloud to connect to, e.g. "AzurePublic" or "AzureChina".
Name string
}

// DomainCount defines the region and the count for this domain count value.
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/azure/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ControlPlaneConfig{},
&WorkerConfig{},
&WorkerStatus{},
&BackupBucketConfig{},
&BackupEntryConfig{},
)
return nil
}
30 changes: 30 additions & 0 deletions pkg/apis/azure/v1alpha1/types_backup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// BackupBucketConfig is the provider-specific configuration for backup buckets
type BackupBucketConfig struct {
metav1.TypeMeta `json:",inline"`
// CloudConfiguration contains config that controls which cloud to connect to.
// +optional
CloudConfiguration *CloudConfiguration `json:"cloudConfiguration,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// BackupEntryConfig is the provider-specific configuration for backup entries
type BackupEntryConfig struct {
metav1.TypeMeta `json:",inline"`
// CloudConfiguration contains config that controls which cloud to connect to.
// +optional
CloudConfiguration *CloudConfiguration `json:"cloudConfiguration,omitempty"`
}
10 changes: 10 additions & 0 deletions pkg/apis/azure/v1alpha1/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ type CloudProfileConfig struct {
// MachineTypes is a list of machine types complete with provider specific information.
// +optional
MachineTypes []MachineType `json:"machineTypes,omitempty"`
// CloudConfiguration contains config that controls which cloud to connect to.
// +optional
CloudConfiguration *CloudConfiguration `json:"cloudConfiguration,omitempty"`
}

// CloudConfiguration contains detailed config for the cloud to connect to. Currently we only support selection of well-
// known Azure-instances by name, but this could be extended in future to support private clouds.
type CloudConfiguration struct {
// Name is the name of the cloud to connect to, e.g. "AzurePublic" or "AzureChina".
Name string `json:"name,omitempty"`
}

// DomainCount defines the region and the count for this domain count value.
Expand Down
Loading

0 comments on commit b2c4ac8

Please sign in to comment.