Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function failed to build after renaming the used secret #219

Closed
lizzzcai opened this issue Jan 14, 2022 · 1 comment · Fixed by #220
Closed

Function failed to build after renaming the used secret #219

lizzzcai opened this issue Jan 14, 2022 · 1 comment · Fixed by #220
Assignees
Labels
bug Something isn't working

Comments

@lizzzcai
Copy link
Member

Description
Function failed to build after renaming or deleting the secret used previously

Environmental
Tell us what your cluster environment is like, e.g.

  • Operating System Information
  • kubernetes version: 1.21.5
  • OpenFunction version: latest
  • Versions of dependent components (e.g. dapr, keda, shipwright, knative)
    • Shipwright: v0.6.0

Expected behavior
The Function should be able to build even the push secret being deleted

Actual behavior
Once I delete the push-secret and create another secret with a different name (push-secret-new), ofn is not able to build the function

To Reproduce

  1. create a push secret: push-secret
  2. build a function
apiVersion: core.openfunction.io/v1alpha2
kind: Function
metadata:
  name: function-sample
spec:
  version: "v1.0.0"
  image: "openfunctiondev/sample-go-func:latest"
  imageCredentials:
    name: push-secret
  port: 8080 # default to 8080
  build:
    builder: openfunction/builder:v1
    env:
      FUNC_NAME: "HelloWorld"
      FUNC_TYPE: "http"
    srcRepo:
      url: "https://github.com/OpenFunction/samples.git"
      sourceSubPath: "functions/Knative/hello-world-go"
  serving:
    runtime: "Knative" # default to Knative
    template:
      containers:
        - name: function
          imagePullPolicy: Always
  1. delete the push-secret and create a new one called: push-secret-new
  2. build the function again
apiVersion: core.openfunction.io/v1alpha2
kind: Function
metadata:
  name: function-sample-new
spec:
  version: "v1.0.0"
  image: "openfunctiondev/sample-go-func:latest"
  imageCredentials:
    name: push-secret-new # <-update the secret
  port: 8080 # default to 8080
  build:
    builder: openfunction/builder:v1
    env:
      FUNC_NAME: "HelloWorld"
      FUNC_TYPE: "http"
    srcRepo:
      url: "https://github.com/OpenFunction/samples.git"
      sourceSubPath: "functions/Knative/hello-world-go"
  serving:
    runtime: "Knative" # default to Knative
    template:
      containers:
        - name: function
          imagePullPolicy: Always
  1. See error
❯ k get buildrun
NAME                           SUCCEEDED   REASON           STARTTIME   COMPLETIONTIME
builder-lckjg-buildrun-mpgq4   False       CouldntGetTask   2m1s        2m1s

...
    conditions:
    - lastTransitionTime: "2022-01-14T09:17:13Z"
      message: 'failed to create task run pod "builder-lckjg-buildrun-mpgq4-wqfwp":
        translating TaskSpec to Pod: secrets "push-secret" not found. Maybe invalid
        TaskSpec'
      reason: CouldntGetTask
      status: "False"
      type: Succeeded

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

It is an issue from Shipwright, please refer to this issue: shipwright-io/build#969

@benjaminhuo
Copy link
Member

benjaminhuo commented Jan 17, 2022

Thanks for finding this problem and providing a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants