简体   繁体   中英

OpenShift "cannot setup source secret"

When I try to build my project I get the following error as the only thing in the console

error: cannot setup source secret: no auth handler was found for secrets in /var/run/secrets/openshift.io/source

Immediately after the event "Build Started". I honestly have no idea what this error means and can't find anything about it. I suspect it may have something to do with:

a. It isn't using my package.json and is running into a library issue

b. The program creates internal files normally and it can't make those(I already tried adding a volume as far as I could tell) Tried running a console.log before that and it didn't work so I don't think this is it.

c. Something to do with needing a push/pull secret?

Any help would be appreciated

Would also like to add, using the key in-context maker on the build configuration does not work, I get a fetch source error. But going into Resources and making a generic secret does. Any advice on that would be great too

The reason you get this error is because your Secret object lacks the right 'type'.

You see some examples in Creating Build Inputs

Here's an example that will demonstrate the issue (when used), because it just uses the generic Opaque secret. As such, the build machinery doesn't know how to deal with it (hence, no handler)

oc create secret generic git-build `
  --from-file=ssh-privatekey=openshift_shiny_cameron_laptop

The correct way (if using oc create ) is to specify the --type . It is this type that determines that 'ssh-privatekey' is a required key in the secret.

oc create secret generic git-build `
  --type=kubernetes.io/ssh-auth `
  --from-file=ssh-privatekey=openshift_shiny_cameron_laptop

If you want the YAML, it looks something like this:

apiVersion: v1
kind: Secret
metadata:
  name: git-build
  namespace: MY_NAMESPACE
data:
  ssh-privatekey: ...
  ssh-publickey: ... note that this isn't actually used
type: kubernetes.io/ssh-auth

See Types of Secrets for more information of similar values other than kubernetes.io/ssh-auth

Note that you can also use this for specifying a '.gitconfig' key... but if you want to specify a known_hosts key, then you need to use a ConfigMap

Here's an example:

apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
  name: EXAMPLE
spec:
  lookupPolicy:
    local: false
---
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
  name: EXAMPLE
spec:
  source:
    git:
      uri: ssh://git.EXAMPLE/project/example.git
    configMaps:
    - configMap:
        name: git-ssh-config
        destination_dir: .ssh
  strategy:
    dockerStrategy: {}
  output:
    to:
      kind: ImageStreamTag
      name: "EXAMPLE:latest"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: git-ssh-config
  namespace: shiny
data:
  known_hosts: |
    git.EXAMPLE ssh-rsa ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM