Skip to content

Commit cfec086

Browse files
committed
Make disableCopiedCSVs a boolean
1 parent 02ded51 commit cfec086

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

crds/operators.coreos.com_olmconfigs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ spec:
4343
disableCopiedCSVs:
4444
description: DisableCopiedCSVs is used to disable OLM's "Copied CSV" feature for operators installed at the cluster scope, where a cluster scoped operator is one that has been installed in an OperatorGroup that targets all namespaces. When reenabled, OLM will recreate the "Copied CSVs" for each cluster scoped operator.
4545
type: boolean
46+
default: false
4647
status:
4748
description: OLMConfigStatus is the status for an OLMConfig resource.
4849
type: object

crds/zz_defs.go

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

pkg/operators/v1/olmconfig_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ func TestCopiedCSVsAreEnabled(t *testing.T) {
1919
{
2020
description: "NilConfig",
2121
olmConfig: nil,
22-
expected: false,
22+
expected: true,
2323
},
2424
{
2525
description: "MissingSpec",
2626
olmConfig: &OLMConfig{},
27-
expected: false,
27+
expected: true,
2828
},
2929
{
3030
description: "MissingFeatures",
3131
olmConfig: &OLMConfig{
3232
Spec: OLMConfigSpec{},
3333
},
34-
expected: false,
34+
expected: true,
3535
},
3636
{
3737
description: "MissingDisableCopiedCSVs",
3838
olmConfig: &OLMConfig{
3939
Spec: OLMConfigSpec{},
4040
},
41-
expected: false,
41+
expected: true,
4242
},
4343
{
4444
description: "CopiedCSVsDisabled",
4545
olmConfig: &OLMConfig{
4646
Spec: OLMConfigSpec{
4747
Features: Features{
48-
DisableCopiedCSVs: boolPointer(true),
48+
DisableCopiedCSVs: true,
4949
},
5050
},
5151
},
@@ -56,7 +56,7 @@ func TestCopiedCSVsAreEnabled(t *testing.T) {
5656
olmConfig: &OLMConfig{
5757
Spec: OLMConfigSpec{
5858
Features: Features{
59-
DisableCopiedCSVs: boolPointer(false),
59+
DisableCopiedCSVs: false,
6060
},
6161
},
6262
},

pkg/operators/v1/olmconfig_types.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ type OLMConfigSpec struct {
1111

1212
// Features contains the list of configurable OLM features.
1313
type Features struct {
14+
// +kubebuilder:default=false
1415

1516
// DisableCopiedCSVs is used to disable OLM's "Copied CSV" feature
1617
// for operators installed at the cluster scope, where a cluster
1718
// scoped operator is one that has been installed in an
1819
// OperatorGroup that targets all namespaces.
1920
// When reenabled, OLM will recreate the "Copied CSVs" for each
2021
// cluster scoped operator.
21-
DisableCopiedCSVs *bool `json:"disableCopiedCSVs,omitempty"`
22+
DisableCopiedCSVs bool `json:"disableCopiedCSVs,omitempty"`
2223
}
2324

2425
// OLMConfigStatus is the status for an OLMConfig resource.
@@ -61,10 +62,5 @@ func (config *OLMConfig) CopiedCSVsAreEnabled() bool {
6162
return true
6263
}
6364

64-
disableCopiedCSVs := config.Spec.Features.DisableCopiedCSVs
65-
if disableCopiedCSVs != nil {
66-
return !*disableCopiedCSVs
67-
}
68-
69-
return true
65+
return !config.Spec.Features.DisableCopiedCSVs
7066
}

0 commit comments

Comments
 (0)