OpenShift从源码构建部署应用初体验

OpenShift从源码构建部署应用初体验

这两天在翻OceanBase 0.4版本(唯一开源的版本)的源码,原因是前些天有人讲OceanBase非分区表的数据也是打散到多个节点分布的,这与我观看过的蚂蚁金融云上OB文档不一样,文档中讲OB是基于表分区在多个节点间分布数据的,非分区表不打散全部数据的任一副本只存放在一个节点上。后来了解到是OB过往版本与现行版本间数据分布的方式不一样。

所以大致翻了下开源的0.4版本代码,了解到这时还是通过表rowKey与rowkey_split来分布数据到多个tablet:rowkey是主键;rowkey_split表示主键前多少比特位相同的数据存放在同一tablet上;tablet相当于子表的概念,多个tablet分布到各个节点上。只是粗略地翻了下代码,还没有仔细地去了解具体是怎么实现分布的。

捯代码捯烦了,来点儿新鲜玩意儿,来体验下通过OpenShift Web Console,从源码构建部署示例应用的过程。

整个过程使用了上篇文章中讲到的MiniShift环境,但,构建过程中发现“卡”,就去OpenShift Online申请了个Free用户………

登录OpenShift

OpenShift从源码构建部署应用初体验_第1张图片

创建项目

以developer用户登录OpenShift Origin后,首页面是长这个样子,点右上角的“Create Project”来创建一个新项目“:
OpenShift从源码构建部署应用初体验_第2张图片

出现新建项目对话框后,输入项目相关信息,项目名、显示名称与描述内容,这里我们无创意地使用书中给出的内容:
OpenShift从源码构建部署应用初体验_第3张图片

项目创建完毕后,会在右侧上角给出一个项目列表,点我们新建项目“My Bank”名称,进入项目概览(Overview)页面。
OpenShift从源码构建部署应用初体验_第4张图片

项目概览(Overview)页面:
OpenShift从源码构建部署应用初体验_第5张图片

应用构建部署配置

在上面展现的项目概览页面上,戳“Browse Catalog”,进入”Catalog”目录来选择构建应用的类型:
OpenShift从源码构建部署应用初体验_第6张图片

因为示例代码是Java编写的简单Web应用,所以选择路径就是:Languages => Java => WildFly,之后会弹出Build Config对话框:
OpenShift从源码构建部署应用初体验_第7张图片

继续下一步,填写应用名称与代码GitHub地址,继续“抄袭”书中:
OpenShift从源码构建部署应用初体验_第8张图片

填完内容并选择所在项目后,按“Create”,会告诉你构建与部署配置已完成,可以转去”Project overview”旁观了:
OpenShift从源码构建部署应用初体验_第9张图片

应用概览-构建中

构建部署配置完毕后,重新转回到项目概览(Project Overview),会看到新创建的应用已经存在于列表中,点击应用名称左侧下拉箭头,可以观察到应用目前正在处于构建(Build)过程:
OpenShift从源码构建部署应用初体验_第10张图片

从页面上我们可以看到,OpenShift Orign至少已经自动创建了4个配置:

  1. DeploymentConfig 部署配置,指导应用部署,包括POD模板、部署触发配置等
  2. BuildConfig 构建配置,指导应用构建过程,包括源码位置、构建策略、构建触发配置等
  3. Service 服务配置, Kubernetes概念,屏蔽POD地址变化,以服务名称替代实际地址来调用
  4. Routes 路由配置,Kubernetes概念,通过Ingress对外暴露服务

这些配置项,通过命令行客户端oc,也是可以查看到的:

$ oc get all -o name
deploymentconfigs/mybank ⑴
buildconfigs/mybank      ⑵
services/mybank          ⑶
routes/mybank            ⑷
imagestreams/mybank
builds/mybank-1 
pods/mybank-1-build

上面命令输出内容中,多出来的三项分别是镜像流(imagestreams)配置、构建实例(builder)配置与构建实例POD名称。imagestreams是OpenShift用来管理容器镜像的方式,把一个具体容器镜像的各个版本信息组织在一起,供DeploymentConfig引用;“build/mybank-1”是一次构建的实例配置,“pods/mybank-1-build”是一次构建实际执行构建过程的POD,在这个示例中,它是由S2I(Source to Image)镜像实例化的容器组成。

在页面右下角可以看到构建日志输出小窗口,滚动显示构建过程中产生的日志信息。

构建信息

直接点击上图中红色数字“2”标示的构建(build)名称,或者从左侧菜单中选择,都可以进入构建信息页:
OpenShift从源码构建部署应用初体验_第11张图片

构建的每一次(重新)执行,都会在这页面的列表中出现以数字编号一行内容,展示构建状态、执行时间、创建时间。点那个编号(红色数据“1”标示处),进入某次实际构建实例(builder)的详细信息页面,在这个页面上可查看构建日志与事件信息:
OpenShift从源码构建部署应用初体验_第12张图片

OpenShift从源码构建部署应用初体验_第13张图片

从上面的构建事件列表中,可以看到是从AWS提供的Docker镜像仓库中拉取了S2I镜像,创建了一个名为”mybank-1-build”的POD,实际执行了由构建配置buildconfigs/mybank派生出的构建实例(builder)配置builds/mybank-1指导的构建过程。

在事件列表中,拉取S2I镜像执行了三次,猜测(目前是瞎猜)与构建实例POD的模板配置有关,让我们来看看此POD的详细信息页面:
OpenShift从源码构建部署应用初体验_第14张图片

从模板信息上看,在POD初始阶段使用了两次S2I镜像生成初始化容器(Init Containers),分别执行命令:

  • openshift-git-clone –loglevel=0 克隆源码到本地
  • openshift-manage-dockerfile –loglevel=0 生成Dockerfile或使用现成Dockerfile?

POD初始化阶段完成后,进入运行阶段,使用S2I镜像生成容器执行构建命令:

  • openshift-sti-build –loglevel=0

应用概览-构建后

OpenShift从源码构建部署应用初体验_第15张图片
构建完成后,应用概览的中间应用部署信息栏位出现了信息,图中已用红框与红圈标出,红圈中的那个蓝圈中显示当前应用部署的POD个数,可通过蓝圈右侧上下箭头增加或减少POD个数。

有没有发现,Route Url路径变了,嘿嘿,这是从本地minishift换到openshift online的原因。

应用部署/POD信息

OpenShift从源码构建部署应用初体验_第16张图片
OpenShift从源码构建部署应用初体验_第17张图片

镜像流信息

OpenShift从源码构建部署应用初体验_第18张图片
OpenShift从源码构建部署应用初体验_第19张图片
OpenShift从源码构建部署应用初体验_第20张图片

总结

自从在私有云环境中搭建了个Kubernetes运行环境后,一直在能在其上运行的PaaS平台,曾经关注过Fabric8,但看了眼用来自动化部署的Helm配置文件,里面用到的Docker镜像太多了,我恐惧了怕麻烦(私有云环境连外网不容易啊),也就没有去安装。
现在,简单试用了下OpenShift Origin来自动化构建部署应用,目前感觉还是简单易用的,也可能是因为只是初步尝试,还没达到“用到深处全是坑儿”的深度。

附录-配置详细内容

  • dc/mybanck
$ oc get dc/mybank -o yaml
apiVersion: v1
kind: DeploymentConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: 2018-03-23T05:40:51Z
  generation: 1
  labels:
    app: mybank
  name: mybank
  namespace: mybank
  resourceVersion: "10116"
  selfLink: /oapi/v1/namespaces/mybank/deploymentconfigs/mybank
  uid: bf202169-2e5c-11e8-8e27-eed4a77e066c
spec:
  replicas: 1
  selector:
    deploymentconfig: mybank
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: mybank
        deploymentconfig: mybank
    spec:
      containers:
      - image: mybank:latest
        imagePullPolicy: Always
        name: mybank
        ports:
        - containerPort: 8080
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
  test: false
  triggers:
  - imageChangeParams:
      automatic: true
      containerNames:
      - mybank
      from:
        kind: ImageStreamTag
        name: mybank:latest
        namespace: mybank
    type: ImageChange
  - type: ConfigChange
status:
  availableReplicas: 0
  conditions:
  - lastTransitionTime: 2018-03-23T05:40:51Z
    lastUpdateTime: 2018-03-23T05:40:51Z
    message: Deployment config does not have minimum availability.
    status: "False"
    type: Available
  latestVersion: 0
  observedGeneration: 1
  replicas: 0
  unavailableReplicas: 0
  updatedReplicas: 0
  • is/mybank
$ oc get is/mybank -o yaml
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: '2018-03-23T07:22:43Z'
  generation: 1
  labels:
    app: mybank
  name: mybank
  namespace: mybank
  resourceVersion: '768959353'
  selfLink: /apis/image.openshift.io/v1/namespaces/mybank/imagestreams/mybank
  uid: fa103195-2e6a-11e8-8e17-06579ed29230
spec:
  lookupPolicy:
    local: false
status:
  dockerImageRepository: 'docker-registry.default.svc:5000/mybank/mybank'
  tags:
    - items:
        - created: '2018-03-23T07:24:46Z'
          dockerImageReference: >-
            docker-registry.default.svc:5000/mybank/mybank@sha256:096004b65a6c596a318c0d6e8cfaa1a3dec3238b7c02430c6ed5e0d360f4fe89
          generation: 1
          image: >-
            sha256:096004b65a6c596a318c0d6e8cfaa1a3dec3238b7c02430c6ed5e0d360f4fe89
      tag: latest
  • bc/mybank
$ oc get bc/mybank -o yaml
apiVersion: v1
kind: BuildConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: 2018-03-23T05:40:51Z
  labels:
    app: mybank
  name: mybank
  namespace: mybank
  resourceVersion: "10119"
  selfLink: /oapi/v1/namespaces/mybank/buildconfigs/mybank
  uid: bf213499-2e5c-11e8-8e27-eed4a77e066c
spec:
  nodeSelector: null
  output:
    to:
      kind: ImageStreamTag
      name: mybank:latest
  postCommit: {}
  resources: {}
  runPolicy: Serial
  source:
    git:
      ref: master
      uri: https://github.com/nichochen/mybank-demo-maven
    type: Git
  strategy:
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: wildfly:10.1
        namespace: openshift
    type: Source
  triggers:
  - imageChange:
      lastTriggeredImageID: openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280
    type: ImageChange
  - type: ConfigChange
  - generic:
      secret: 2492cbc56d90119d
    type: Generic
  - github:
      secret: 81ba00bb283f56a7
    type: GitHub
status:
  lastVersion: 1

  • bd/mybank-1
$ oc get builds/mybank-1 -o yaml
apiVersion: build.openshift.io/v1
kind: Build
metadata:
  annotations:
    openshift.io/build-config.name: mybank
    openshift.io/build.number: '1'
    openshift.io/build.pod-name: mybank-1-build
  creationTimestamp: '2018-03-23T05:40:52Z'
  labels:
    app: mybank
    buildconfig: mybank
    openshift.io/build-config.name: mybank
    openshift.io/build.start-policy: Serial
  name: mybank-1
  namespace: mybank
  ownerReferences:
    - apiVersion: build.openshift.io/v1
      controller: true
      kind: BuildConfig
      name: mybank
      uid: bf213499-2e5c-11e8-8e27-eed4a77e066c
  resourceVersion: '10150'
  selfLink: /apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1
  uid: bf9eece7-2e5c-11e8-8e27-eed4a77e066c
spec:
  nodeSelector: null
  output:
    pushSecret:
      name: builder-dockercfg-lpjhm
    to:
      kind: ImageStreamTag
      name: 'mybank:latest'
  postCommit: {}
  resources: {}
  revision:
    git:
      author:
        email: nicosoftware@msn.com
        name: Geng Chen
      commit: 5f550ef361dc1abad8a32a00334a327f3e713568
      committer:
        email: nicosoftware@msn.com
        name: Geng Chen
      message: Fix Chinese characters
    type: Git
  serviceAccount: builder
  source:
    git:
      ref: master
      uri: 'https://github.com/nichochen/mybank-demo-maven'
    type: Git
  strategy:
    sourceStrategy:
      from:
        kind: DockerImage
        name: >-
          openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280
    type: Source
  triggeredBy:
    - imageChangeBuild:
        fromRef:
          kind: ImageStreamTag
          name: 'wildfly:10.1'
          namespace: openshift
        imageID: >-
          openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280
      message: Image change
status:
  config:
    kind: BuildConfig
    name: mybank
    namespace: mybank
  output: {}
  outputDockerImageReference: '172.30.1.1:5000/mybank/mybank:latest'
  phase: Running
  stages:
    - durationMilliseconds: 7878
      name: FetchInputs
      startTime: '2018-03-23T05:40:57Z'
      steps:
        - durationMilliseconds: 7878
          name: FetchGitSource
          startTime: '2018-03-23T05:40:57Z'
  startTimestamp: '2018-03-23T05:40:52Z'
  • po/mybank-1-build
apiVersion: v1
kind: Pod
metadata:
  annotations:
    openshift.io/build.name: mybank-1
    openshift.io/scc: privileged
    pod.alpha.kubernetes.io/init-container-statuses: >-
      [{"name":"git-clone","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":"2018-03-23T05:40:55Z","finishedAt":"2018-03-23T05:41:05Z","containerID":"docker://1d0e292012f53d437549be80480e994b5b6d6d9f2b0b8370c14ff8dcda243130"}},"lastState":{},"ready":true,"restartCount":0,"image":"openshift/origin-sti-builder:v3.7.1","imageID":"docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc","containerID":"docker://1d0e292012f53d437549be80480e994b5b6d6d9f2b0b8370c14ff8dcda243130"},{"name":"manage-dockerfile","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":"2018-03-23T05:41:07Z","finishedAt":"2018-03-23T05:41:07Z","containerID":"docker://d8f3f75d3e3ec4049627451e0aca78449ed2953261026a28d1644806dadec91d"}},"lastState":{},"ready":true,"restartCount":0,"image":"openshift/origin-sti-builder:v3.7.1","imageID":"docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc","containerID":"docker://d8f3f75d3e3ec4049627451e0aca78449ed2953261026a28d1644806dadec91d"}]
    pod.alpha.kubernetes.io/init-containers: >-
      [{"name":"git-clone","image":"openshift/origin-sti-builder:v3.7.1","command":["openshift-git-clone"],"args":["--loglevel=0"],"env":[{"name":"BUILD","value":"{\"kind\":\"Build\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"mybank-1\",\"namespace\":\"mybank\",\"selfLink\":\"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1\",\"uid\":\"bf9eece7-2e5c-11e8-8e27-eed4a77e066c\",\"resourceVersion\":\"10120\",\"creationTimestamp\":\"2018-03-23T05:40:52Z\",\"labels\":{\"app\":\"mybank\",\"buildconfig\":\"mybank\",\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.start-policy\":\"Serial\"},\"annotations\":{\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.number\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"build.openshift.io/v1\",\"kind\":\"BuildConfig\",\"name\":\"mybank\",\"uid\":\"bf213499-2e5c-11e8-8e27-eed4a77e066c\",\"controller\":true}]},\"spec\":{\"serviceAccount\":\"builder\",\"source\":{\"type\":\"Git\",\"git\":{\"uri\":\"https://github.com/nichochen/mybank-demo-maven\",\"ref\":\"master\"}},\"strategy\":{\"type\":\"Source\",\"sourceStrategy\":{\"from\":{\"kind\":\"DockerImage\",\"name\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\"}}},\"output\":{\"to\":{\"kind\":\"DockerImage\",\"name\":\"172.30.1.1:5000/mybank/mybank:latest\"},\"pushSecret\":{\"name\":\"builder-dockercfg-lpjhm\"}},\"resources\":{},\"postCommit\":{},\"nodeSelector\":null,\"triggeredBy\":[{\"message\":\"Image
      change\",\"imageChangeBuild\":{\"imageID\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\",\"fromRef\":{\"kind\":\"ImageStreamTag\",\"namespace\":\"openshift\",\"name\":\"wildfly:10.1\"}}}]},\"status\":{\"phase\":\"New\",\"outputDockerImageReference\":\"172.30.1.1:5000/mybank/mybank:latest\",\"config\":{\"kind\":\"BuildConfig\",\"namespace\":\"mybank\",\"name\":\"mybank\"},\"output\":{}}}\n"},{"name":"SOURCE_REPOSITORY","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_URI","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_REF","value":"master"},{"name":"ORIGIN_VERSION","value":"v3.7.1+282e43f-42"},{"name":"ALLOWED_UIDS","value":"1-"},{"name":"DROP_CAPS","value":"KILL,MKNOD,SETGID,SETUID"}],"resources":{},"volumeMounts":[{"name":"buildworkdir","mountPath":"/tmp/build"},{"name":"builder-token-rv2v5","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"FallbackToLogsOnError","imagePullPolicy":"IfNotPresent","securityContext":{"privileged":false}},{"name":"manage-dockerfile","image":"openshift/origin-sti-builder:v3.7.1","command":["openshift-manage-dockerfile"],"args":["--loglevel=0"],"env":[{"name":"BUILD","value":"{\"kind\":\"Build\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"mybank-1\",\"namespace\":\"mybank\",\"selfLink\":\"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1\",\"uid\":\"bf9eece7-2e5c-11e8-8e27-eed4a77e066c\",\"resourceVersion\":\"10120\",\"creationTimestamp\":\"2018-03-23T05:40:52Z\",\"labels\":{\"app\":\"mybank\",\"buildconfig\":\"mybank\",\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.start-policy\":\"Serial\"},\"annotations\":{\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.number\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"build.openshift.io/v1\",\"kind\":\"BuildConfig\",\"name\":\"mybank\",\"uid\":\"bf213499-2e5c-11e8-8e27-eed4a77e066c\",\"controller\":true}]},\"spec\":{\"serviceAccount\":\"builder\",\"source\":{\"type\":\"Git\",\"git\":{\"uri\":\"https://github.com/nichochen/mybank-demo-maven\",\"ref\":\"master\"}},\"strategy\":{\"type\":\"Source\",\"sourceStrategy\":{\"from\":{\"kind\":\"DockerImage\",\"name\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\"}}},\"output\":{\"to\":{\"kind\":\"DockerImage\",\"name\":\"172.30.1.1:5000/mybank/mybank:latest\"},\"pushSecret\":{\"name\":\"builder-dockercfg-lpjhm\"}},\"resources\":{},\"postCommit\":{},\"nodeSelector\":null,\"triggeredBy\":[{\"message\":\"Image
      change\",\"imageChangeBuild\":{\"imageID\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\",\"fromRef\":{\"kind\":\"ImageStreamTag\",\"namespace\":\"openshift\",\"name\":\"wildfly:10.1\"}}}]},\"status\":{\"phase\":\"New\",\"outputDockerImageReference\":\"172.30.1.1:5000/mybank/mybank:latest\",\"config\":{\"kind\":\"BuildConfig\",\"namespace\":\"mybank\",\"name\":\"mybank\"},\"output\":{}}}\n"},{"name":"SOURCE_REPOSITORY","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_URI","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_REF","value":"master"},{"name":"ORIGIN_VERSION","value":"v3.7.1+282e43f-42"},{"name":"ALLOWED_UIDS","value":"1-"},{"name":"DROP_CAPS","value":"KILL,MKNOD,SETGID,SETUID"}],"resources":{},"volumeMounts":[{"name":"buildworkdir","mountPath":"/tmp/build"},{"name":"builder-token-rv2v5","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"FallbackToLogsOnError","imagePullPolicy":"IfNotPresent","securityContext":{"privileged":false}}]
    pod.beta.kubernetes.io/init-container-statuses: >-
      [{"name":"git-clone","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":"2018-03-23T05:40:55Z","finishedAt":"2018-03-23T05:41:05Z","containerID":"docker://1d0e292012f53d437549be80480e994b5b6d6d9f2b0b8370c14ff8dcda243130"}},"lastState":{},"ready":true,"restartCount":0,"image":"openshift/origin-sti-builder:v3.7.1","imageID":"docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc","containerID":"docker://1d0e292012f53d437549be80480e994b5b6d6d9f2b0b8370c14ff8dcda243130"},{"name":"manage-dockerfile","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":"2018-03-23T05:41:07Z","finishedAt":"2018-03-23T05:41:07Z","containerID":"docker://d8f3f75d3e3ec4049627451e0aca78449ed2953261026a28d1644806dadec91d"}},"lastState":{},"ready":true,"restartCount":0,"image":"openshift/origin-sti-builder:v3.7.1","imageID":"docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc","containerID":"docker://d8f3f75d3e3ec4049627451e0aca78449ed2953261026a28d1644806dadec91d"}]
    pod.beta.kubernetes.io/init-containers: >-
      [{"name":"git-clone","image":"openshift/origin-sti-builder:v3.7.1","command":["openshift-git-clone"],"args":["--loglevel=0"],"env":[{"name":"BUILD","value":"{\"kind\":\"Build\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"mybank-1\",\"namespace\":\"mybank\",\"selfLink\":\"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1\",\"uid\":\"bf9eece7-2e5c-11e8-8e27-eed4a77e066c\",\"resourceVersion\":\"10120\",\"creationTimestamp\":\"2018-03-23T05:40:52Z\",\"labels\":{\"app\":\"mybank\",\"buildconfig\":\"mybank\",\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.start-policy\":\"Serial\"},\"annotations\":{\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.number\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"build.openshift.io/v1\",\"kind\":\"BuildConfig\",\"name\":\"mybank\",\"uid\":\"bf213499-2e5c-11e8-8e27-eed4a77e066c\",\"controller\":true}]},\"spec\":{\"serviceAccount\":\"builder\",\"source\":{\"type\":\"Git\",\"git\":{\"uri\":\"https://github.com/nichochen/mybank-demo-maven\",\"ref\":\"master\"}},\"strategy\":{\"type\":\"Source\",\"sourceStrategy\":{\"from\":{\"kind\":\"DockerImage\",\"name\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\"}}},\"output\":{\"to\":{\"kind\":\"DockerImage\",\"name\":\"172.30.1.1:5000/mybank/mybank:latest\"},\"pushSecret\":{\"name\":\"builder-dockercfg-lpjhm\"}},\"resources\":{},\"postCommit\":{},\"nodeSelector\":null,\"triggeredBy\":[{\"message\":\"Image
      change\",\"imageChangeBuild\":{\"imageID\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\",\"fromRef\":{\"kind\":\"ImageStreamTag\",\"namespace\":\"openshift\",\"name\":\"wildfly:10.1\"}}}]},\"status\":{\"phase\":\"New\",\"outputDockerImageReference\":\"172.30.1.1:5000/mybank/mybank:latest\",\"config\":{\"kind\":\"BuildConfig\",\"namespace\":\"mybank\",\"name\":\"mybank\"},\"output\":{}}}\n"},{"name":"SOURCE_REPOSITORY","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_URI","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_REF","value":"master"},{"name":"ORIGIN_VERSION","value":"v3.7.1+282e43f-42"},{"name":"ALLOWED_UIDS","value":"1-"},{"name":"DROP_CAPS","value":"KILL,MKNOD,SETGID,SETUID"}],"resources":{},"volumeMounts":[{"name":"buildworkdir","mountPath":"/tmp/build"},{"name":"builder-token-rv2v5","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"FallbackToLogsOnError","imagePullPolicy":"IfNotPresent","securityContext":{"privileged":false}},{"name":"manage-dockerfile","image":"openshift/origin-sti-builder:v3.7.1","command":["openshift-manage-dockerfile"],"args":["--loglevel=0"],"env":[{"name":"BUILD","value":"{\"kind\":\"Build\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"mybank-1\",\"namespace\":\"mybank\",\"selfLink\":\"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1\",\"uid\":\"bf9eece7-2e5c-11e8-8e27-eed4a77e066c\",\"resourceVersion\":\"10120\",\"creationTimestamp\":\"2018-03-23T05:40:52Z\",\"labels\":{\"app\":\"mybank\",\"buildconfig\":\"mybank\",\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.start-policy\":\"Serial\"},\"annotations\":{\"openshift.io/build-config.name\":\"mybank\",\"openshift.io/build.number\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"build.openshift.io/v1\",\"kind\":\"BuildConfig\",\"name\":\"mybank\",\"uid\":\"bf213499-2e5c-11e8-8e27-eed4a77e066c\",\"controller\":true}]},\"spec\":{\"serviceAccount\":\"builder\",\"source\":{\"type\":\"Git\",\"git\":{\"uri\":\"https://github.com/nichochen/mybank-demo-maven\",\"ref\":\"master\"}},\"strategy\":{\"type\":\"Source\",\"sourceStrategy\":{\"from\":{\"kind\":\"DockerImage\",\"name\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\"}}},\"output\":{\"to\":{\"kind\":\"DockerImage\",\"name\":\"172.30.1.1:5000/mybank/mybank:latest\"},\"pushSecret\":{\"name\":\"builder-dockercfg-lpjhm\"}},\"resources\":{},\"postCommit\":{},\"nodeSelector\":null,\"triggeredBy\":[{\"message\":\"Image
      change\",\"imageChangeBuild\":{\"imageID\":\"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280\",\"fromRef\":{\"kind\":\"ImageStreamTag\",\"namespace\":\"openshift\",\"name\":\"wildfly:10.1\"}}}]},\"status\":{\"phase\":\"New\",\"outputDockerImageReference\":\"172.30.1.1:5000/mybank/mybank:latest\",\"config\":{\"kind\":\"BuildConfig\",\"namespace\":\"mybank\",\"name\":\"mybank\"},\"output\":{}}}\n"},{"name":"SOURCE_REPOSITORY","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_URI","value":"https://github.com/nichochen/mybank-demo-maven"},{"name":"SOURCE_REF","value":"master"},{"name":"ORIGIN_VERSION","value":"v3.7.1+282e43f-42"},{"name":"ALLOWED_UIDS","value":"1-"},{"name":"DROP_CAPS","value":"KILL,MKNOD,SETGID,SETUID"}],"resources":{},"volumeMounts":[{"name":"buildworkdir","mountPath":"/tmp/build"},{"name":"builder-token-rv2v5","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"FallbackToLogsOnError","imagePullPolicy":"IfNotPresent","securityContext":{"privileged":false}}]
  creationTimestamp: '2018-03-23T05:40:52Z'
  labels:
    openshift.io/build.name: mybank-1
  name: mybank-1-build
  namespace: mybank
  ownerReferences:
    - apiVersion: build.openshift.io/v1
      controller: true
      kind: Build
      name: mybank-1
      uid: bf9eece7-2e5c-11e8-8e27-eed4a77e066c
  resourceVersion: '10165'
  selfLink: /api/v1/namespaces/mybank/pods/mybank-1-build
  uid: bfacf143-2e5c-11e8-8e27-eed4a77e066c
spec:
  containers:
    - args:
        - '--loglevel=0'
      command:
        - openshift-sti-build
      env:
        - name: BUILD
          value: >
            {"kind":"Build","apiVersion":"v1","metadata":{"name":"mybank-1","namespace":"mybank","selfLink":"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1","uid":"bf9eece7-2e5c-11e8-8e27-eed4a77e066c","resourceVersion":"10120","creationTimestamp":"2018-03-23T05:40:52Z","labels":{"app":"mybank","buildconfig":"mybank","openshift.io/build-config.name":"mybank","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"mybank","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"mybank","uid":"bf213499-2e5c-11e8-8e27-eed4a77e066c","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/nichochen/mybank-demo-maven","ref":"master"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280"}}},"output":{"to":{"kind":"DockerImage","name":"172.30.1.1:5000/mybank/mybank:latest"},"pushSecret":{"name":"builder-dockercfg-lpjhm"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Image
            change","imageChangeBuild":{"imageID":"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"wildfly:10.1"}}}]},"status":{"phase":"New","outputDockerImageReference":"172.30.1.1:5000/mybank/mybank:latest","config":{"kind":"BuildConfig","namespace":"mybank","name":"mybank"},"output":{}}}
        - name: SOURCE_REPOSITORY
          value: 'https://github.com/nichochen/mybank-demo-maven'
        - name: SOURCE_URI
          value: 'https://github.com/nichochen/mybank-demo-maven'
        - name: SOURCE_REF
          value: master
        - name: ORIGIN_VERSION
          value: v3.7.1+282e43f-42
        - name: ALLOWED_UIDS
          value: 1-
        - name: DROP_CAPS
          value: 'KILL,MKNOD,SETGID,SETUID'
        - name: PUSH_DOCKERCFG_PATH
          value: /var/run/secrets/openshift.io/push
      image: 'openshift/origin-sti-builder:v3.7.1'
      imagePullPolicy: IfNotPresent
      name: sti-build
      resources: {}
      securityContext:
        privileged: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: FallbackToLogsOnError
      volumeMounts:
        - mountPath: /tmp/build
          name: buildworkdir
        - mountPath: /var/run/docker.sock
          name: docker-socket
        - mountPath: /var/run/crio.sock
          name: crio-socket
        - mountPath: /var/run/secrets/openshift.io/push
          name: builder-dockercfg-lpjhm-push
          readOnly: true
        - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
          name: builder-token-rv2v5
          readOnly: true
  dnsPolicy: ClusterFirst
  imagePullSecrets:
    - name: builder-dockercfg-lpjhm
  initContainers:
    - args:
        - '--loglevel=0'
      command:
        - openshift-git-clone
      env:
        - name: BUILD
          value: >
            {"kind":"Build","apiVersion":"v1","metadata":{"name":"mybank-1","namespace":"mybank","selfLink":"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1","uid":"bf9eece7-2e5c-11e8-8e27-eed4a77e066c","resourceVersion":"10120","creationTimestamp":"2018-03-23T05:40:52Z","labels":{"app":"mybank","buildconfig":"mybank","openshift.io/build-config.name":"mybank","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"mybank","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"mybank","uid":"bf213499-2e5c-11e8-8e27-eed4a77e066c","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/nichochen/mybank-demo-maven","ref":"master"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280"}}},"output":{"to":{"kind":"DockerImage","name":"172.30.1.1:5000/mybank/mybank:latest"},"pushSecret":{"name":"builder-dockercfg-lpjhm"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Image
            change","imageChangeBuild":{"imageID":"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"wildfly:10.1"}}}]},"status":{"phase":"New","outputDockerImageReference":"172.30.1.1:5000/mybank/mybank:latest","config":{"kind":"BuildConfig","namespace":"mybank","name":"mybank"},"output":{}}}
        - name: SOURCE_REPOSITORY
          value: 'https://github.com/nichochen/mybank-demo-maven'
        - name: SOURCE_URI
          value: 'https://github.com/nichochen/mybank-demo-maven'
        - name: SOURCE_REF
          value: master
        - name: ORIGIN_VERSION
          value: v3.7.1+282e43f-42
        - name: ALLOWED_UIDS
          value: 1-
        - name: DROP_CAPS
          value: 'KILL,MKNOD,SETGID,SETUID'
      image: 'openshift/origin-sti-builder:v3.7.1'
      imagePullPolicy: IfNotPresent
      name: git-clone
      resources: {}
      securityContext:
        privileged: false
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: FallbackToLogsOnError
      volumeMounts:
        - mountPath: /tmp/build
          name: buildworkdir
        - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
          name: builder-token-rv2v5
          readOnly: true
    - args:
        - '--loglevel=0'
      command:
        - openshift-manage-dockerfile
      env:
        - name: BUILD
          value: >
            {"kind":"Build","apiVersion":"v1","metadata":{"name":"mybank-1","namespace":"mybank","selfLink":"/apis/build.openshift.io/v1/namespaces/mybank/builds/mybank-1","uid":"bf9eece7-2e5c-11e8-8e27-eed4a77e066c","resourceVersion":"10120","creationTimestamp":"2018-03-23T05:40:52Z","labels":{"app":"mybank","buildconfig":"mybank","openshift.io/build-config.name":"mybank","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"mybank","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"mybank","uid":"bf213499-2e5c-11e8-8e27-eed4a77e066c","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/nichochen/mybank-demo-maven","ref":"master"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280"}}},"output":{"to":{"kind":"DockerImage","name":"172.30.1.1:5000/mybank/mybank:latest"},"pushSecret":{"name":"builder-dockercfg-lpjhm"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Image
            change","imageChangeBuild":{"imageID":"openshift/wildfly-101-centos7@sha256:a2661f20f2e870520a73765f783de105c61916235a541332acd1501c2ee76280","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"wildfly:10.1"}}}]},"status":{"phase":"New","outputDockerImageReference":"172.30.1.1:5000/mybank/mybank:latest","config":{"kind":"BuildConfig","namespace":"mybank","name":"mybank"},"output":{}}}
        - name: SOURCE_REPOSITORY
          value: 'https://github.com/nichochen/mybank-demo-maven'
        - name: SOURCE_URI
          value: 'https://github.com/nichochen/mybank-demo-maven'
        - name: SOURCE_REF
          value: master
        - name: ORIGIN_VERSION
          value: v3.7.1+282e43f-42
        - name: ALLOWED_UIDS
          value: 1-
        - name: DROP_CAPS
          value: 'KILL,MKNOD,SETGID,SETUID'
      image: 'openshift/origin-sti-builder:v3.7.1'
      imagePullPolicy: IfNotPresent
      name: manage-dockerfile
      resources: {}
      securityContext:
        privileged: false
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: FallbackToLogsOnError
      volumeMounts:
        - mountPath: /tmp/build
          name: buildworkdir
        - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
          name: builder-token-rv2v5
          readOnly: true
  nodeName: localhost
  restartPolicy: Never
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: builder
  serviceAccountName: builder
  terminationGracePeriodSeconds: 30
  volumes:
    - emptyDir: {}
      name: buildworkdir
    - hostPath:
        path: /var/run/docker.sock
      name: docker-socket
    - hostPath:
        path: /var/run/crio.sock
      name: crio-socket
    - name: builder-dockercfg-lpjhm-push
      secret:
        defaultMode: 384
        secretName: builder-dockercfg-lpjhm
    - name: builder-token-rv2v5
      secret:
        defaultMode: 420
        secretName: builder-token-rv2v5
status:
  conditions:
    - lastProbeTime: null
      lastTransitionTime: '2018-03-23T05:41:08Z'
      status: 'True'
      type: Initialized
    - lastProbeTime: null
      lastTransitionTime: '2018-03-23T05:41:09Z'
      status: 'True'
      type: Ready
    - lastProbeTime: null
      lastTransitionTime: '2018-03-23T05:40:52Z'
      status: 'True'
      type: PodScheduled
  containerStatuses:
    - containerID: >-
        docker://dbaa8cb33718e23215e0329eb23fc145ff5ffd83ca7e9c0f4597c11aca34f04e
      image: 'openshift/origin-sti-builder:v3.7.1'
      imageID: >-
        docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc
      lastState: {}
      name: sti-build
      ready: true
      restartCount: 0
      state:
        running:
          startedAt: '2018-03-23T05:41:09Z'
  hostIP: 192.168.122.225
  initContainerStatuses:
    - containerID: >-
        docker://1d0e292012f53d437549be80480e994b5b6d6d9f2b0b8370c14ff8dcda243130
      image: 'openshift/origin-sti-builder:v3.7.1'
      imageID: >-
        docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc
      lastState: {}
      name: git-clone
      ready: true
      restartCount: 0
      state:
        terminated:
          containerID: >-
            docker://1d0e292012f53d437549be80480e994b5b6d6d9f2b0b8370c14ff8dcda243130
          exitCode: 0
          finishedAt: '2018-03-23T05:41:05Z'
          reason: Completed
          startedAt: '2018-03-23T05:40:55Z'
    - containerID: >-
        docker://d8f3f75d3e3ec4049627451e0aca78449ed2953261026a28d1644806dadec91d
      image: 'openshift/origin-sti-builder:v3.7.1'
      imageID: >-
        docker-pullable://openshift/origin-sti-builder@sha256:46dd04503c7f1bf2d07bd962925c437e45d3dc4964aa81647a386030df5d4cbc
      lastState: {}
      name: manage-dockerfile
      ready: true
      restartCount: 0
      state:
        terminated:
          containerID: >-
            docker://d8f3f75d3e3ec4049627451e0aca78449ed2953261026a28d1644806dadec91d
          exitCode: 0
          finishedAt: '2018-03-23T05:41:07Z'
          reason: Completed
          startedAt: '2018-03-23T05:41:07Z'
  phase: Running
  podIP: 172.17.0.2
  qosClass: BestEffort
  startTime: '2018-03-23T05:40:52Z'

个人公众号二维码:
OpenShift从源码构建部署应用初体验_第21张图片

你可能感兴趣的:(Container,DevOps)