Skip to content

Commit b5333f7

Browse files
committed
Revert "Update packaging/microshift/config.yaml"
This reverts commit 72afe2181f62a02dc68003a92d2ace10f43779c2. Update packaging/microshift/config.yaml Co-authored-by: Patryk Matuszak <[email protected]> include [""] as a valid value for optionalCsiComponents to workaround the way controller-gen interprets an empty array when set as a default Signed-off-by: Jon Cope <[email protected]> generate the default config with an empty array. it was created with an array of 1 element, and empty str, which is not an accepted value Signed-off-by: Jon Cope <[email protected]>
1 parent aea40ae commit b5333f7

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

cmd/generate-config/config/config-openapi-spec.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,14 @@
291291
"enum": [
292292
"none",
293293
"snapshot-controller",
294-
"snapshot-webhook"
294+
"snapshot-webhook",
295+
""
295296
]
296-
}
297+
},
298+
"example": [
299+
"snapshot-controller",
300+
"snapshot-webhook"
301+
]
297302
}
298303
}
299304
}

etcd/vendor/github.com/openshift/microshift/pkg/config/storage.go

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

packaging/microshift/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ storage:
131131
# storage driver. Like CSIStorageDriver, uninstallation is not supported as this can lead to orphaned storage
132132
# objects.
133133
# Allowed values are: unset, [], or one or more of ["snapshot-controller", "snapshot-webhook"]
134+
# example:
135+
# - snapshot-controller
136+
# - snapshot-webhook
134137
optionalCsiComponents:
135138
- ""
136139

pkg/config/storage.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626

2727
// OptionalCsiComponent values determine which CSI components MicroShift should deploy. Currently only csi snapshot components
2828
// are supported.
29-
// +kubebuilder:validation:Enum:=none;snapshot-controller;snapshot-webhook
29+
// +kubebuilder:validation:Enum:=none;snapshot-controller;snapshot-webhook;""
3030
type OptionalCsiComponent string
3131

3232
const (
@@ -41,6 +41,10 @@ const (
4141
CsiComponentSnapshot OptionalCsiComponent = "snapshot-controller"
4242
// CsiComponentSnapshotWebhook causes MicroShift to deploy the CSI Snapshot Validation Webhook.
4343
CsiComponentSnapshotWebhook OptionalCsiComponent = "snapshot-webhook"
44+
// CsiComponentNullAlias is equivalent to not specifying a value. It exists because controller-gen generates
45+
// default empty-array values as [""], instead of []. Failing to include this odd value would mean the generated
46+
// /etc/microshift/config.default.yaml would break if passed to MicroShift.
47+
CsiComponentNullAlias OptionalCsiComponent = ""
4448
)
4549

4650
// Storage represents a subfield of the MicroShift config data structure. Its purpose to provide a user
@@ -62,6 +66,7 @@ type Storage struct {
6266
// objects.
6367
// Allowed values are: unset, [], or one or more of ["snapshot-controller", "snapshot-webhook"]
6468
// +kubebuilder:validation:Optional
69+
// +kubebuilder:example={"snapshot-controller", "snapshot-webhook"}
6570
OptionalCSIComponents []OptionalCsiComponent `json:"optionalCsiComponents,omitempty"`
6671
}
6772

@@ -70,7 +75,8 @@ func (s Storage) driverIsValid() (isSupported bool) {
7075
}
7176

7277
func (s Storage) csiComponentsAreValid() []string {
73-
supported := sets.New[OptionalCsiComponent](CsiComponentSnapshot, CsiComponentSnapshotWebhook, CsiComponentNone)
78+
supported := sets.New[OptionalCsiComponent](CsiComponentSnapshot, CsiComponentSnapshotWebhook, CsiComponentNone,
79+
CsiComponentNullAlias)
7480
unsupported := sets.New[string]()
7581

7682
for _, cfgComp := range s.OptionalCSIComponents {

0 commit comments

Comments
 (0)