简体   繁体   English

OpenShift“无法设置源密码”

[英]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".在事件“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它没有使用我的 package.json 并且遇到了库问题

b. 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.该程序通常会创建内部文件,但无法创建这些文件(据我所知,我已经尝试添加一个卷)在此之前尝试运行 console.log 但它没有用,所以我不认为这是它.

c. 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.但是进入 Resources 并制作一个通用的秘密就可以了。 Any advice on that would be great too对此的任何建议也很好

The reason you get this error is because your Secret object lacks the right 'type'.您收到此错误的原因是您的 Secret 对象缺少正确的“类型”。

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.这是一个将演示该问题(使用时)的示例,因为它仅使用通用的 Opaque 秘密。 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 .正确的方法(如果使用oc create )是指定--type It is this type that determines that 'ssh-privatekey' is a required key in the secret.正是这种类型决定了“ssh-privatekey”是秘密中必需的密钥。

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:如果你想要 YAML,它看起来像这样:

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有关除 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请注意,您也可以使用它来指定“.gitconfig”键...但是如果您想指定一个 known_hosts 键,那么您需要使用 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 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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