Skip to content

Commit ca7639b

Browse files
committed
Add Additional Options to CAPIO API
Currently operator's API only allows to set common, most popular provider options. But sometimes it is necessary to specify non-standard options that the operator is not aware about. To do this we add a new API field called "AdditionalOptions" of type map[string]string. Every key there will be attached to provider's starting command.
1 parent a1fea6a commit ca7639b

14 files changed

+287
-2
lines changed

api/v1alpha1/provider_conversion.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ func (src *BootstrapProvider) ConvertTo(dstRaw conversion.Hub) error {
4848
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments
4949
dst.Spec.FetchConfig.OCI = restored.Spec.FetchConfig.OCI
5050

51+
if restored.Spec.ProviderSpec.Manager != nil {
52+
dst.Spec.ProviderSpec.Manager.AdditionalArgs = restored.Spec.ProviderSpec.Manager.AdditionalArgs
53+
}
54+
5155
return nil
5256
}
5357

@@ -111,6 +115,10 @@ func (src *ControlPlaneProvider) ConvertTo(dstRaw conversion.Hub) error {
111115
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments
112116
dst.Spec.FetchConfig.OCI = restored.Spec.FetchConfig.OCI
113117

118+
if restored.Spec.ProviderSpec.Manager != nil {
119+
dst.Spec.ProviderSpec.Manager.AdditionalArgs = restored.Spec.ProviderSpec.Manager.AdditionalArgs
120+
}
121+
114122
return nil
115123
}
116124

@@ -174,6 +182,10 @@ func (src *CoreProvider) ConvertTo(dstRaw conversion.Hub) error {
174182
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments
175183
dst.Spec.FetchConfig.OCI = restored.Spec.FetchConfig.OCI
176184

185+
if restored.Spec.ProviderSpec.Manager != nil {
186+
dst.Spec.ProviderSpec.Manager.AdditionalArgs = restored.Spec.ProviderSpec.Manager.AdditionalArgs
187+
}
188+
177189
return nil
178190
}
179191

@@ -237,6 +249,10 @@ func (src *InfrastructureProvider) ConvertTo(dstRaw conversion.Hub) error {
237249
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments
238250
dst.Spec.FetchConfig.OCI = restored.Spec.FetchConfig.OCI
239251

252+
if restored.Spec.ProviderSpec.Manager != nil {
253+
dst.Spec.ProviderSpec.Manager.AdditionalArgs = restored.Spec.ProviderSpec.Manager.AdditionalArgs
254+
}
255+
240256
return nil
241257
}
242258

api/v1alpha1/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha2/provider_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ type ManagerSpec struct {
150150
// in as container args to the provider's controller manager.
151151
// Controller Manager flag is --feature-gates.
152152
FeatureGates map[string]bool `json:"featureGates,omitempty"`
153+
154+
// AdditionalArgs is a map of additional options that will be passed
155+
// in as container args to the provider's controller manager.
156+
// +optional
157+
AdditionalArgs map[string]string `json:"additionalArgs,omitempty"`
153158
}
154159

155160
// DeploymentSpec defines the properties that can be enabled on the Deployment for the provider.

api/v1alpha2/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/operator.cluster.x-k8s.io_addonproviders.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,13 @@ spec:
12911291
description: Manager defines the properties that can be enabled
12921292
on the controller manager for the additional provider deployment.
12931293
properties:
1294+
additionalArgs:
1295+
additionalProperties:
1296+
type: string
1297+
description: |-
1298+
AdditionalArgs is a map of additional options that will be passed
1299+
in as container args to the provider's controller manager.
1300+
type: object
12941301
cacheNamespace:
12951302
description: |-
12961303
CacheNamespace if specified restricts the manager's cache to watch objects in
@@ -2822,6 +2829,13 @@ spec:
28222829
description: Manager defines the properties that can be enabled on
28232830
the controller manager for the provider.
28242831
properties:
2832+
additionalArgs:
2833+
additionalProperties:
2834+
type: string
2835+
description: |-
2836+
AdditionalArgs is a map of additional options that will be passed
2837+
in as container args to the provider's controller manager.
2838+
type: object
28252839
cacheNamespace:
28262840
description: |-
28272841
CacheNamespace if specified restricts the manager's cache to watch objects in

config/crd/bases/operator.cluster.x-k8s.io_bootstrapproviders.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,6 +2928,13 @@ spec:
29282928
description: Manager defines the properties that can be enabled
29292929
on the controller manager for the additional provider deployment.
29302930
properties:
2931+
additionalArgs:
2932+
additionalProperties:
2933+
type: string
2934+
description: |-
2935+
AdditionalArgs is a map of additional options that will be passed
2936+
in as container args to the provider's controller manager.
2937+
type: object
29312938
cacheNamespace:
29322939
description: |-
29332940
CacheNamespace if specified restricts the manager's cache to watch objects in
@@ -4459,6 +4466,13 @@ spec:
44594466
description: Manager defines the properties that can be enabled on
44604467
the controller manager for the provider.
44614468
properties:
4469+
additionalArgs:
4470+
additionalProperties:
4471+
type: string
4472+
description: |-
4473+
AdditionalArgs is a map of additional options that will be passed
4474+
in as container args to the provider's controller manager.
4475+
type: object
44624476
cacheNamespace:
44634477
description: |-
44644478
CacheNamespace if specified restricts the manager's cache to watch objects in

config/crd/bases/operator.cluster.x-k8s.io_controlplaneproviders.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,6 +2930,13 @@ spec:
29302930
description: Manager defines the properties that can be enabled
29312931
on the controller manager for the additional provider deployment.
29322932
properties:
2933+
additionalArgs:
2934+
additionalProperties:
2935+
type: string
2936+
description: |-
2937+
AdditionalArgs is a map of additional options that will be passed
2938+
in as container args to the provider's controller manager.
2939+
type: object
29332940
cacheNamespace:
29342941
description: |-
29352942
CacheNamespace if specified restricts the manager's cache to watch objects in
@@ -4461,6 +4468,13 @@ spec:
44614468
description: Manager defines the properties that can be enabled on
44624469
the controller manager for the provider.
44634470
properties:
4471+
additionalArgs:
4472+
additionalProperties:
4473+
type: string
4474+
description: |-
4475+
AdditionalArgs is a map of additional options that will be passed
4476+
in as container args to the provider's controller manager.
4477+
type: object
44644478
cacheNamespace:
44654479
description: |-
44664480
CacheNamespace if specified restricts the manager's cache to watch objects in

config/crd/bases/operator.cluster.x-k8s.io_coreproviders.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,6 +2928,13 @@ spec:
29282928
description: Manager defines the properties that can be enabled
29292929
on the controller manager for the additional provider deployment.
29302930
properties:
2931+
additionalArgs:
2932+
additionalProperties:
2933+
type: string
2934+
description: |-
2935+
AdditionalArgs is a map of additional options that will be passed
2936+
in as container args to the provider's controller manager.
2937+
type: object
29312938
cacheNamespace:
29322939
description: |-
29332940
CacheNamespace if specified restricts the manager's cache to watch objects in
@@ -4459,6 +4466,13 @@ spec:
44594466
description: Manager defines the properties that can be enabled on
44604467
the controller manager for the provider.
44614468
properties:
4469+
additionalArgs:
4470+
additionalProperties:
4471+
type: string
4472+
description: |-
4473+
AdditionalArgs is a map of additional options that will be passed
4474+
in as container args to the provider's controller manager.
4475+
type: object
44624476
cacheNamespace:
44634477
description: |-
44644478
CacheNamespace if specified restricts the manager's cache to watch objects in

config/crd/bases/operator.cluster.x-k8s.io_infrastructureproviders.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,6 +2930,13 @@ spec:
29302930
description: Manager defines the properties that can be enabled
29312931
on the controller manager for the additional provider deployment.
29322932
properties:
2933+
additionalArgs:
2934+
additionalProperties:
2935+
type: string
2936+
description: |-
2937+
AdditionalArgs is a map of additional options that will be passed
2938+
in as container args to the provider's controller manager.
2939+
type: object
29332940
cacheNamespace:
29342941
description: |-
29352942
CacheNamespace if specified restricts the manager's cache to watch objects in
@@ -4461,6 +4468,13 @@ spec:
44614468
description: Manager defines the properties that can be enabled on
44624469
the controller manager for the provider.
44634470
properties:
4471+
additionalArgs:
4472+
additionalProperties:
4473+
type: string
4474+
description: |-
4475+
AdditionalArgs is a map of additional options that will be passed
4476+
in as container args to the provider's controller manager.
4477+
type: object
44644478
cacheNamespace:
44654479
description: |-
44664480
CacheNamespace if specified restricts the manager's cache to watch objects in

config/crd/bases/operator.cluster.x-k8s.io_ipamproviders.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,13 @@ spec:
12911291
description: Manager defines the properties that can be enabled
12921292
on the controller manager for the additional provider deployment.
12931293
properties:
1294+
additionalArgs:
1295+
additionalProperties:
1296+
type: string
1297+
description: |-
1298+
AdditionalArgs is a map of additional options that will be passed
1299+
in as container args to the provider's controller manager.
1300+
type: object
12941301
cacheNamespace:
12951302
description: |-
12961303
CacheNamespace if specified restricts the manager's cache to watch objects in
@@ -2822,6 +2829,13 @@ spec:
28222829
description: Manager defines the properties that can be enabled on
28232830
the controller manager for the provider.
28242831
properties:
2832+
additionalArgs:
2833+
additionalProperties:
2834+
type: string
2835+
description: |-
2836+
AdditionalArgs is a map of additional options that will be passed
2837+
in as container args to the provider's controller manager.
2838+
type: object
28252839
cacheNamespace:
28262840
description: |-
28272841
CacheNamespace if specified restricts the manager's cache to watch objects in

0 commit comments

Comments
 (0)