Skip to content

Commit 799ab9d

Browse files
committed
fix: PaC build
* Fixed detection of PaC controller URL for unprivileged users. * Use fn.Deploy.Image before fn.Image since the fn.Image may not be populated. Signed-off-by: Matej Vašek <[email protected]>
1 parent 7fe73f8 commit 799ab9d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

pkg/pipelines/tekton/pac/pac.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
func DetectPACInstallation(ctx context.Context, wantedNamespace string) (bool, string, error) {
2727
var installed bool
2828

29-
clientPac, _, err := NewTektonPacClientAndResolvedNamespace("")
29+
clientPac, cns, err := NewTektonPacClientAndResolvedNamespace("")
3030
if err != nil {
3131
return false, "", err
3232
}
@@ -36,7 +36,7 @@ func DetectPACInstallation(ctx context.Context, wantedNamespace string) (bool, s
3636
return false, "", err
3737
}
3838

39-
_, err = clientPac.Repositories("").List(ctx, metav1.ListOptions{})
39+
_, err = clientPac.Repositories(cns).List(ctx, metav1.ListOptions{})
4040
if err != nil && k8serrors.IsNotFound(err) {
4141
return false, "", nil
4242
}

pkg/pipelines/tekton/pipelines_pac_provider.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (pp *PipelinesProvider) createLocalPACResources(ctx context.Context, f fn.F
133133
// also creates PVC for the function source code
134134
func (pp *PipelinesProvider) createClusterPACResources(ctx context.Context, f fn.Function, metadata pipelines.PacMetadata) error {
135135
// figure out pac installation namespace
136-
installed, _, err := pac.DetectPACInstallation(ctx, "")
136+
installed, _, err := pac.DetectPACInstallation(ctx, "openshift-pipelines")
137137
if !installed {
138138
errMsg := ""
139139
if err != nil {
@@ -154,7 +154,12 @@ func (pp *PipelinesProvider) createClusterPACResources(ctx context.Context, f fn
154154
labels = pp.decorator.UpdateLabels(f, labels)
155155
}
156156

157-
registry, err := docker.GetRegistry(f.Image)
157+
img := f.Deploy.Image
158+
if img == "" {
159+
img = f.Image
160+
}
161+
162+
registry, err := docker.GetRegistry(img)
158163
if err != nil {
159164
return fmt.Errorf("problem in resolving image registry name: %w", err)
160165
}
@@ -163,7 +168,7 @@ func (pp *PipelinesProvider) createClusterPACResources(ctx context.Context, f fn
163168
registry = authn.DefaultAuthKey
164169
}
165170

166-
creds, err := pp.credentialsProvider(ctx, f.Image)
171+
creds, err := pp.credentialsProvider(ctx, img)
167172
if err != nil {
168173
return err
169174
}
@@ -199,7 +204,7 @@ func (pp *PipelinesProvider) createClusterPACResources(ctx context.Context, f fn
199204
func (pp *PipelinesProvider) createRemotePACResources(ctx context.Context, f fn.Function, metadata pipelines.PacMetadata) error {
200205

201206
// figure out pac installation namespace
202-
installed, installationNS, err := pac.DetectPACInstallation(ctx, "")
207+
installed, installationNS, err := pac.DetectPACInstallation(ctx, "openshift-pipelines")
203208
if !installed {
204209
errMsg := ""
205210
if err != nil {

0 commit comments

Comments
 (0)