Skip to content

Commit

Permalink
Add CCM Networking config (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
defo89 authored Dec 20, 2024
1 parent 1e045fe commit 78454ab
Show file tree
Hide file tree
Showing 12 changed files with 285 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ metadata:
data:
cloudprovider.conf: |
clusterName: {{ .Values.clusterName }}
networking:
configureNodeAddresses: {{ .Values.networking.configureNodeAddresses }}
2 changes: 2 additions & 0 deletions charts/internal/cloud-provider-config/values.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
clusterName: test
networking:
configureNodeAddresses: true
45 changes: 45 additions & 0 deletions hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,51 @@ map[string]bool
<p>FeatureGates contains information about enabled feature gates.</p>
</td>
</tr>
<tr>
<td>
<code>networking</code></br>
<em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.CloudControllerNetworking">
CloudControllerNetworking
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Networking contains configuration settings for CCM networking.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.CloudControllerNetworking">CloudControllerNetworking
</h3>
<p>
(<em>Appears on:</em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.CloudControllerManagerConfig">CloudControllerManagerConfig</a>)
</p>
<p>
<p>CloudControllerNetworking contains configuration settings for CCM networking.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>configureNodeAddresses</code></br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>ConfigureNodeAddresses enables the configuration of node addresses.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.IgnitionConfig">IgnitionConfig
Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/metal/types_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ type ControlPlaneConfig struct {
LoadBalancerConfig *LoadBalancerConfig
}

// CloudControllerNetworking contains configuration settings for CCM networking.
type CloudControllerNetworking struct {
// ConfigureNodeAddresses enables the configuration of node addresses.
ConfigureNodeAddresses bool
}

// CloudControllerManagerConfig contains configuration settings for the cloud-controller-manager.
type CloudControllerManagerConfig struct {
// FeatureGates contains information about enabled feature gates.
FeatureGates map[string]bool

// Networking contains configuration settings for CCM networking.
Networking *CloudControllerNetworking
}

// LoadBalancerConfig contains configuration settings for the shoot loadbalancing.
Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/metal/v1alpha1/types_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@ type ControlPlaneConfig struct {
LoadBalancerConfig *LoadBalancerConfig `json:"loadBalancerConfig,omitempty"`
}

// CloudControllerNetworking contains configuration settings for CCM networking.
type CloudControllerNetworking struct {
// ConfigureNodeAddresses enables the configuration of node addresses.
// +optional
ConfigureNodeAddresses bool `json:"configureNodeAddresses,omitempty"`
}

// CloudControllerManagerConfig contains configuration settings for the cloud-controller-manager.
type CloudControllerManagerConfig struct {
// FeatureGates contains information about enabled feature gates.
// +optional
FeatureGates map[string]bool `json:"featureGates,omitempty"`

// Networking contains configuration settings for CCM networking.
// +optional
Networking *CloudControllerNetworking `json:"networking,omitempty"`
}

// LoadBalancerConfig contains configuration settings for the shoot loadbalancing.
Expand Down
32 changes: 32 additions & 0 deletions pkg/apis/metal/v1alpha1/zz_generated.conversion.go

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

21 changes: 21 additions & 0 deletions pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 2 additions & 1 deletion pkg/apis/metal/validation/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"

apismetal "github.com/ironcore-dev/gardener-extension-provider-metal/pkg/apis/metal"
"github.com/ironcore-dev/gardener-extension-provider-metal/pkg/metal"
)

// ValidateControlPlaneConfig validates a ControlPlaneConfig object.
func ValidateControlPlaneConfig(controlPlaneConfig *apismetal.ControlPlaneConfig, version string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}

if controlPlaneConfig.CloudControllerManager != nil {
allErrs = append(allErrs, featurevalidation.ValidateFeatureGates(controlPlaneConfig.CloudControllerManager.FeatureGates, version, fldPath.Child("cloudControllerManager", "featureGates"))...)
allErrs = append(allErrs, featurevalidation.ValidateFeatureGates(controlPlaneConfig.CloudControllerManager.FeatureGates, version, fldPath.Child("cloudControllerManager", metal.CloudControllerManagerFeatureGatesKeyName))...)
}

// TODO add validation for IPs
Expand Down
21 changes: 21 additions & 0 deletions pkg/apis/metal/zz_generated.deepcopy.go

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

7 changes: 6 additions & 1 deletion pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,12 @@ func getCCMChartValues(
}

if cpConfig.CloudControllerManager != nil {
values["featureGates"] = cpConfig.CloudControllerManager.FeatureGates
values[metal.CloudControllerManagerFeatureGatesKeyName] = cpConfig.CloudControllerManager.FeatureGates
if cpConfig.CloudControllerManager.Networking != nil {
values[metal.CloudControllerManagerNetworkingKeyName] = map[string]any{
metal.CloudControllerManagerNodeAddressesConfigKeyName: cpConfig.CloudControllerManager.Networking.ConfigureNodeAddresses,
}
}
}

overlayEnabled, err := isOverlayEnabled(cluster.Shoot.Spec.Networking)
Expand Down
Loading

0 comments on commit 78454ab

Please sign in to comment.