From 02387cdc95d6efac314af425da728fc5d3b66295 Mon Sep 17 00:00:00 2001 From: redhat-chai-bot Date: Tue, 28 Jul 2026 13:28:04 +0000 Subject: [PATCH] Revert "Merge pull request #1425 from jhadvig/OTA-2084" This reverts commit 027e419696ec443ee8b6257bc306d14dd024eaa7, reversing changes made to 55dfed31db21d4e500249811055009d8b5060684. --- ...er-update-console-plugin_10_namespace.yaml | 4 + ...date-console-plugin_15_serviceaccount.yaml | 4 + ...pdate-console-plugin_20_networkpolicy.yaml | 4 + ...er-update-console-plugin_30_configmap.yaml | 4 + ...r-update-console-plugin_50_deployment.yaml | 6 +- ...ster-update-console-plugin_60_service.yaml | 6 +- ...pdate-console-plugin_90_consoleplugin.yaml | 8 +- pkg/agenticrun/bindata/assets.go | 20 -- .../assets/networkpolicy-allow-console.yaml | 17 -- pkg/agenticrun/consoleplugin.go | 183 ------------------ pkg/agenticrun/controller.go | 79 -------- pkg/agenticrun/controller_test.go | 2 - pkg/cvo/availableupdates.go | 5 +- pkg/cvo/availableupdates_test.go | 1 - pkg/cvo/cvo.go | 49 ++--- pkg/cvo/status.go | 8 +- pkg/payload/render_test.go | 3 + 17 files changed, 62 insertions(+), 341 deletions(-) rename pkg/agenticrun/bindata/assets/namespace.yaml => install/0000_50_cluster-update-console-plugin_10_namespace.yaml (67%) rename pkg/agenticrun/bindata/assets/serviceaccount.yaml => install/0000_50_cluster-update-console-plugin_15_serviceaccount.yaml (55%) rename pkg/agenticrun/bindata/assets/networkpolicy.yaml => install/0000_50_cluster-update-console-plugin_20_networkpolicy.yaml (61%) rename pkg/agenticrun/bindata/assets/configmap.yaml => install/0000_50_cluster-update-console-plugin_30_configmap.yaml (75%) rename pkg/agenticrun/bindata/assets/deployment.yaml => install/0000_50_cluster-update-console-plugin_50_deployment.yaml (87%) rename pkg/agenticrun/bindata/assets/service.yaml => install/0000_50_cluster-update-console-plugin_60_service.yaml (62%) rename pkg/agenticrun/bindata/assets/consoleplugin.yaml => install/0000_50_cluster-update-console-plugin_90_consoleplugin.yaml (55%) delete mode 100644 pkg/agenticrun/bindata/assets.go delete mode 100644 pkg/agenticrun/bindata/assets/networkpolicy-allow-console.yaml delete mode 100644 pkg/agenticrun/consoleplugin.go diff --git a/pkg/agenticrun/bindata/assets/namespace.yaml b/install/0000_50_cluster-update-console-plugin_10_namespace.yaml similarity index 67% rename from pkg/agenticrun/bindata/assets/namespace.yaml rename to install/0000_50_cluster-update-console-plugin_10_namespace.yaml index 7ef8e6c069..dbfe4628be 100644 --- a/pkg/agenticrun/bindata/assets/namespace.yaml +++ b/install/0000_50_cluster-update-console-plugin_10_namespace.yaml @@ -4,6 +4,10 @@ metadata: name: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: The OpenShift cluster-update console plugin provides a web-console interface for managing ClusterVersion updates. + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" workload.openshift.io/allowed: management labels: openshift.io/cluster-monitoring: "true" diff --git a/pkg/agenticrun/bindata/assets/serviceaccount.yaml b/install/0000_50_cluster-update-console-plugin_15_serviceaccount.yaml similarity index 55% rename from pkg/agenticrun/bindata/assets/serviceaccount.yaml rename to install/0000_50_cluster-update-console-plugin_15_serviceaccount.yaml index 3ba5569e4c..e124a426b8 100644 --- a/pkg/agenticrun/bindata/assets/serviceaccount.yaml +++ b/install/0000_50_cluster-update-console-plugin_15_serviceaccount.yaml @@ -5,3 +5,7 @@ metadata: namespace: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: The OpenShift cluster-update console plugin provides a web-console interface for managing ClusterVersion updates. + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" diff --git a/pkg/agenticrun/bindata/assets/networkpolicy.yaml b/install/0000_50_cluster-update-console-plugin_20_networkpolicy.yaml similarity index 61% rename from pkg/agenticrun/bindata/assets/networkpolicy.yaml rename to install/0000_50_cluster-update-console-plugin_20_networkpolicy.yaml index 05daa750d1..78bc822350 100644 --- a/pkg/agenticrun/bindata/assets/networkpolicy.yaml +++ b/install/0000_50_cluster-update-console-plugin_20_networkpolicy.yaml @@ -5,6 +5,10 @@ metadata: namespace: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: This NetworkPolicy is used to deny all ingress and egress traffic by default in this namespace, matching all Pods, and serving as a baseline. + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" spec: podSelector: {} policyTypes: diff --git a/pkg/agenticrun/bindata/assets/configmap.yaml b/install/0000_50_cluster-update-console-plugin_30_configmap.yaml similarity index 75% rename from pkg/agenticrun/bindata/assets/configmap.yaml rename to install/0000_50_cluster-update-console-plugin_30_configmap.yaml index f54f33bce0..89ccc8a21d 100644 --- a/pkg/agenticrun/bindata/assets/configmap.yaml +++ b/install/0000_50_cluster-update-console-plugin_30_configmap.yaml @@ -5,6 +5,10 @@ metadata: namespace: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: Nginx configuration for the cluster-update console plugin. + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" data: nginx.conf: | error_log /dev/stderr; diff --git a/pkg/agenticrun/bindata/assets/deployment.yaml b/install/0000_50_cluster-update-console-plugin_50_deployment.yaml similarity index 87% rename from pkg/agenticrun/bindata/assets/deployment.yaml rename to install/0000_50_cluster-update-console-plugin_50_deployment.yaml index dcbc46ae90..182f1db8bc 100644 --- a/pkg/agenticrun/bindata/assets/deployment.yaml +++ b/install/0000_50_cluster-update-console-plugin_50_deployment.yaml @@ -5,6 +5,10 @@ metadata: namespace: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: The OpenShift cluster-update console plugin provides a web-console interface for managing ClusterVersion updates. + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" spec: selector: matchLabels: @@ -26,7 +30,7 @@ spec: automountServiceAccountToken: false containers: - name: plugin - image: ${IMAGE} + image: '{{index .Images "cluster-update-console-plugin"}}' imagePullPolicy: IfNotPresent ports: - name: https diff --git a/pkg/agenticrun/bindata/assets/service.yaml b/install/0000_50_cluster-update-console-plugin_60_service.yaml similarity index 62% rename from pkg/agenticrun/bindata/assets/service.yaml rename to install/0000_50_cluster-update-console-plugin_60_service.yaml index efd58304d1..cd5f7b2b4c 100644 --- a/pkg/agenticrun/bindata/assets/service.yaml +++ b/install/0000_50_cluster-update-console-plugin_60_service.yaml @@ -1,11 +1,15 @@ apiVersion: v1 kind: Service metadata: - name: cluster-update-console-plugin + name: openshift-cluster-update-console-plugin namespace: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: The OpenShift cluster-update console plugin provides a web-console interface for managing ClusterVersion updates. service.beta.openshift.io/serving-cert-secret-name: cluster-update-console-plugin-cert + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" spec: type: ClusterIP selector: diff --git a/pkg/agenticrun/bindata/assets/consoleplugin.yaml b/install/0000_50_cluster-update-console-plugin_90_consoleplugin.yaml similarity index 55% rename from pkg/agenticrun/bindata/assets/consoleplugin.yaml rename to install/0000_50_cluster-update-console-plugin_90_consoleplugin.yaml index 2166f8bd7e..69bd0d9eee 100644 --- a/pkg/agenticrun/bindata/assets/consoleplugin.yaml +++ b/install/0000_50_cluster-update-console-plugin_90_consoleplugin.yaml @@ -1,9 +1,13 @@ apiVersion: console.openshift.io/v1 kind: ConsolePlugin metadata: - name: cluster-update-console-plugin + name: openshift-cluster-update-console-plugin annotations: kubernetes.io/description: The OpenShift cluster-update console plugin provides a web-console interface for managing ClusterVersion updates. + capability.openshift.io/name: Console + release.openshift.io/feature-set: TechPreviewNoUpgrade + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" spec: displayName: Cluster Updates i18n: @@ -11,7 +15,7 @@ spec: backend: type: Service service: - name: cluster-update-console-plugin + name: openshift-cluster-update-console-plugin namespace: openshift-cluster-update-console-plugin port: 9001 basePath: / diff --git a/pkg/agenticrun/bindata/assets.go b/pkg/agenticrun/bindata/assets.go deleted file mode 100644 index 03d710fab9..0000000000 --- a/pkg/agenticrun/bindata/assets.go +++ /dev/null @@ -1,20 +0,0 @@ -package bindata - -import ( - "embed" -) - -//go:embed assets/* -var f embed.FS - -func Asset(name string) ([]byte, error) { - return f.ReadFile(name) -} - -func MustAsset(name string) []byte { - data, err := f.ReadFile(name) - if err != nil { - panic(err) - } - return data -} diff --git a/pkg/agenticrun/bindata/assets/networkpolicy-allow-console.yaml b/pkg/agenticrun/bindata/assets/networkpolicy-allow-console.yaml deleted file mode 100644 index f9b0e3bb5d..0000000000 --- a/pkg/agenticrun/bindata/assets/networkpolicy-allow-console.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - name: allow-console-ingress - namespace: openshift-cluster-update-console-plugin - annotations: - kubernetes.io/description: Allow ingress from the console to the cluster-update console plugin on port 9001. -spec: - podSelector: - matchLabels: - app: cluster-update-console-plugin - ingress: - - ports: - - port: 9001 - protocol: TCP - policyTypes: - - Ingress diff --git a/pkg/agenticrun/consoleplugin.go b/pkg/agenticrun/consoleplugin.go deleted file mode 100644 index 40d8ebe7ba..0000000000 --- a/pkg/agenticrun/consoleplugin.go +++ /dev/null @@ -1,183 +0,0 @@ -package agenticrun - -import ( - "context" - "encoding/json" - "fmt" - "reflect" - "strings" - - ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client" - - appsv1 "k8s.io/api/apps/v1" - kerrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/yaml" - "k8s.io/klog/v2" - - operatorv1 "github.com/openshift/api/operator/v1" - - "github.com/openshift/cluster-version-operator/pkg/agenticrun/bindata" - i "github.com/openshift/cluster-version-operator/pkg/internal" -) - -var consolePluginAssets = []string{ - "assets/namespace.yaml", - "assets/serviceaccount.yaml", - "assets/networkpolicy.yaml", - "assets/networkpolicy-allow-console.yaml", - "assets/configmap.yaml", - "assets/deployment.yaml", - "assets/service.yaml", - "assets/consoleplugin.yaml", -} - -func applyConsolePluginManifests(ctx context.Context, client ctrlruntimeclient.Client, image string) error { - for _, asset := range consolePluginAssets { - raw := bindata.MustAsset(asset) - - if asset == "assets/deployment.yaml" { - raw = []byte(strings.ReplaceAll(string(raw), "${IMAGE}", image)) - } - - obj := &unstructured.Unstructured{} - if err := yaml.NewYAMLOrJSONDecoder(strings.NewReader(string(raw)), len(raw)).Decode(obj); err != nil { - return fmt.Errorf("decoding %s: %w", asset, err) - } - - existing := &unstructured.Unstructured{} - existing.SetGroupVersionKind(obj.GroupVersionKind()) - err := client.Get(ctx, ctrlruntimeclient.ObjectKeyFromObject(obj), existing) - if err != nil { - if ctrlruntimeclient.IgnoreNotFound(err) != nil { - return fmt.Errorf("getting %s %s: %w", obj.GetKind(), obj.GetName(), err) - } - if err := client.Create(ctx, obj); err != nil { - return fmt.Errorf("creating %s %s: %w", obj.GetKind(), obj.GetName(), err) - } - klog.V(i.Normal).Infof("Created console plugin %s %s", obj.GetKind(), obj.GetName()) - continue - } - - if !needsUpdate(existing, obj) { - klog.V(i.Debug).Infof("Console plugin %s %s is up to date", obj.GetKind(), obj.GetName()) - continue - } - obj.SetResourceVersion(existing.GetResourceVersion()) - if err := client.Update(ctx, obj); err != nil { - return fmt.Errorf("updating %s %s: %w", obj.GetKind(), obj.GetName(), err) - } - klog.V(i.Normal).Infof("Updated console plugin %s %s", obj.GetKind(), obj.GetName()) - } - return nil -} - -func needsUpdate(existing, desired *unstructured.Unstructured) bool { - if !reflect.DeepEqual(existing.Object["spec"], desired.Object["spec"]) { - return true - } - return !reflect.DeepEqual(existing.Object["data"], desired.Object["data"]) -} - -func cleanupConsolePluginManifests(ctx context.Context, client ctrlruntimeclient.Client) error { - for idx := len(consolePluginAssets) - 1; idx >= 0; idx-- { - raw := bindata.MustAsset(consolePluginAssets[idx]) - - obj := &unstructured.Unstructured{} - if err := yaml.NewYAMLOrJSONDecoder(strings.NewReader(string(raw)), len(raw)).Decode(obj); err != nil { - return fmt.Errorf("decoding %s: %w", consolePluginAssets[idx], err) - } - - existing := &unstructured.Unstructured{} - existing.SetGroupVersionKind(obj.GroupVersionKind()) - existing.SetName(obj.GetName()) - existing.SetNamespace(obj.GetNamespace()) - - if err := client.Delete(ctx, existing); err != nil { - if !kerrors.IsNotFound(err) { - return fmt.Errorf("deleting %s %s: %w", obj.GetKind(), obj.GetName(), err) - } - } else { - klog.V(i.Normal).Infof("Deleted console plugin %s %s", obj.GetKind(), obj.GetName()) - } - } - return nil -} - -const ( - consolePluginName = "cluster-update-console-plugin" - consolePluginNamespace = "openshift-cluster-update-console-plugin" -) - -func waitForPluginReady(ctx context.Context, client ctrlruntimeclient.Client) error { - deployment := &appsv1.Deployment{} - if err := client.Get(ctx, types.NamespacedName{Name: consolePluginName, Namespace: consolePluginNamespace}, deployment); err != nil { - return fmt.Errorf("getting deployment: %w", err) - } - if deployment.Status.AvailableReplicas < 1 { - return fmt.Errorf("deployment %s has no available replicas", consolePluginName) - } - return nil -} - -func enableConsolePlugin(ctx context.Context, client ctrlruntimeclient.Client) error { - console := &operatorv1.Console{} - if err := client.Get(ctx, types.NamespacedName{Name: "cluster"}, console); err != nil { - return fmt.Errorf("getting console operator config: %w", err) - } - for _, p := range console.Spec.Plugins { - if p == consolePluginName { - return nil - } - } - plugins := append(console.Spec.Plugins, consolePluginName) - patch, err := json.Marshal(map[string]interface{}{ - "spec": map[string]interface{}{ - "plugins": plugins, - }, - }) - if err != nil { - return fmt.Errorf("marshaling patch: %w", err) - } - if err := client.Patch(ctx, console, ctrlruntimeclient.RawPatch(types.MergePatchType, patch)); err != nil { - return fmt.Errorf("enabling console plugin: %w", err) - } - klog.V(i.Normal).Infof("Enabled %s in console operator config", consolePluginName) - return nil -} - -func disableConsolePlugin(ctx context.Context, client ctrlruntimeclient.Client) error { - console := &operatorv1.Console{} - if err := client.Get(ctx, types.NamespacedName{Name: "cluster"}, console); err != nil { - if kerrors.IsNotFound(err) { - return nil - } - return fmt.Errorf("getting console operator config: %w", err) - } - filtered := make([]string, 0, len(console.Spec.Plugins)) - found := false - for _, p := range console.Spec.Plugins { - if p == consolePluginName { - found = true - continue - } - filtered = append(filtered, p) - } - if !found { - return nil - } - patch, err := json.Marshal(map[string]interface{}{ - "spec": map[string]interface{}{ - "plugins": filtered, - }, - }) - if err != nil { - return fmt.Errorf("marshaling patch: %w", err) - } - if err := client.Patch(ctx, console, ctrlruntimeclient.RawPatch(types.MergePatchType, patch)); err != nil { - return fmt.Errorf("disabling console plugin: %w", err) - } - klog.V(i.Normal).Infof("Disabled %s in console operator config", consolePluginName) - return nil -} diff --git a/pkg/agenticrun/controller.go b/pkg/agenticrun/controller.go index 789cf8e802..7532da8987 100644 --- a/pkg/agenticrun/controller.go +++ b/pkg/agenticrun/controller.go @@ -60,12 +60,6 @@ type Controller struct { cvGetterFunc cvGetterFunc getCurrentVersionFunc getCurrentVersionFunc config Config - consolePluginImage string - consolePluginEnsured bool - crdAvailableCache bool - crdLastChecked time.Time - hypershift bool - hasConsoleCapability func() bool } const controllerName = "agenticrun-lifecycle-controller" @@ -133,57 +127,6 @@ func (c *Controller) QueueKey() string { return c.queueKey } -const crdCheckInterval = 5 * time.Minute - -func (c *Controller) SetHyperShift(hypershift bool) { - c.hypershift = hypershift -} - -func (c *Controller) SetConsoleCapabilityFunc(f func() bool) { - c.hasConsoleCapability = f -} - -func (c *Controller) SetConsolePluginImage(image string) { - if c.consolePluginImage != image { - c.consolePluginImage = image - c.consolePluginEnsured = false - } -} - -func (c *Controller) crdAvailable() bool { - if time.Since(c.crdLastChecked) < crdCheckInterval { - return c.crdAvailableCache - } - c.crdLastChecked = time.Now() - if c.client == nil { - klog.V(i.Normal).Info("No AgenticRun controller client, assuming there are no AgenticRuns") - c.crdAvailableCache = false - return false - } - crd := &apiextensionsv1.CustomResourceDefinition{} - err := c.client.Get(context.Background(), ctrlruntimeclient.ObjectKey{Name: "agenticruns.agentic.openshift.io"}, crd) - c.crdAvailableCache = err == nil - klog.V(i.Normal).Infof("AgenticRun CustomResourceDefinition available? %t (%v)", c.crdAvailableCache, err) - return c.crdAvailableCache -} - -func (c *Controller) shouldDeployConsolePlugin() bool { - if c.hypershift { - return false - } - if c.hasConsoleCapability != nil && !c.hasConsoleCapability() { - return false - } - return true -} - -func (c *Controller) ensureConsolePlugin(ctx context.Context) error { - if c.consolePluginImage == "" { - return fmt.Errorf("console plugin image not set") - } - return applyConsolePluginManifests(ctx, c.client, c.consolePluginImage) -} - func (c *Controller) Sync(ctx context.Context, key string) error { startTime := time.Now() klog.V(i.Normal).Infof("Started syncing CVO configuration %q", key) @@ -191,28 +134,6 @@ func (c *Controller) Sync(ctx context.Context, key string) error { klog.V(i.Normal).Infof("Finished syncing CVO configuration (%v)", time.Since(startTime)) }() - if !c.crdAvailable() { - if err := disableConsolePlugin(ctx, c.client); err != nil { - klog.V(i.Normal).Infof("Failed to disable console plugin, skipping manifest cleanup: %v", err) - } else if err := cleanupConsolePluginManifests(ctx, c.client); err != nil { - klog.V(i.Normal).Infof("Failed to clean up console plugin: %v", err) - } - c.consolePluginEnsured = false - return nil - } - - if c.shouldDeployConsolePlugin() && !c.consolePluginEnsured { - if err := c.ensureConsolePlugin(ctx); err != nil { - klog.V(i.Normal).Infof("Failed to ensure console plugin: %v", err) - } else if err := waitForPluginReady(ctx, c.client); err != nil { - klog.V(i.Normal).Infof("Console plugin not ready yet, deferring enable: %v", err) - } else if err := enableConsolePlugin(ctx, c.client); err != nil { - klog.V(i.Normal).Infof("Failed to enable console plugin: %v", err) - } else { - c.consolePluginEnsured = true - } - } - updates, conditionalUpdates, err := c.updatesGetterFunc() if err != nil { klog.Errorf("Error getting available updates: %v", err) diff --git a/pkg/agenticrun/controller_test.go b/pkg/agenticrun/controller_test.go index e410bcbb6f..3331d08d38 100644 --- a/pkg/agenticrun/controller_test.go +++ b/pkg/agenticrun/controller_test.go @@ -129,8 +129,6 @@ Update path: Recommended c := NewController(tt.updatesGetterFunc, tt.client, nil, tt.cvGetterFunc, func() string { return "4.22.1" }) - c.crdAvailableCache = true - c.crdLastChecked = time.Now() actual := c.Sync(context.Background(), tt.name) if diff := cmp.Diff(tt.expected, actual, cmp.Transformer("Error", func(e error) string { if e == nil { diff --git a/pkg/cvo/availableupdates.go b/pkg/cvo/availableupdates.go index d05239e0d6..bd568daef0 100644 --- a/pkg/cvo/availableupdates.go +++ b/pkg/cvo/availableupdates.go @@ -182,7 +182,10 @@ func (optr *Operator) syncAvailableUpdates(ctx context.Context, config *configv1 // queue optr.sync() to update ClusterVersion status optr.queue.Add(queueKey) - optr.agenticRunController.Queue().Add(optr.agenticRunController.QueueKey()) + if optr.shouldEnableAgenticRunController() { + // queue optr.agenticRunController.Sync() to manage agentic runs + optr.agenticRunController.Queue().Add(optr.agenticRunController.QueueKey()) + } return nil } diff --git a/pkg/cvo/availableupdates_test.go b/pkg/cvo/availableupdates_test.go index 1f20de720f..cf8457a775 100644 --- a/pkg/cvo/availableupdates_test.go +++ b/pkg/cvo/availableupdates_test.go @@ -1252,7 +1252,6 @@ func TestOperator_syncAvailableUpdates_noticeResolvedAlertsQuickly(t *testing.T) t.Fatalf("accept risk feature is not enabled") } optr.enabledCVOFeatureGates = cvgGates - optr.agenticRunController = agenticrun.NewController(nil, nil, nil, nil, nil) err := optr.syncAvailableUpdates(context.Background(), &configv1.ClusterVersion{ Spec: configv1.ClusterVersionSpec{ DesiredUpdate: &configv1.Update{ diff --git a/pkg/cvo/cvo.go b/pkg/cvo/cvo.go index a3f7fcbd31..e1d4057f3b 100644 --- a/pkg/cvo/cvo.go +++ b/pkg/cvo/cvo.go @@ -441,29 +441,6 @@ func (optr *Operator) InitializeFromPayload(ctx context.Context, restConfig *res optr.release = update.Release optr.releaseCreated = update.ImageRef.CreationTimestamp.Time - if update.ImageRef != nil { - for _, tag := range update.ImageRef.Spec.Tags { - if tag.Name == "cluster-update-console-plugin" && tag.From != nil && tag.From.Kind == "DockerImage" { - optr.agenticRunController.SetConsolePluginImage(tag.From.Name) - break - } - } - } - - optr.agenticRunController.SetHyperShift(optr.hypershift) - optr.agenticRunController.SetConsoleCapabilityFunc(func() bool { - cv, err := optr.cvLister.Get(internal.DefaultClusterVersionName) - if err != nil { - return false - } - for _, cap := range cv.Status.Capabilities.EnabledCapabilities { - if cap == configv1.ClusterVersionCapabilityConsole { - return true - } - } - return false - }) - // after the verifier has been loaded, initialize the sync worker with a payload retriever // which will consume the verifier optr.configSync = NewSyncWorkerWithPreconditions( @@ -602,14 +579,18 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co klog.Infof("The ClusterVersionOperatorConfiguration feature gate is disabled or HyperShift is detected; the configuration sync routine will not run.") } - resultChannelCount++ - go func() { - defer utilruntime.HandleCrash() - wait.UntilWithContext(runContext, func(runContext context.Context) { - optr.worker(runContext, optr.agenticRunController.Queue(), optr.agenticRunController.Sync) - }, time.Second) - resultChannel <- asyncResult{name: "agenticrun controller"} - }() + if optr.shouldEnableAgenticRunController() { + resultChannelCount++ + go func() { + defer utilruntime.HandleCrash() + wait.UntilWithContext(runContext, func(runContext context.Context) { + optr.worker(runContext, optr.agenticRunController.Queue(), optr.agenticRunController.Sync) + }, time.Second) + resultChannel <- asyncResult{name: "agenticrun controller"} + }() + } else { + klog.Infof("The agenticrun controller is disabled.") + } resultChannelCount++ go func() { @@ -1238,6 +1219,12 @@ func (optr *Operator) shouldReconcileAcceptRisks() bool { return optr.enabledCVOFeatureGates.AcceptRisks() && !optr.hypershift } +// shouldEnableAgenticRunController returns whether the CVO should enable the agentic run controller +func (optr *Operator) shouldEnableAgenticRunController() bool { + // Gated behind a feature set so featuregates.ChangeStopper restarts CVO when the return of this function flips. + return optr.requiredFeatureSet == configv1.TechPreviewNoUpgrade +} + // ApplyTLSSettings returns the function that applies TLS settings to the TLS config func (optr *Operator) ApplyTLSSettings() func(config *tls.Config) { return optr.applyTLSSettings diff --git a/pkg/cvo/status.go b/pkg/cvo/status.go index d81358c672..4683760772 100644 --- a/pkg/cvo/status.go +++ b/pkg/cvo/status.go @@ -179,9 +179,11 @@ func (optr *Operator) syncStatus(ctx context.Context, original, config *configv1 if klog.V(6).Enabled() { klog.Infof("Apply config: %s", cmp.Diff(original, config)) } - if original != nil && len(config.Status.History) < len(original.Status.History) { - klog.V(internal.Normal).Infof("Reconciling agentic runs because ClusterVersion.status.history got pruned") - optr.agenticRunController.Queue().Add(optr.agenticRunController.QueueKey()) + if optr.shouldEnableAgenticRunController() { + if original != nil && len(config.Status.History) < len(original.Status.History) { + klog.V(internal.Normal).Infof("Reconciling agentic runs because ClusterVersion.status.history got pruned") + optr.agenticRunController.Queue().Add(optr.agenticRunController.QueueKey()) + } } updated, err := applyClusterVersionStatus(ctx, optr.client.ConfigV1(), config, original) optr.rememberLastUpdate(updated) diff --git a/pkg/payload/render_test.go b/pkg/payload/render_test.go index 9bbdb2b9b2..64f19eb373 100644 --- a/pkg/payload/render_test.go +++ b/pkg/payload/render_test.go @@ -381,6 +381,9 @@ func Test_cvoManifests(t *testing.T) { config := manifestRenderConfig{ ReleaseImage: "quay.io/cvo/release:latest", ClusterProfile: "some-profile", + Images: map[string]string{ + "cluster-update-console-plugin": "quay.io/openshift/cluster-update-console-plugin:latest", + }, } tests := []struct {