-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Redpanda CRD flag that switch of Flux reconciliation
New `Usefulx` boolean flag can turn off Flux reconciliation of HelmRelease and HelmRepository via `suspend` flag in both resources. Regardless of the Flux controllers execution (inside or outside Redpanda operator) Redpanda deployment can be unchanged which gives users not only ability to interveen if something break, but it can act as switch to new execution model without flux controllers. Before setting UseFlux flag to `false` users need to alight ChartVersion to at least `5.9.3` version of the Redpanda chart. The Redpanda reconciller can leave behind Flux custom resources (HelmRelease, HelmChart and HelmRepository) and take ownership of all resources generated by the helm chart. When suspend flag is enabled on mentioned resources user could potenetially delete HelmRelease (using kubectl), but all resources would be unchanged. Current Redpanda operator implementation would quickly re-create HelmRelease CR, but that would still not affect any K8S primitive resource. The analogy could be `kubectl delete --cascade=orphan ...` where main resource is deleted, but the child resources are left unchanged. Reference: https://fluxcd.io/flux/components/helm/helmreleases/#suspend https://fluxcd.io/flux/components/source/helmrepositories/#suspend
- Loading branch information
1 parent
ec8c1e6
commit 5536cca
Showing
5 changed files
with
163 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2024 Redpanda Data, Inc. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.md | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0 | ||
|
||
package redpanda | ||
|
||
import ( | ||
_ "embed" | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/redpanda-data/redpanda-operator/src/go/k8s/internal/controller/redpanda" | ||
"github.com/stretchr/testify/require" | ||
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" | ||
"k8s.io/apimachinery/pkg/util/yaml" | ||
) | ||
|
||
//go:embed cluster.redpanda.com_redpandas.yaml | ||
var redpandaCRD []byte | ||
|
||
func TestDefluxedMinimumVersion(t *testing.T) { | ||
crd := v1.CustomResourceDefinition{} | ||
|
||
red, err := yaml.ToJSON(redpandaCRD) | ||
require.NoError(t, err) | ||
|
||
require.NoError(t, json.Unmarshal(red, &crd)) | ||
// 0 is v1alpha1 and 1 is v1alpha2 | ||
recursiveProperties := crd.Spec.Versions[1].Schema.OpenAPIV3Schema.Properties | ||
|
||
require.Contains(t, recursiveProperties["spec"].Properties["chartRef"].Properties["useFlux"].Description, redpanda.HelmChartConstraint) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters