Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
OpenShift从现有设置创建模板_Openshift_Openshift Origin - Fatal编程技术网

OpenShift从现有设置创建模板

OpenShift从现有设置创建模板,openshift,openshift-origin,Openshift,Openshift Origin,我试图从现有的安装程序中生成一个模板 oc export dc,svc,bc --selector="microservice=imagesvc" -o yaml --as-template=imagesvc 问题是模板将容器源指向my reigstry。我希望修改模板,使构建配置从源代码构建容器,然后将其附加到deploymentconfig。我怎样才能实现这样的目标 这是我目前拥有的配置。当我申请时,我会遇到各种各样的错误。作为构建中的一个示例,我得到“无效的输出引用” 在此方面的任何帮助

我试图从现有的安装程序中生成一个模板

oc export dc,svc,bc --selector="microservice=imagesvc" -o yaml --as-template=imagesvc
问题是模板将容器源指向my reigstry。我希望修改模板,使构建配置从源代码构建容器,然后将其附加到deploymentconfig。我怎样才能实现这样的目标

这是我目前拥有的配置。当我申请时,我会遇到各种各样的错误。作为构建中的一个示例,我得到“无效的输出引用”

在此方面的任何帮助都将不胜感激

apiVersion: v1
kind: Template
metadata:
  creationTimestamp: null
  name: imagesvc
objects:
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    generation: 1
    labels:
      app: gcsimageupload
      microservice: imagesvc
    name: gcsimageupload
  spec:
    replicas: 1
    selector:
      deploymentconfig: gcsimageupload
    strategy:
      activeDeadlineSeconds: 21600
      resources: {}
      rollingParams:
        intervalSeconds: 1
        maxSurge: 25%
        maxUnavailable: 25%
        timeoutSeconds: 600
        updatePeriodSeconds: 1
      type: Rolling
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: gcsimageupload
          deploymentconfig: gcsimageupload
          microservice: imagesvc
      spec:
        containers:
        - imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 10
          name: gcsimageupload
          ports:
          - containerPort: 8080
            protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          resources: {}
          terminationMessagePath: /dev/termination-log
          volumeMounts:
          - mountPath: /secret
            name: gcsimageupload-secret
            readOnly: true
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        securityContext: {}
        terminationGracePeriodSeconds: 30
        volumes:
        - name: gcsimageupload-secret
          secret:
            defaultMode: 420
            secretName: gcsimageupload-secret
    test: false
    triggers:
    - imageChangeParams:
        automatic: true
        containerNames:
        - gcsimageupload
        from:
          kind: ImageStreamTag
          name: gcsimageupload:latest
          namespace: web
      type: ImageChange
    - type: ConfigChange
  status:
    availableReplicas: 0
    latestVersion: 0
    observedGeneration: 0
    replicas: 0
    unavailableReplicas: 0
    updatedReplicas: 0
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    generation: 1
    labels:
      app: imagesvc
      microservice: imagesvc
    name: imagesvc
  spec:
    replicas: 1
    selector:
      deploymentconfig: imagesvc
    strategy:
      activeDeadlineSeconds: 21600
      resources: {}
      rollingParams:
        intervalSeconds: 1
        maxSurge: 25%
        maxUnavailable: 25%
        timeoutSeconds: 600
        updatePeriodSeconds: 1
      type: Rolling
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: imagesvc
          deploymentconfig: imagesvc
          microservice: imagesvc
      spec:
        containers:
        - imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 10
          name: imagesvc
          ports:
          - containerPort: 8080
            protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 10
          resources: {}
          terminationMessagePath: /dev/termination-log
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        securityContext: {}
        terminationGracePeriodSeconds: 30
    test: false
    triggers:
    - imageChangeParams:
        automatic: true
        containerNames:
        - imagesvc
        from:
          kind: ImageStreamTag
          name: imagesvc:latest
          namespace: web
      type: ImageChange
    - type: ConfigChange
  status:
    availableReplicas: 0
    latestVersion: 0
    observedGeneration: 0
    replicas: 0
    unavailableReplicas: 0
    updatedReplicas: 0
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    generation: 1
    labels:
      app: imaginary
      microservice: imagesvc
    name: imaginary
  spec:
    replicas: 1
    selector:
      app: imaginary
      deploymentconfig: imaginary
    strategy:
      activeDeadlineSeconds: 21600
      resources: {}
      rollingParams:
        intervalSeconds: 1
        maxSurge: 25%
        maxUnavailable: 25%
        timeoutSeconds: 600
        updatePeriodSeconds: 1
      type: Rolling
    template:
      metadata:
        annotations:
          openshift.io/generated-by: OpenShiftWebConsole
        creationTimestamp: null
        labels:
          app: imaginary
          deploymentconfig: imaginary
          microservice: imagesvc
      spec:
        containers:
        - image: h2non/imaginary
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /health
              port: 9000
              scheme: HTTP
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          name: imaginary
          ports:
          - containerPort: 9000
            protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /health
              port: 9000
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          resources: {}
          terminationMessagePath: /dev/termination-log
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        securityContext: {}
        terminationGracePeriodSeconds: 30
    test: false
    triggers:
    - type: ConfigChange
    - imageChangeParams:
        automatic: true
        containerNames:
        - imaginary
        from:
          kind: ImageStreamTag
          name: imaginary:latest
          namespace: web
      type: ImageChange
  status:
    availableReplicas: 0
    latestVersion: 0
    observedGeneration: 0
    replicas: 0
    unavailableReplicas: 0
    updatedReplicas: 0
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    labels:
      app: gcsimageupload
      microservice: imagesvc
    name: gcsimageupload
  spec:
    ports:
    - name: 8080-tcp
      port: 8080
      protocol: TCP
      targetPort: 8080
    selector:
      deploymentconfig: gcsimageupload
    sessionAffinity: None
    type: ClusterIP
  status:
    loadBalancer: {}
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
      service.alpha.openshift.io/dependencies: '[{"name":"gcsimageupload","namespace":"","kind":"Service"},{"name":"imaginary","namespace":"","kind":"Service"}]'
    creationTimestamp: null
    labels:
      app: imagesvc
      microservice: imagesvc
    name: imagesvc
  spec:
    ports:
    - name: 8080-tcp
      port: 8080
      protocol: TCP
      targetPort: 8080
    selector:
      deploymentconfig: imagesvc
    sessionAffinity: None
    type: ClusterIP
  status:
    loadBalancer: {}
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    labels:
      app: imaginary
      microservice: imagesvc
    name: imaginary
  spec:
    ports:
    - name: 9000-tcp
      port: 9000
      protocol: TCP
      targetPort: 9000
    selector:
      deploymentconfig: imaginary
    sessionAffinity: None
    type: ClusterIP
  status:
    loadBalancer: {}
- apiVersion: v1
  kind: BuildConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    labels:
      app: gcsimageupload
      microservice: imagesvc
    name: gcsimageupload
  spec:
    nodeSelector: null
    output:
      to:
        kind: ImageStreamTag
        name: gcsimageupload:latest
    postCommit: {}
    resources: {}
    runPolicy: Serial
    source:
      git:
        ref: master
        uri: https://github.com/un1x86/openshift-ms-gcsFileUpload.git
      type: Git
    strategy:
      sourceStrategy:
        env:
        - name: GCS_PROJECT
          value: ${GCS_PROJECT_ID}
        - name: GCS_KEY_FILENAME
          value: ${GCS_KEY_FILENAME}
        - name: GCS_BUCKET
          value: ${GCS_BUCKET}
        from:
          kind: ImageStreamTag
          name: nodejs:4
          namespace: openshift
      type: Source
    triggers:
    - github:
        secret: f9928132855c5a30
      type: GitHub
    - generic:
        secret: 77ece14f810caa3f
      type: Generic
    - imageChange: {}
      type: ImageChange
    - type: ConfigChange
  status:
    lastVersion: 0
- apiVersion: v1
  kind: BuildConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftWebConsole
    creationTimestamp: null
    labels:
      app: imagesvc
      microservice: imagesvc
    name: imagesvc
  spec:
    nodeSelector: null
    output:
      to:
        kind: ImageStreamTag
        name: imagesvc:latest
    postCommit: {}
    resources: {}
    runPolicy: Serial
    source:
      git:
        ref: master
        uri: https://github.com/un1x86/openshift-ms-imagesvc.git
      type: Git
    strategy:
      sourceStrategy:
        env:
        - name: IMAGINARY_APPLICATION_DOMAIN
          value: http://imaginary:9000
        - name: GCSIMAGEUPLOAD_APPLICATION_DOMAIN
          value: http://gcsimageupload:8080
        from:
          kind: ImageStreamTag
          name: nodejs:4
          namespace: openshift
      type: Source
    triggers:
    - generic:
        secret: 945da12357ef35cf
      type: Generic
    - github:
        secret: 18106312cfa8e2d1
      type: GitHub
    - imageChange: {}
      type: ImageChange
    - type: ConfigChange
  status:
    lastVersion: 0
parameters:
    - description: "GCS Project ID"
      name: GCS_PROJECT_ID
      value: ""
      required: true
    - description: "GCS Key Filename"
      name: GCS_KEY_FILENAME
      value: /secret/keyfile.json
      required: true
    - description: "GCS Bucket name"
      name: GCS_BUCKET
      value: ""
      required: true

您需要创建两个名为“imagesvc”和“gcsimageupload”的imagestreams。您可以通过cli“oc create is”或向模板中添加以下内容来完成此操作:

- kind: ImageStream
  apiVersion: v1
  metadata:
    name: <name>
  spec:
    lookupPolicy:
      local: false
-种类:ImageStream
版本:v1
元数据:
姓名:
规格:
lookupPolicy:
本地:错

您需要创建两个名为“imagesvc”和“gcsimageupload”的imagestreams。您可以通过cli“oc create is”或向模板中添加以下内容来完成此操作:

- kind: ImageStream
  apiVersion: v1
  metadata:
    name: <name>
  spec:
    lookupPolicy:
      local: false
-种类:ImageStream
版本:v1
元数据:
姓名:
规格:
lookupPolicy:
本地:错

最简单的方法是导出“is”以及“dc、svc、bc”。尽管如此,仍然需要进行一些修复,因为导出机制仍然将引用保留在图像注册表中,而不是正确地引用图像流。如果OP可以更新包含“is”导出的问题,则可以指出所需的其他更改。更简单的方法是导出“is”以及“dc、svc、bc”。尽管如此,仍然需要进行一些修复,因为导出机制仍然将引用保留在图像注册表中,而不是正确地引用图像流。如果OP可以更新包含“is”导出的问题,则可以指出所需的其他更改。当我在笔记本电脑上使用3.11安装运行
oc export
时,我会收到一条消息,因为
export
不是已知命令。此命令似乎仅在4.2中有效。因此,我对几乎2.5年前oc export的工作原理感到困惑!当我在笔记本电脑上安装3.11时运行
ocexport
时,会收到一条消息,因为
export
不是已知命令。此命令似乎仅在4.2中有效。因此,我对几乎2.5年前oc export的工作原理感到困惑!