-
Notifications
You must be signed in to change notification settings - Fork 19
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
Backport to v1.6.x #796
Merged
Merged
Backport to v1.6.x #796
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b0dd815
Add development channel for OBS builds
davidcassany 50ebf5d
Check crds chart is aligned with the main operator chart version
davidcassany e4dabaf
Update channels (#781)
davidcassany 90af3c7
[Airgap] fix unstable channel extraction
ldevulder e9f1012
Add Micro 6.0 baremetal as the default channel
davidcassany File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,14 +1,13 @@ | ||
{{ if contains "isv/rancher/elemental" .Values.registryUrl }} | ||
{{ if hasPrefix "registry.opensuse.org" .Values.registryUrl }} | ||
# Unstable channel for isv:Rancher:Elemental OBS projects | ||
# Unstable channel for testing isv:Rancher:Elemental OBS projects | ||
# it is only rendered if the registryUrl value includes a known OBS project reference | ||
{{ if and (hasPrefix "registry.opensuse.org" .Values.registryUrl) (contains "isv/rancher/elemental" .Values.registryUrl) }} | ||
apiVersion: elemental.cattle.io/v1beta1 | ||
kind: ManagedOSVersionChannel | ||
metadata: | ||
name: unstable-channel | ||
name: unstable-testing-channel | ||
namespace: fleet-default | ||
spec: | ||
options: | ||
image: {{ .Values.registryUrl }}/rancher/elemental-unstable-channel:latest | ||
type: custom | ||
{{ end }} | ||
{{ end }} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{ $defChannelName := "" }} | ||
{{ if and .Values.channel .Values.channel.image .Values.channel.tag .Values.channel.name }} | ||
{{ $defChannelName := .Values.channel.name }} | ||
apiVersion: elemental.cattle.io/v1beta1 | ||
kind: ManagedOSVersionChannel | ||
metadata: | ||
name: {{ .Values.channel.name }} | ||
namespace: fleet-default | ||
spec: | ||
options: | ||
image: {{ .Values.channel.image }}:{{ .Values.channel.tag }} | ||
type: custom | ||
{{ end }} | ||
|
||
# Keep pre-existing channels managed by Helm if they do not match with the current default | ||
# this way if an upgrade introduces a new channel any pre-existing channel managed by Helm is not deleted | ||
{{ range $index, $channel := (lookup "elemental.cattle.io/v1beta1" "ManagedOSVersionChannel" "fleet-default" "").items }} | ||
{{ if and (eq (index $channel.metadata.labels "app.kubernetes.io/managed-by") "Helm") (ne $channel.metadata.name $defChannelName) }} | ||
--- | ||
apiVersion: elemental.cattle.io/v1beta1 | ||
kind: ManagedOSVersionChannel | ||
metadata: | ||
name: {{ $channel.metadata.name }} | ||
namespace: fleet-default | ||
spec: | ||
options: | ||
image: {{ $channel.spec.options.image }} | ||
type: custom | ||
{{ end }} | ||
{{ end }} |
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,103 @@ | ||
/* | ||
Copyright © 2022 - 2024 SUSE LLC | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package e2e_test | ||
|
||
import ( | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
elementalv1 "github.com/rancher/elemental-operator/api/v1beta1" | ||
"github.com/rancher/elemental-operator/tests/e2e/config" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
kubectl "github.com/rancher-sandbox/ele-testhelpers/kubectl" | ||
) | ||
|
||
const stableCRDSChart = "oci://registry.suse.com/rancher/elemental-operator-crds-chart" | ||
const stableChart = "oci://registry.suse.com/rancher/elemental-operator-chart" | ||
|
||
var _ = Describe("Elemental Operator downgrade/upgrade test", func() { | ||
var k *kubectl.Kubectl | ||
var downgradeCfg config.E2EConfig | ||
var channelName string | ||
var managedByLabel map[string]string | ||
|
||
It("downgrades to latest stable version", func() { | ||
k = kubectl.New() | ||
downgradeCfg = *e2eCfg | ||
downgradeCfg.CRDsChart = stableCRDSChart | ||
downgradeCfg.Chart = stableChart | ||
channelName = "" | ||
managedByLabel = map[string]string{ | ||
"app.kubernetes.io/managed-by": "Helm", | ||
} | ||
|
||
Expect(isOperatorInstalled(k)).To(BeTrue()) | ||
|
||
By("Uninstall Elemental Operator first before downgrading CRDs chart", func() { | ||
Expect(kubectl.RunHelmBinaryWithCustomErr( | ||
"uninstall", operatorName, | ||
"--namespace", operatorNamespace, | ||
"--wait", | ||
)).To(Succeed()) | ||
}) | ||
|
||
By("Install the new Elemental Operator", func() { | ||
deployOperator(k, &downgradeCfg) | ||
}) | ||
|
||
By("Check it gets a default channel and syncs ManagedOSVersions", func() { | ||
Eventually(func() string { | ||
channels := &elementalv1.ManagedOSVersionChannelList{} | ||
err := cl.List(ctx, channels, client.InNamespace(fleetDefaultNamespace), client.MatchingLabels(managedByLabel)) | ||
if err == nil { | ||
// After uninstalling Operator and reinstalling it there should be only a single channel managed by Helm | ||
Expect(len(channels.Items)).To(Equal(1)) | ||
channelName = channels.Items[0].Name | ||
} | ||
return channelName | ||
}, 10*time.Second, 1*time.Second).ShouldNot(BeEmpty()) | ||
|
||
Eventually(func() int { | ||
mOSes := &elementalv1.ManagedOSVersionList{} | ||
err := cl.List(ctx, mOSes, client.InNamespace(fleetDefaultNamespace), client.MatchingLabels(map[string]string{ | ||
elementalv1.ElementalManagedOSVersionChannelLabel: channelName, | ||
})) | ||
if err == nil { | ||
return len(mOSes.Items) | ||
} | ||
return 0 | ||
}, 2*time.Minute, 2*time.Second).Should(BeNumerically(">", 0)) | ||
}) | ||
|
||
By("Upgrading Elemental Operator to testing version", func() { | ||
deployOperator(k, e2eCfg) | ||
}) | ||
|
||
By("Check we still keep the previous default channel managed by Helm", func() { | ||
Eventually(func() error { | ||
ch := &elementalv1.ManagedOSVersionChannel{} | ||
err := cl.Get(ctx, client.ObjectKey{ | ||
Name: channelName, | ||
Namespace: fleetDefaultNamespace, | ||
}, ch) | ||
return err | ||
}, 10*time.Second, 1*time.Second).ShouldNot(HaveOccurred()) | ||
}) | ||
}) | ||
}) |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be present also on the final released chart, right?
Not 100% happy that we bring this in the final chart. I see it shouldn't harm, but production ready version should be free of the test references IMHO...
Btw, we can drop it in the marketplace later if needed (maybe even the whole channel-dev 🤔 ... for a later discussion 😄 ).