Skip to content

Commit

Permalink
Use WorkerPool ProviderConfig for Ignition and ServerLabels
Browse files Browse the repository at this point in the history
  • Loading branch information
defo89 committed Nov 6, 2024
1 parent 9c0728a commit 5d5951a
Show file tree
Hide file tree
Showing 16 changed files with 191 additions and 266 deletions.
5 changes: 0 additions & 5 deletions example/30-infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,3 @@ spec:
providerConfig:
apiVersion: metal.provider.extensions.gardener.cloud/v1alpha1
kind: InfrastructureConfig
worker:
WORKER_POOL_NAME:
extraIgnition:
raw: "the-ignition"
# override: true
8 changes: 8 additions & 0 deletions example/30-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ spec:
zones:
- my-machine-pool-a
- my-machine-pool-b
providerConfig:
apiVersion: metal.provider.extensions.gardener.cloud/v1alpha1
kind: WorkerConfig
extraIgnition:
raw: "the-ignition"
# override: true
serverLabels:
foo: bar
177 changes: 51 additions & 126 deletions hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Resource Types:
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.CloudProfileConfig">CloudProfileConfig</a>
</li><li>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.ControlPlaneConfig">ControlPlaneConfig</a>
</li><li>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.IgnitionConfig">IgnitionConfig</a>
</li></ul>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.CloudProfileConfig">CloudProfileConfig
</h3>
Expand Down Expand Up @@ -74,18 +72,6 @@ logical names and versions to provider-specific identifiers.</p>
<p>RegionConfigs is the list of supported regions.</p>
</td>
</tr>
<tr>
<td>
<code>machineTypes</code></br>
<em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.MachineType">
[]MachineType
</a>
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.ControlPlaneConfig">ControlPlaneConfig
Expand Down Expand Up @@ -148,67 +134,6 @@ LoadBalancerConfig
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.IgnitionConfig">IgnitionConfig
</h3>
<p>
(<em>Appears on:</em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.WorkerConfig">WorkerConfig</a>)
</p>
<p>
<p>IgnitionConfig contains ignition settings.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code></br>
string</td>
<td>
<code>
metal.provider.extensions.gardener.cloud/v1alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code></br>
string
</td>
<td><code>IgnitionConfig</code></td>
</tr>
<tr>
<td>
<code>raw</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Raw contains an inline ignition config, which is merged with the config from the os extension.</p>
</td>
</tr>
<tr>
<td>
<code>override</code></br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Override configures, if ignition keys set by the os-extension are overridden
by extra ignition.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.BgpPeer">BgpPeer
</h3>
<p>
Expand Down Expand Up @@ -373,10 +298,14 @@ map[string]bool
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.InfrastructureConfig">InfrastructureConfig
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.IgnitionConfig">IgnitionConfig
</h3>
<p>
<p>InfrastructureConfig infrastructure configuration resource</p>
(<em>Appears on:</em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.WorkerConfig">WorkerConfig</a>)
</p>
<p>
<p>IgnitionConfig contains ignition settings.</p>
</p>
<table>
<thead>
Expand All @@ -388,20 +317,46 @@ map[string]bool
<tbody>
<tr>
<td>
<code>worker</code></br>
<code>raw</code></br>
<em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.WorkerConfig">
map[string]./pkg/apis/metal/v1alpha1.WorkerConfig
</a>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Worker contains settings per worker pool specific to the metal-operator</p>
<p>Raw contains an inline ignition config, which is merged with the config from the os extension.</p>
</td>
</tr>
<tr>
<td>
<code>override</code></br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Override configures, if ignition keys set by the os-extension are overridden
by extra ignition.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.InfrastructureConfig">InfrastructureConfig
</h3>
<p>
<p>InfrastructureConfig infrastructure configuration resource</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.InfrastructureStatus">InfrastructureStatus
</h3>
<p>
Expand Down Expand Up @@ -624,44 +579,6 @@ string
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.MachineType">MachineType
</h3>
<p>
(<em>Appears on:</em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.CloudProfileConfig">CloudProfileConfig</a>)
</p>
<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>
</td>
</tr>
<tr>
<td>
<code>serverLabels</code></br>
<em>
map[string]string
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.MetallbConfig">MetallbConfig
</h3>
<p>
Expand Down Expand Up @@ -772,11 +689,7 @@ string
<h3 id="metal.provider.extensions.gardener.cloud/v1alpha1.WorkerConfig">WorkerConfig
</h3>
<p>
(<em>Appears on:</em>
<a href="#metal.provider.extensions.gardener.cloud/v1alpha1.InfrastructureConfig">InfrastructureConfig</a>)
</p>
<p>
<p>WorkerConfig contains settings per pool, which are specific to the metal-operator.</p>
<p>WorkerConfig contains configuration settings for the worker nodes.</p>
</p>
<table>
<thead>
Expand All @@ -797,7 +710,19 @@ IgnitionConfig
</td>
<td>
<em>(Optional)</em>
<p>ExtraIgnition contains additional ignition configuration.</p>
<p>ExtraIgnition contains additional Ignition for Worker nodes.</p>
</td>
</tr>
<tr>
<td>
<code>serverLabels</code></br>
<em>
map[string]string
</em>
</td>
<td>
<em>(Optional)</em>
<p>ServerLabels is a map of labels that are applied to the ServerClaim for Server selection.</p>
</td>
</tr>
</tbody>
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/metal/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&InfrastructureConfig{},
&InfrastructureStatus{},
&ControlPlaneConfig{},
&WorkerConfig{},
&WorkerStatus{},
)
return nil
Expand Down
13 changes: 0 additions & 13 deletions pkg/apis/metal/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,11 @@ import (
)

// +genclient

// IgnitionConfig contains ignition settings.
type IgnitionConfig struct {
Raw string
Override bool
}

// WorkerConfig contains settings per pool, which are specific to the metal-operator.
type WorkerConfig struct {
ExtraIgnition *IgnitionConfig
}

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

// InfrastructureConfig infrastructure configuration resource
type InfrastructureConfig struct {
metav1.TypeMeta
Worker map[string]WorkerConfig
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
17 changes: 17 additions & 0 deletions pkg/apis/metal/types_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// WorkerConfig contains configuration settings for the worker nodes.
type WorkerConfig struct {
metav1.TypeMeta
// ExtraIgnition contains additional Ignition for Worker nodes.
ExtraIgnition *IgnitionConfig
// ExtraServerLabels is a map of extra labels that are applied to the ServerClaim for Server selection.
ExtraServerLabels map[string]string
}

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

// WorkerStatus contains information about created worker resources.
type WorkerStatus struct {
metav1.TypeMeta
Expand All @@ -33,3 +44,9 @@ type MachineImage struct {
// Architecture is the CPU architecture of the machine image.
Architecture *string
}

// IgnitionConfig contains ignition settings.
type IgnitionConfig struct {
Raw string
Override bool
}
1 change: 1 addition & 0 deletions pkg/apis/metal/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&InfrastructureConfig{},
&InfrastructureStatus{},
&ControlPlaneConfig{},
&WorkerConfig{},
&WorkerStatus{},
)
return nil
Expand Down
23 changes: 0 additions & 23 deletions pkg/apis/metal/v1alpha1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,11 @@ import (

// +genclient

// IgnitionConfig contains ignition settings.
type IgnitionConfig struct {
// Raw contains an inline ignition config, which is merged with the config from the os extension.
// +optional
Raw string `json:"raw,omitempty"`

// Override configures, if ignition keys set by the os-extension are overridden
// by extra ignition.
// +optional
Override bool `json:"override,omitempty"`
}

// WorkerConfig contains settings per pool, which are specific to the metal-operator.
type WorkerConfig struct {
// ExtraIgnition contains additional ignition configuration.
// +optional
ExtraIgnition *IgnitionConfig `json:"extraIgnition,omitempty"`
}

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

// InfrastructureConfig infrastructure configuration resource
type InfrastructureConfig struct {
metav1.TypeMeta `json:",inline"`

// Worker contains settings per worker pool specific to the metal-operator
// +optional
Worker map[string]WorkerConfig `json:"worker,omitempty"`
}

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

0 comments on commit 5d5951a

Please sign in to comment.