Skip to content
Open
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
1 change: 1 addition & 0 deletions config/openshift/base/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ rules:
- config.openshift.io
resources:
- apiservers
- clusterversions
verbs:
- get
- list
Expand Down
62 changes: 31 additions & 31 deletions docs/AirGapImageConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,34 +106,34 @@ kubectl delete tektoninstallerset <installer-set-name>
#### Images supported in OpenShift
Supports all the images listed above in kubernetes and following are specific to OpenShift

| Component | Container/Args name | Environment Variable |
|-----------------------|-----------------------------------|-----------------------------------------------------|
| Pipeline-as-code | pac-controller | `IMAGE_PAC_PAC_CONTROLLER` |
| Pipeline-as-code | pac-webhook | `IMAGE_PAC_PAC_WEBHOOK` |
| Pipeline-as-code | pac-watcher | `IMAGE_PAC_PAC_WATCHER` |
| Console Plugin | console-plugin | `IMAGE_PIPELINES_CONSOLE_PLUGIN` |
| Results | retention-policy-agent | `IMAGE_RESULTS_RETENTION_POLICY_AGENT` |
| Addons | | `IMAGE_ADDONS_BUILD` |
| Addons | | `IMAGE_ADDONS_GENERATE` |
| Addons | | `IMAGE_ADDONS_GEN_ENV_FILE` |
| Addons | | `IMAGE_ADDONS_GIT_RUN` |
| Addons | | `IMAGE_ADDONS_KN` |
| Addons | | `IMAGE_ADDONS_LOAD_SCRIPTS` |
| Addons | | `IMAGE_ADDONS_MAVEN_GENERATE` |
| Addons | | `IMAGE_ADDONS_MAVEN_GOALS` |
| Addons | | `IMAGE_ADDONS_MVN_SETTINGS` |
| Addons | | `IMAGE_ADDONS_OC` |
| Addons | | `IMAGE_ADDONS_PARAM_BUILDER_IMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_GITINITIMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_KN_IMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_MAVEN_IMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_TKN_IMAGE` |
| Addons | | `IMAGE_ADDONS_PREPARE` |
| Addons | | `IMAGE_ADDONS_REPORT` |
| Addons | | `IMAGE_ADDONS_S2I_BUILD` |
| Addons | | `IMAGE_ADDONS_S2I_GENERATE` |
| Addons | | `IMAGE_ADDONS_SKOPEO_COPY` |
| Addons | | `IMAGE_ADDONS_SKOPEO_RESULTS` |
| Addons | | `IMAGE_ADDONS_TKN` |
| Addons | | `IMAGE_ADDONS_TKN_CLI_SERVE` |
| Addons | | `IMAGE_ADDONS_TKN_CLI_SERVE_INIT_CONFIG` |
| Component | Container/Args name | Environment Variable |
|-----------------------|-----------------------------------|---------------------------------------------------------------------------|
| Pipeline-as-code | pac-controller | `IMAGE_PAC_PAC_CONTROLLER` |
| Pipeline-as-code | pac-webhook | `IMAGE_PAC_PAC_WEBHOOK` |
| Pipeline-as-code | pac-watcher | `IMAGE_PAC_PAC_WATCHER` |
| Console Plugin | console-plugin | `IMAGE_PIPELINES_CONSOLE_PLUGIN`, `IMAGE_PIPELINES_CONSOLE_PLUGIN_LEGACY` |
| Results | retention-policy-agent | `IMAGE_RESULTS_RETENTION_POLICY_AGENT` |
| Addons | | `IMAGE_ADDONS_BUILD` |
| Addons | | `IMAGE_ADDONS_GENERATE` |
| Addons | | `IMAGE_ADDONS_GEN_ENV_FILE` |
| Addons | | `IMAGE_ADDONS_GIT_RUN` |
| Addons | | `IMAGE_ADDONS_KN` |
| Addons | | `IMAGE_ADDONS_LOAD_SCRIPTS` |
| Addons | | `IMAGE_ADDONS_MAVEN_GENERATE` |
| Addons | | `IMAGE_ADDONS_MAVEN_GOALS` |
| Addons | | `IMAGE_ADDONS_MVN_SETTINGS` |
| Addons | | `IMAGE_ADDONS_OC` |
| Addons | | `IMAGE_ADDONS_PARAM_BUILDER_IMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_GITINITIMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_KN_IMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_MAVEN_IMAGE` |
| Addons | | `IMAGE_ADDONS_PARAM_TKN_IMAGE` |
| Addons | | `IMAGE_ADDONS_PREPARE` |
| Addons | | `IMAGE_ADDONS_REPORT` |
| Addons | | `IMAGE_ADDONS_S2I_BUILD` |
| Addons | | `IMAGE_ADDONS_S2I_GENERATE` |
| Addons | | `IMAGE_ADDONS_SKOPEO_COPY` |
| Addons | | `IMAGE_ADDONS_SKOPEO_RESULTS` |
| Addons | | `IMAGE_ADDONS_TKN` |
| Addons | | `IMAGE_ADDONS_TKN_CLI_SERVE` |
| Addons | | `IMAGE_ADDONS_TKN_CLI_SERVE_INIT_CONFIG` |
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ require (
github.com/manifestival/manifestival v0.7.2
github.com/markbates/inflect v1.0.4
github.com/openshift-pipelines/pipelines-as-code v0.43.0
github.com/openshift/api v0.0.0-20260306002634-d3bbdada155c
github.com/openshift/api v0.0.0-20260429122012-1180c0f5c3e9
github.com/openshift/apiserver-library-go v0.0.0-20260303173613-cd3676268d31
github.com/openshift/client-go v0.0.0-20260306160707-3935d929fc7d
github.com/openshift/client-go v0.0.0-20260429123927-c81f86abfa6a
github.com/openshift/library-go v0.0.0-20260303171201-5d9eb6295ff6
github.com/sigstore/cosign/v2 v2.6.3
github.com/spf13/cobra v1.10.2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1032,12 +1032,12 @@ github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJw
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
github.com/openshift-pipelines/pipelines-as-code v0.43.0 h1:xbwfViXC5H5Gjp/MCNDq4ugfQCE+eLiLpwq63zfRAm0=
github.com/openshift-pipelines/pipelines-as-code v0.43.0/go.mod h1:mUmrLuQtdzWXcj+EeVJZv+RjkOkWwNDEEldc03spTn8=
github.com/openshift/api v0.0.0-20260306002634-d3bbdada155c h1:YQYiDzOLJzwQunxCaa5OpyNyMLPz4HJ2CLaKqUQOQjQ=
github.com/openshift/api v0.0.0-20260306002634-d3bbdada155c/go.mod h1:pyVjK0nZ4sRs4fuQVQ4rubsJdahI1PB94LnQ8sGdvxo=
github.com/openshift/api v0.0.0-20260429122012-1180c0f5c3e9 h1:lZw6pYY7El1giNk1lYvkp6hLungiqwIOqLlH+Hm7w9g=
github.com/openshift/api v0.0.0-20260429122012-1180c0f5c3e9/go.mod h1:pyVjK0nZ4sRs4fuQVQ4rubsJdahI1PB94LnQ8sGdvxo=
github.com/openshift/apiserver-library-go v0.0.0-20260303173613-cd3676268d31 h1:oYPQMrkzyk002L5aN8I2tkUHTEu9lsVrc1qiJmHJdXU=
github.com/openshift/apiserver-library-go v0.0.0-20260303173613-cd3676268d31/go.mod h1:mnTsMMTtXSPBQzqBp5HXBjLvliveKenRADFQy9m5jc0=
github.com/openshift/client-go v0.0.0-20260306160707-3935d929fc7d h1:T+9HFgEEcnu1TDDfsO5JcJC6N0/Kzob5AtG9IpITHJ8=
github.com/openshift/client-go v0.0.0-20260306160707-3935d929fc7d/go.mod h1:tIA3XSb/WsC/Fg0YNRfs/JrMrloBKPGF+NKVutd7nMI=
github.com/openshift/client-go v0.0.0-20260429123927-c81f86abfa6a h1:4GR6seHvlfv0rADe+LCQx63FqSExx6gaSo8uNiyWq+c=
github.com/openshift/client-go v0.0.0-20260429123927-c81f86abfa6a/go.mod h1:Lm7X7aYbAaKhGsNhgYaowP7hiLKwfN/w0r+Q6VlQoI8=
github.com/openshift/library-go v0.0.0-20260303171201-5d9eb6295ff6 h1:xjqy0OolrFdJ+ofI/aD0+2k9+MSk5anP5dXifFt539Q=
github.com/openshift/library-go v0.0.0-20260303171201-5d9eb6295ff6/go.mod h1:D797O/ssKTNglbrGchjIguFq+DbyRYdeds5w4/VTrKM=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
Expand Down
8 changes: 8 additions & 0 deletions operatorhub/openshift/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@ image-substitutions:
envKeys:
- IMAGE_PIPELINES_CONSOLE_PLUGIN

- image: registry.redhat.io/openshift-pipelines/pipelines-console-plugin-pf5-rhel9@
replaceLocations:
envTargets:
- deploymentName: openshift-pipelines-operator
containerName: openshift-pipelines-operator-lifecycle
envKeys:
- IMAGE_PIPELINES_CONSOLE_PLUGIN_LEGACY

# add third party images which are not replaced by operator
# but pulled directly by tasks here
defaultRelatedImages: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,8 @@ spec:
value: registry.redhat.io/ubi9/openjdk-17@sha256:d334d3c36867a1eef7daa598af10b5f620394ca0234b12e71b8b7e99bda9224e
- name: IMAGE_PIPELINES_CONSOLE_PLUGIN
value: registry.redhat.io/openshift-pipelines/pipelines-console-plugin-rhel9@
- name: IMAGE_PIPELINES_CONSOLE_PLUGIN_LEGACY
value: registry.redhat.io/openshift-pipelines/pipelines-console-plugin-pf5-rhel9@
- name: IMAGE_ADDONS_PREPARE_AND_RUN
value: registry.redhat.io/openshift-pipelines/pipelines-git-init-rhel9@
- image: registry.redhat.io/openshift-pipelines/pipelines-scheduler-rhel9@"
Expand Down Expand Up @@ -1230,6 +1232,8 @@ spec:
name: IMAGE_ADDONS_MAVEN_GOALS
- image: registry.redhat.io/openshift-pipelines/pipelines-console-plugin-rhel9@
name: IMAGE_PIPELINES_CONSOLE_PLUGIN
- image: registry.redhat.io/openshift-pipelines/pipelines-console-plugin-pf5-rhel9@
name: IMAGE_PIPELINES_CONSOLE_PLUGIN_LEGACY
- image: registry.redhat.io/openshift-pipelines/pipelines-git-init-rhel9@
name: IMAGE_ADDONS_PREPARE_AND_RUN
replaces: 1.7.0
Expand Down
49 changes: 49 additions & 0 deletions pkg/reconciler/openshift/common/common_utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
Copyright 2026 The Tekton Authors

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 common
Comment thread
pramodbindal marked this conversation as resolved.

import (
"context"
"fmt"

"github.com/Masterminds/semver"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func GetOCPVersion(ctx context.Context) (*semver.Version, error) {
Comment thread
pramodbindal marked this conversation as resolved.

if sharedConfigClient == nil {
return nil, fmt.Errorf("openshift Client is not initialized yet")
}

// Fetch the ClusterVersion object (always named "version")
cv, err := sharedConfigClient.ConfigV1().ClusterVersions().Get(ctx, "version", metav1.GetOptions{})
if err != nil {
// If running on standard Kubernetes, this will return an IsNotFound error.
// Handle gracefully if your operator supports both vanilla K8s and OCP.
return nil, err
}
versionStr := cv.Status.Desired.Version
if versionStr == "" {
return nil, fmt.Errorf("empty OpenShift version in ClusterVersion status")
}

v, err := semver.NewVersion(versionStr)
if err != nil {
return nil, fmt.Errorf("failed to parse OpenShift version %q: %w", versionStr, err)
}
return v, nil
}
44 changes: 44 additions & 0 deletions pkg/reconciler/openshift/common/common_utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Copyright 2026 The Tekton Authors

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 common

import (
"testing"

configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/client-go/config/clientset/versioned/fake"
"gotest.tools/v3/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func Test_GetOCPVersion(t *testing.T) {
cv := &configv1.ClusterVersion{
ObjectMeta: metav1.ObjectMeta{
Name: "version",
},
Status: configv1.ClusterVersionStatus{
Desired: configv1.Release{
Version: "v4.21.1",
},
},
}
sharedConfigClient = fake.NewClientset(cv)
ocpVersion, err := GetOCPVersion(t.Context())
if err != nil {
t.Error(err)
}
assert.Equal(t, ocpVersion.String(), "4.21.1")
}
28 changes: 22 additions & 6 deletions pkg/reconciler/openshift/tektonconfig/console_plugin_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (

"github.com/go-logr/zapr"
mf "github.com/manifestival/manifestival"

"github.com/tektoncd/operator/pkg/apis/operator/v1alpha1"
"github.com/tektoncd/operator/pkg/client/clientset/versioned"
"github.com/tektoncd/operator/pkg/reconciler/common"
occommon "github.com/tektoncd/operator/pkg/reconciler/openshift/common"
"github.com/tektoncd/operator/pkg/reconciler/shared/hash"
"go.uber.org/zap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -41,7 +41,8 @@ const (
// installerSet label value
consolePluginReconcileLabelCreatedByValue = "tekton-config-console-plugin-manifests"
// pipelines console plugin environment variable key
PipelinesConsolePluginImageEnvironmentKey = "IMAGE_PIPELINES_CONSOLE_PLUGIN"
PipelinesConsolePluginImageEnvironmentKey = "IMAGE_PIPELINES_CONSOLE_PLUGIN"
PipelinesConsolePluginImageEnvironmentKeyLegacy = "IMAGE_PIPELINES_CONSOLE_PLUGIN_LEGACY"
// pipelines console plugin container name, used to replace the image from the environment
PipelinesConsolePluginContainerName = "pipelines-console-plugin"
)
Expand Down Expand Up @@ -157,16 +158,31 @@ func (cpr *consolePluginReconciler) updateOnce(ctx context.Context) {
cpr.manifest = manifest

// update pipelines console image details
consoleImage, found := os.LookupEnv(PipelinesConsolePluginImageEnvironmentKey)

// Below logic is to pick Console Plugin Image based on the OCP Version.
// OCP versions older than 4.22 uses the legacy Console Plugin.
var envKey string
ocpVersion, err := occommon.GetOCPVersion(ctx)
if err != nil {
cpr.logger.Errorf("error getting OCP version: %q", err)
}
if ocpVersion.Major() == 4 && ocpVersion.Minor() < 22 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ocpVersion may be nil here if err != nil , which will panic

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

versionStr := cv.Status.Desired.Version
	if versionStr == "" {
		return nil, fmt.Errorf("empty OpenShift version in ClusterVersion status")
	}

As per this logic if version is missing then it will throw error.

cpr.logger.Infof("Using Legacy Console Plugin on OCP : %v", ocpVersion)
envKey = PipelinesConsolePluginImageEnvironmentKeyLegacy
} else {
envKey = PipelinesConsolePluginImageEnvironmentKey
}

consoleImage, found := os.LookupEnv(envKey)
if found {
cpr.pipelinesConsolePluginImage = consoleImage
cpr.logger.Debugw("pipelines console plugin image found from environment",
cpr.logger.Infow("pipelines console plugin image found from environment",
"image", consoleImage,
"environmentVariable", PipelinesConsolePluginImageEnvironmentKey,
"environmentVariable", envKey,
)
} else {
cpr.logger.Warnw("pipelines console plugin image not found from environment, continuing with the default image from the manifest",
"environmentVariable", PipelinesConsolePluginImageEnvironmentKey,
"environmentVariable", envKey,
)
}
})
Expand Down
Loading
Loading