Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(install): enable/disable crd installation #1693

Merged
merged 1 commit into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/install/v1alpha1/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ const (
//
// Default is "true"
CreateDefaultStorageConfig menv.ENVKey = "OPENEBS_IO_CREATE_DEFAULT_STORAGE_CONFIG"

// InstallCRD is the environment
// variable that flags if maya apiserver should install the CRDs
// As the installation moves towards helm 3, the responsibility of installing
// CRDs can be pushed to helm.
//
// Default is "true"
InstallCRD menv.ENVKey = "OPENEBS_IO_INSTALL_CRD"
prateekpandey14 marked this conversation as resolved.
Show resolved Hide resolved
)
4 changes: 4 additions & 0 deletions pkg/install/v1alpha1/env_setter.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ func (e *envInstall) List() (l *envList, err error) {
Key: DefaultCstorSparsePool,
Value: "false",
})
l.Items = append(l.Items, &env{
Key: InstallCRD,
Value: "true",
})
l.Items = append(l.Items, &env{
Key: menv.CASTemplateFeatureGateENVK,
Value: "true",
Expand Down
2 changes: 1 addition & 1 deletion pkg/install/v1alpha1/env_setter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestEnvInstallCount(t *testing.T) {
tests := map[string]struct {
expectedCount int
}{
"101": {20},
"101": {21},
}

for name, mock := range tests {
Expand Down
7 changes: 7 additions & 0 deletions pkg/install/v1alpha1/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ func IsCstorSparsePoolEnabled() bool {
enabled, _ := strconv.ParseBool(menv.Get(DefaultCstorSparsePool))
return IsDefaultStorageConfigEnabled() && enabled
}

// IsInstallCRDEnabled reads from env variable to check
// whether CRDs should be created by default or not.
func IsInstallCRDEnabled() (enabled bool) {
enabled, _ = strconv.ParseBool(menv.Get(InstallCRD))
return
}
2 changes: 1 addition & 1 deletion pkg/install/v1alpha1/openebs_crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ spec:

// OpenEBSCRDArtifacts returns the CRDs required for latest version
func OpenEBSCRDArtifacts() (list artifactList) {
list.Items = append(list.Items, ParseArtifactListFromMultipleYamls(openEBSCRDs{})...)
list.Items = append(list.Items, ParseArtifactListFromMultipleYamlsIf(openEBSCRDs{}, IsInstallCRDEnabled)...)
return
}

Expand Down