Skip to content

Commit 2ab1743

Browse files
committed
Create new namespace pull secret based on namespace pull robot account
which is granted read permisssions for all ImageRepositories in the namespace, namespace pull secret is also linked to component build SA and integration SA, new annotation 'image-controller.appstudio.redhat.com/ensure-namespace-pull-secret' is introduced as well, which is set to 'false' after namespace pull secret is created, when set to 'true' it will force to create namespace pull robot account and namespace secret, component linking check is based now only on component label, as new model won't have anymore application STONEBLD-4018 Signed-off-by: Robert Cerven <rcerven@redhat.com>
1 parent 3f8501f commit 2ab1743

24 files changed

+1421
-342
lines changed

api/v1alpha1/imagerepository_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ type ImageCredentials struct {
6464
// Refreshes both, push and pull tokens.
6565
// The field gets cleared after the refresh.
6666
RegenerateToken *bool `json:"regenerate-token,omitempty"`
67+
// RegenerateNamespacePullToken defines a request to refresh namespace pull robot credentials.
68+
// The field gets cleared after the refresh.
69+
RegenerateNamespacePullToken *bool `json:"regenerate-namespace-pull-token,omitempty"`
6770
// VerifyLinking defines a request to verify and fix
6871
// secret linking in pipeline service account.
6972
// The field gets cleared after fixing.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/coverage_init.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ package main
77
// from the running binary during E2E tests.
88

99
import _ "github.com/konflux-ci/coverport/instrumentation/go" // starts coverage server via init()
10-

cmd/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ import (
4747
"sigs.k8s.io/controller-runtime/pkg/webhook"
4848

4949
"github.com/go-logr/logr"
50+
applicationapiv1alpha1 "github.com/konflux-ci/application-api/api/v1alpha1"
5051
imagerepositoryv1alpha1 "github.com/konflux-ci/image-controller/api/v1alpha1"
5152
controllers "github.com/konflux-ci/image-controller/internal/controller"
5253
controllermetrics "github.com/konflux-ci/image-controller/pkg/metrics"
5354
"github.com/konflux-ci/image-controller/pkg/quay"
54-
appstudioredhatcomv1alpha1 "github.com/redhat-appstudio/application-api/api/v1alpha1"
55+
routev1 "github.com/openshift/api/route/v1"
5556
// +kubebuilder:scaffold:imports
5657
)
5758

@@ -69,7 +70,8 @@ var (
6970
func init() {
7071
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
7172

72-
utilruntime.Must(appstudioredhatcomv1alpha1.AddToScheme(scheme))
73+
utilruntime.Must(routev1.AddToScheme(scheme))
74+
utilruntime.Must(applicationapiv1alpha1.AddToScheme(scheme))
7375
utilruntime.Must(imagerepositoryv1alpha1.AddToScheme(scheme))
7476
// +kubebuilder:scaffold:scheme
7577
}

config/crd/bases/appstudio.redhat.com_imagerepositories.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ spec:
4949
credentials:
5050
description: Credentials management.
5151
properties:
52+
regenerate-namespace-pull-token:
53+
description: |-
54+
RegenerateNamespacePullToken defines a request to refresh namespace pull robot credentials.
55+
The field gets cleared after the refresh.
56+
type: boolean
5257
regenerate-token:
5358
description: |-
5459
RegenerateToken defines a request to refresh image accessing credentials.

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,11 @@ rules:
8282
- get
8383
- patch
8484
- update
85+
- apiGroups:
86+
- route.openshift.io
87+
resources:
88+
- routes
89+
verbs:
90+
- get
91+
- list
92+
- watch

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ toolchain go1.24.6
77
require (
88
github.com/go-logr/logr v1.4.3
99
github.com/h2non/gock v1.2.0
10+
github.com/konflux-ci/application-api v0.0.0-20251126155256-d24742e8b026
1011
github.com/onsi/ginkgo/v2 v2.26.0
1112
github.com/onsi/gomega v1.38.2
13+
github.com/openshift/api v0.0.0-20221013123534-96eec44e1979
1214
github.com/prometheus/client_golang v1.19.1
13-
github.com/redhat-appstudio/application-api v0.0.0-20231026192857-89515ad2504f
1415
go.uber.org/zap v1.27.0
1516
gotest.tools/v3 v3.5.2
1617
k8s.io/api v0.31.0

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
9494
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
9595
github.com/konflux-ci/coverport/instrumentation/go v0.0.0-20251127103713-95b5b5e04a62 h1:lMTed+H0EesSqsH3iQXtLoy/+SpbBT0BS1J0izeEtFM=
9696
github.com/konflux-ci/coverport/instrumentation/go v0.0.0-20251127103713-95b5b5e04a62/go.mod h1:WVMHU9A2464s/vjH1xOTm4LJDD4xP+VlEiU+KM0gkSU=
97+
github.com/konflux-ci/application-api v0.0.0-20251126155256-d24742e8b026 h1:Y6oKDSxmDY7JiNsrPm0ZRUcW+9cv20B71DuitI3sl28=
98+
github.com/konflux-ci/application-api v0.0.0-20251126155256-d24742e8b026/go.mod h1:948Z+a1IbfRT0RtoHzWWSN9YEucSbMJTHaMhz7dVICc=
9799
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
98100
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
99101
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
@@ -120,6 +122,8 @@ github.com/onsi/ginkgo/v2 v2.26.0 h1:1J4Wut1IlYZNEAWIV3ALrT9NfiaGW2cDCJQSFQMs/gE
120122
github.com/onsi/ginkgo/v2 v2.26.0/go.mod h1:qhEywmzWTBUY88kfO0BRvX4py7scov9yR+Az2oavUzw=
121123
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
122124
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
125+
github.com/openshift/api v0.0.0-20221013123534-96eec44e1979 h1:NkfbwN34Q/UtfKUFEO9pxmdY06A/jBk80YBua+mxwUc=
126+
github.com/openshift/api v0.0.0-20221013123534-96eec44e1979/go.mod h1:LEnw1IVscIxyDnltE3Wi7bQb/QzIM8BfPNKoGA1Qlxw=
123127
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
124128
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
125129
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -135,8 +139,6 @@ github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G
135139
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
136140
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
137141
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
138-
github.com/redhat-appstudio/application-api v0.0.0-20231026192857-89515ad2504f h1:PoKf7gCV/g5blkzVlODkqeynmfIACcR7NqWF8eqnuec=
139-
github.com/redhat-appstudio/application-api v0.0.0-20231026192857-89515ad2504f/go.mod h1:YvckuKHe82eWloGk0/BpSw4YYG2owrGZAanztbOj3pQ=
140142
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
141143
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
142144
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=

0 commit comments

Comments
 (0)