Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
[
{
"name": "[Jira:\"Cluster Version Operator\"] cluster-version-operator should work with accept risks",
"labels": {
"Serial": {}
},
"resources": {
"isolation": {}
},
"source": "openshift:payload:cluster-version-operator",
"lifecycle": "blocking",
"environmentSelector": {}
},
{
"name": "[Jira:\"Cluster Version Operator\"] cluster-version-operator-tests should support passing tests",
"labels": {},
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster-version-operator-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
Name: "openshift/cluster-version-operator/conformance/parallel",
Parents: []string{"openshift/conformance/parallel"},
Qualifiers: []string{
`!(name.contains("[Serial]") || "Serial" in labels || name.contains("[Slow]"))`,
`!(name.contains("[Serial]") || name.contains("[Slow]"))`,
},
})

Expand All @@ -33,7 +33,7 @@ func main() {
Name: "openshift/cluster-version-operator/conformance/serial",
Parents: []string{"openshift/conformance/serial"},
Qualifiers: []string{
`name.contains("[Serial]") || "Serial" in labels`,
`name.contains("[Serial]")`,
},
})

Expand Down
5 changes: 2 additions & 3 deletions lib/resourcebuilder/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"

"github.com/openshift/cluster-version-operator/pkg/external"
"github.com/openshift/cluster-version-operator/pkg/payload"
)

Expand All @@ -40,7 +39,7 @@ func (b *builder) modifyDeployment(ctx context.Context, deployment *appsv1.Deplo
// if we detect the CVO deployment we need to replace the KUBERNETES_SERVICE_HOST env var with the internal load
// balancer to be resilient to kube-apiserver rollouts that cause the localhost server to become non-responsive for
// multiple minutes.
if deployment.Namespace == external.DefaultCVONamespace && deployment.Name == external.DefaultDeploymentName {
if deployment.Namespace == "openshift-cluster-version" && deployment.Name == "cluster-version-operator" {
infrastructureConfig, err := b.configClientv1.Infrastructures().Get(ctx, "cluster", metav1.GetOptions{})
// not found just means that we don't have infrastructure configuration yet, so we should tolerate not found and avoid substitution
if err != nil && !errors.IsNotFound(err) {
Expand All @@ -64,7 +63,7 @@ func (b *builder) modifyDeployment(ctx context.Context, deployment *appsv1.Deplo
}
err = updatePodSpecWithInternalLoadBalancerKubeService(
&deployment.Spec.Template.Spec,
[]string{external.DefaultContainerName},
[]string{"cluster-version-operator"},
lbHost,
lbPort,
)
Expand Down
3 changes: 1 addition & 2 deletions pkg/cvo/sync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
configv1 "github.com/openshift/api/config/v1"

"github.com/openshift/cluster-version-operator/lib/capability"
"github.com/openshift/cluster-version-operator/pkg/internal"
"github.com/openshift/cluster-version-operator/pkg/payload"
"github.com/openshift/cluster-version-operator/pkg/payload/precondition"
)
Expand Down Expand Up @@ -330,7 +329,7 @@ func (w *SyncWorker) syncPayload(ctx context.Context, work *SyncWork) ([]configv
// The remainder of this logic is for loading a new payload.
// Any filtering as to not needing to reload the payload should be done in the switch before this point.

cvoObjectRef := &corev1.ObjectReference{APIVersion: "config.openshift.io/v1", Kind: "ClusterVersion", Name: internal.DefaultClusterVersionName, Namespace: internal.DefaultCVONamespace}
cvoObjectRef := &corev1.ObjectReference{APIVersion: "config.openshift.io/v1", Kind: "ClusterVersion", Name: "version", Namespace: "openshift-cluster-version"}
msg := fmt.Sprintf("Retrieving and verifying payload version=%q image=%q", desired.Version, desired.Image)
w.eventRecorder.Eventf(cvoObjectRef, corev1.EventTypeNormal, "RetrievePayload", msg)
reporter.ReportPayload(LoadPayloadStatus{
Expand Down
21 changes: 0 additions & 21 deletions pkg/external/constants.go

This file was deleted.

9 changes: 0 additions & 9 deletions pkg/internal/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ import (
)

const (
// DefaultCVONamespace is the default namespace for the Cluster Version Operator
DefaultCVONamespace = "openshift-cluster-version"
// DefaultClusterVersionName is the default name for the Cluster Version resource managed by the Cluster Version Operator
DefaultClusterVersionName = "version"
// DefaultDeploymentName is the default name of the deployment for the Cluster Version Operator
DefaultDeploymentName = "cluster-version-operator"
// DefaultContainerName is the default container name in the deployment for the Cluster Version Operator
DefaultContainerName = DefaultDeploymentName

ConfigNamespace = "openshift-config"
ConfigManagedNamespace = "openshift-config-managed"
AdminGatesConfigMap = "admin-gates"
Expand Down
7 changes: 5 additions & 2 deletions pkg/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ import (
)

const (
defaultComponentName = "version"
defaultComponentNamespace = "openshift-cluster-version"

minResyncPeriod = 2 * time.Minute
)

Expand Down Expand Up @@ -119,8 +122,8 @@ func NewOptions() *Options {
PromQLTarget: defaultPromQLTarget,

// exposed only for testing
Namespace: defaultEnv("CVO_NAMESPACE", internal.DefaultCVONamespace),
Name: defaultEnv("CVO_NAME", internal.DefaultClusterVersionName),
Namespace: defaultEnv("CVO_NAMESPACE", defaultComponentNamespace),
Name: defaultEnv("CVO_NAME", defaultComponentName),
PayloadOverride: os.Getenv("PAYLOAD_OVERRIDE"),
ResyncInterval: minResyncPeriod,
Exclude: os.Getenv("EXCLUDE_MANIFESTS"),
Expand Down
140 changes: 0 additions & 140 deletions test/cvo/accept_risks.go

This file was deleted.

15 changes: 7 additions & 8 deletions test/cvo/cvo.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Package cvo contains end-to-end tests for the Cluster Version Operator.
// The accept_risks test validates the feature about accept risks for conditional updates.
package cvo

import (
Expand All @@ -12,14 +10,15 @@ import (
g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"

"github.com/openshift/cluster-version-operator/pkg/external"
"github.com/openshift/cluster-version-operator/test/oc"
ocapi "github.com/openshift/cluster-version-operator/test/oc/api"
"github.com/openshift/cluster-version-operator/test/util"
)

var logger = g.GinkgoLogr.WithName("cluster-version-operator-tests")

const cvoNamespace = "openshift-cluster-version"

var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator-tests`, func() {
g.It("should support passing tests", func() {
o.Expect(true).To(o.BeTrue())
Expand Down Expand Up @@ -67,14 +66,14 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`,
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to determine if cluster is MicroShift")

g.By("Checking that the 'openshift.io/run-level' label exists on the namespace and has the empty value")
ns, err := kubeClient.CoreV1().Namespaces().Get(ctx, external.DefaultCVONamespace, metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get namespace %s", external.DefaultCVONamespace)
ns, err := kubeClient.CoreV1().Namespaces().Get(ctx, cvoNamespace, metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get namespace %s", cvoNamespace)
runLevel, exists := ns.Labels["openshift.io/run-level"]
o.Expect(exists).To(o.BeTrue(), "The 'openshift.io/run-level' label on namespace %s does not exist", external.DefaultCVONamespace)
o.Expect(runLevel).To(o.BeEmpty(), "Expected the 'openshift.io/run-level' label value on namespace %s has the empty value, but got %s", external.DefaultCVONamespace, runLevel)
o.Expect(exists).To(o.BeTrue(), "The 'openshift.io/run-level' label on namespace %s does not exist", cvoNamespace)
o.Expect(runLevel).To(o.BeEmpty(), "Expected the 'openshift.io/run-level' label value on namespace %s has the empty value, but got %s", cvoNamespace, runLevel)

g.By("Checking that the annotation 'openshift.io/scc annotation' on the CVO pod has the value hostaccess")
podList, err := kubeClient.CoreV1().Pods(external.DefaultCVONamespace).List(ctx, metav1.ListOptions{
podList, err := kubeClient.CoreV1().Pods(cvoNamespace).List(ctx, metav1.ListOptions{
LabelSelector: "k8s-app=cluster-version-operator",
FieldSelector: "status.phase=Running",
})
Expand Down
28 changes: 0 additions & 28 deletions test/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"time"

g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"

configv1 "github.com/openshift/api/config/v1"
clientconfigv1 "github.com/openshift/client-go/config/clientset/versioned"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -108,29 +106,3 @@ func GetKubeClient(restConfig *rest.Config) (kubernetes.Interface, error) {
func GetConfigClient(restConfig *rest.Config) (clientconfigv1.Interface, error) {
return clientconfigv1.NewForConfig(restConfig)
}

// IsTechPreviewNoUpgrade checks if a cluster is a TechPreviewNoUpgrade cluster
func IsTechPreviewNoUpgrade(ctx context.Context, restConfig *rest.Config) bool {
configClient, err := GetConfigClient(restConfig)
o.Expect(err).NotTo(o.HaveOccurred())
featureGate, err := configClient.ConfigV1().FeatureGates().Get(ctx, "cluster", metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
return false
}
o.Expect(err).NotTo(o.HaveOccurred(), "could not retrieve feature-gate: %v", err)
}
return featureGate.Spec.FeatureSet == configv1.TechPreviewNoUpgrade
}

// SkipIfNotTechPreviewNoUpgrade skips the test if a cluster is not a TechPreviewNoUpgrade cluster
func SkipIfNotTechPreviewNoUpgrade(ctx context.Context, restConfig *rest.Config) {
if !IsTechPreviewNoUpgrade(ctx, restConfig) {
g.Skip("This test is skipped because the Tech Preview NoUpgrade is not enabled")
}
}

const (
// fauxinnati mocks Cincinnati Update Graph Server for OpenShift
FauxinnatiAPIURL = "https://fauxinnati-fauxinnati.apps.ota-stage.q2z4.p1.openshiftapps.com/api/upgrades_info/graph"
)