From a66d8bfc31b9f288aaeea54b6097428ea9aa5a05 Mon Sep 17 00:00:00 2001 From: Petter Abrahamsson Date: Wed, 6 Dec 2017 07:51:38 -0500 Subject: [PATCH 1/3] Add support for OpenShift applier --- basic-tomcat/README.md | 76 +++--------- basic-tomcat/build/dev/params | 3 - basic-tomcat/deploy/dev/params | 3 - basic-tomcat/deploy/prod/params | 3 - basic-tomcat/deploy/stage/params | 4 - basic-tomcat/files/builds/params | 3 + .../builds/template.yml} | 11 +- basic-tomcat/files/deployment/build/params | 1 + basic-tomcat/files/deployment/dev/params | 2 + basic-tomcat/files/deployment/prod/params | 2 + basic-tomcat/files/deployment/stage/params | 2 + .../deployment/template.yml} | 111 ++++++++++-------- .../files/imagestreams/imagestreams.yml | 32 +++++ .../files/imagestreams/openshift/params | 3 + .../{ => files}/projects/projects.yml | 6 + basic-tomcat/inventory/group_vars/all.yml | 31 +++++ basic-tomcat/inventory/hosts | 2 + blue-green-spring/README.md | 89 ++++---------- blue-green-spring/build/dev/params | 3 - blue-green-spring/deploy/dev/params | 3 - blue-green-spring/deploy/prod/params | 4 - blue-green-spring/deploy/stage/params | 4 - blue-green-spring/files/builds/params | 5 + .../builds/template.yml} | 7 ++ .../files/deployment/build/params | 1 + blue-green-spring/files/deployment/dev/params | 2 + .../files/deployment/prod/params | 2 + .../files/deployment/stage/params | 2 + .../deployment/template-bg.yml} | 1 + .../deployment/template.yml} | 1 + .../files/imagestreams/imagestreams.yml | 32 +++++ .../files/imagestreams/openshift/params | 3 + .../{ => files}/projects/projects.yml | 12 +- .../inventory/group_vars/all.yml | 31 +++++ blue-green-spring/inventory/hosts | 2 + 35 files changed, 297 insertions(+), 202 deletions(-) delete mode 100644 basic-tomcat/build/dev/params delete mode 100644 basic-tomcat/deploy/dev/params delete mode 100644 basic-tomcat/deploy/prod/params delete mode 100644 basic-tomcat/deploy/stage/params create mode 100644 basic-tomcat/files/builds/params rename basic-tomcat/{build/basic-java-template.yml => files/builds/template.yml} (91%) create mode 100644 basic-tomcat/files/deployment/build/params create mode 100644 basic-tomcat/files/deployment/dev/params create mode 100644 basic-tomcat/files/deployment/prod/params create mode 100644 basic-tomcat/files/deployment/stage/params rename basic-tomcat/{deploy/basic-tomcat-template.yml => files/deployment/template.yml} (76%) create mode 100644 basic-tomcat/files/imagestreams/imagestreams.yml create mode 100644 basic-tomcat/files/imagestreams/openshift/params rename basic-tomcat/{ => files}/projects/projects.yml (77%) create mode 100644 basic-tomcat/inventory/group_vars/all.yml create mode 100644 basic-tomcat/inventory/hosts delete mode 100644 blue-green-spring/build/dev/params delete mode 100644 blue-green-spring/deploy/dev/params delete mode 100644 blue-green-spring/deploy/prod/params delete mode 100644 blue-green-spring/deploy/stage/params create mode 100644 blue-green-spring/files/builds/params rename blue-green-spring/{build/basic-java-template.yml => files/builds/template.yml} (94%) create mode 100644 blue-green-spring/files/deployment/build/params create mode 100644 blue-green-spring/files/deployment/dev/params create mode 100644 blue-green-spring/files/deployment/prod/params create mode 100644 blue-green-spring/files/deployment/stage/params rename blue-green-spring/{deploy/simple-spring-boot-template-prod.yml => files/deployment/template-bg.yml} (99%) rename blue-green-spring/{deploy/simple-spring-boot-template.yml => files/deployment/template.yml} (99%) create mode 100644 blue-green-spring/files/imagestreams/imagestreams.yml create mode 100644 blue-green-spring/files/imagestreams/openshift/params rename blue-green-spring/{ => files}/projects/projects.yml (64%) create mode 100644 blue-green-spring/inventory/group_vars/all.yml create mode 100644 blue-green-spring/inventory/hosts diff --git a/basic-tomcat/README.md b/basic-tomcat/README.md index 2869cf85..2911ab82 100644 --- a/basic-tomcat/README.md +++ b/basic-tomcat/README.md @@ -10,17 +10,20 @@ This example demonstrates how to implement a full end-to-end Jenkins Pipeline fo ## Quickstart +### Requirements +1. [OpenShift Applier](https://github.com/redhat-cop/casl-ansible) + `git clone git@github.com:redhat-cop/casl-ansible.git` + `git checkout v3.6.1` +2. [Ansible](https://www.ansible.com/) + `sudo dnf install ansible` + +### Installation Run the following commands to instantiate this example. - ``` -cd ./basic-tomcat -oc create -f projects/projects.yml -oc process openshift//jenkins-ephemeral | oc apply -f- -n basic-tomcat-dev -oc process -f deploy/basic-tomcat-template.yml --param-file=deploy/dev/params | oc apply -f- -oc process -f deploy/basic-tomcat-template.yml --param-file=deploy/stage/params | oc apply -f- -oc process -f deploy/basic-tomcat-template.yml --param-file=deploy/prod/params | oc apply -f- -oc process -f build/basic-java-template.yml --param-file build/dev/params | oc apply -f- +ansible-playbook -i inventory/hosts ../casl-ansible/playbooks/openshift-cluster-seed.yml --connection=local ``` +The above command will create all the necessary projects and OpenShift objects as well as a Jenkins instance that will build, promote and deploy the application. +Run the following commands to instantiate this example. ## Architecture @@ -28,7 +31,7 @@ oc process -f build/basic-java-template.yml --param-file build/dev/params | oc a The components of this pipeline are divided into two templates. -The first template, `build/basic-tomcat-template.yml` is what we are calling the "Build" template. It contains: +The first template, `files/builds/template.yml` is what we are calling the "Build" template. It contains: * A `jenkinsPipelineStrategy` BuildConfig * An `s2i` BuildConfig @@ -36,7 +39,7 @@ The first template, `build/basic-tomcat-template.yml` is what we are calling the The build template contains a default source code repo for a java application compatible with this pipelines architecture (https://github.com/etsauer/ticket-monster). -The second template, `deploy/basic-tomcat-template.yml` is the "Deploy" template. It contains: +The second template, `files/deployment/template.yml` is the "Deploy" template. It contains: * A tomcat8 DeploymentConfig * A Service definition @@ -68,32 +71,16 @@ https://github.com/etsauer/ticket-monster For the purposes of this demo, we are going to create three stages for our application to be promoted through. +- `build` - `basic-tomcat-dev` - `basic-tomcat-stage` - `basic-tomcat-prod` In the spirit of _Infrastructure as Code_ we have a YAML file that defines the `ProjectRequests` for us. This is as an alternative to running `oc new-project`, but will yeild the same result. -``` -$ oc create -f projects/projects.yml -projectrequest "basic-tomcat-dev" created -projectrequest "basic-tomcat-stage" created -projectrequest "basic-tomcat-prod" created -``` +### 2. Stand up Jenkins master in build -### 2. Stand up Jenkins master in dev - -For this step, the OpenShift default template set provides exactly what we need to get jenkins up and running. - -``` -$ oc process openshift//jenkins-ephemeral | oc apply -f- -n basic-tomcat-dev -route "jenkins" created -deploymentconfig "jenkins" created -serviceaccount "jenkins" created -rolebinding "jenkins_edit" created -service "jenkins-jnlp" created -service "jenkins" created -``` +For this step, the OpenShift default template set provides exactly what we need to get jenkins up and running. Jenkins will be running in the `build` project and promote and deploy to the `basic-tomcat-dev` project. ### 4. Instantiate Pipeline @@ -107,40 +94,11 @@ A _deploy template_ is provided at `deploy/basic-tomcat-template.yml` that defin This template should be instantiated once in each of the namespaces that our app will be deployed to. For this purpose, we have created a param file to be fed to `oc process` to customize the template for each environment. -Deploy the deployment template to all three projects. -``` -$ oc process -f deploy/basic-tomcat-template.yml --param-file=deploy/dev/params | oc apply -f- -service "basic-tomcat" created -route "basic-tomcat" created -imagestream "basic-tomcat" created -deploymentconfig "basic-tomcat" created -rolebinding "jenkins_edit" configured -$ oc process -f deploy/basic-tomcat-template.yml --param-file=deploy/stage/params | oc apply -f- -service "basic-tomcat" created -route "basic-tomcat" created -imagestream "basic-tomcat" created -deploymentconfig "basic-tomcat" created -rolebinding "jenkins_edit" created -$ oc process -f deploy/basic-tomcat-template.yml --param-file=deploy/prod/params | oc apply -f- -service "basic-tomcat" created -route "basic-tomcat" created -imagestream "basic-tomcat" created -deploymentconfig "basic-tomcat" created -rolebinding "jenkins_edit" created -``` - -A _build template_ is provided at `build/basic-java-template.yml` that defines all the resources required to build our java app. It includes: +A _build template_ is provided at `files/builds/template.yml` that defines all the resources required to build our java app. It includes: * A `BuildConfig` that defines a `JenkinsPipelineStrategy` build, which will be used to define out pipeline. * A `BuildConfig` that defines a `Source` build with `Binary` input. This will build our image. -Deploy the pipeline template in dev only. -``` -$ oc process -f build/basic-java-template.yml --param-file build/dev/params | oc apply -f- -buildconfig "basic-tomcat-pipeline" created -buildconfig "basic-tomcat" created -``` - At this point you should be able to go to the Web Console and follow the pipeline by clicking in your `myapp-dev` project, and going to *Builds* -> *Pipelines*. At several points you will be prompted for input on the pipeline. You can interact with it by clicking on the _input required_ link, which takes you to Jenkins, where you can click the *Proceed* button. By the time you get through the end of the pipeline you should be able to visit the Route for your app deployed to the `myapp-prod` project to confirm that your image has been promoted through all stages. ## Cleanup diff --git a/basic-tomcat/build/dev/params b/basic-tomcat/build/dev/params deleted file mode 100644 index 58797b91..00000000 --- a/basic-tomcat/build/dev/params +++ /dev/null @@ -1,3 +0,0 @@ -APPLICATION_NAME=basic-tomcat -NAMESPACE=basic-tomcat-dev -IMAGE_STREAM_TAG_NAME=jboss-webserver31-tomcat8-openshift:1.0 diff --git a/basic-tomcat/deploy/dev/params b/basic-tomcat/deploy/dev/params deleted file mode 100644 index 691e53ec..00000000 --- a/basic-tomcat/deploy/dev/params +++ /dev/null @@ -1,3 +0,0 @@ -APPLICATION_NAME=basic-tomcat -NAMESPACE=basic-tomcat-dev -SA_NAMESPACE=basic-tomcat-dev diff --git a/basic-tomcat/deploy/prod/params b/basic-tomcat/deploy/prod/params deleted file mode 100644 index 3c59f844..00000000 --- a/basic-tomcat/deploy/prod/params +++ /dev/null @@ -1,3 +0,0 @@ -APPLICATION_NAME=basic-tomcat -NAMESPACE=basic-tomcat-prod -SA_NAMESPACE=basic-tomcat-dev diff --git a/basic-tomcat/deploy/stage/params b/basic-tomcat/deploy/stage/params deleted file mode 100644 index 154e09ac..00000000 --- a/basic-tomcat/deploy/stage/params +++ /dev/null @@ -1,4 +0,0 @@ -APPLICATION_NAME=basic-tomcat -NAMESPACE=basic-tomcat-stage -SA_NAME=jenkins -SA_NAMESPACE=basic-tomcat-dev diff --git a/basic-tomcat/files/builds/params b/basic-tomcat/files/builds/params new file mode 100644 index 00000000..7f29d6e4 --- /dev/null +++ b/basic-tomcat/files/builds/params @@ -0,0 +1,3 @@ +NAMESPACE=build +SOURCE_REPOSITORY_URL=https://github.com/pabrahamsson/ticket-monster.git +SOURCE_REPOSITORY_REF=build diff --git a/basic-tomcat/build/basic-java-template.yml b/basic-tomcat/files/builds/template.yml similarity index 91% rename from basic-tomcat/build/basic-java-template.yml rename to basic-tomcat/files/builds/template.yml index 7ee79284..e0d086b7 100644 --- a/basic-tomcat/build/basic-java-template.yml +++ b/basic-tomcat/files/builds/template.yml @@ -44,6 +44,7 @@ objects: name: ${APPLICATION_NAME} namespace: "${NAMESPACE}" spec: + failedBuildHistoryLimit: 3 output: to: kind: ImageStreamTag @@ -58,6 +59,14 @@ objects: name: ${IMAGE_STREAM_TAG_NAME} namespace: ${IMAGE_STREAM_NAMESPACE} type: Source + successfulBuildHistoryLimit: 3 +- apiVersion: v1 + kind: ImageStream + metadata: + labels: + application: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + namespace: ${NAMESPACE} parameters: - description: The name for the application. name: APPLICATION_NAME @@ -99,4 +108,4 @@ parameters: - description: Image stream tag for the image you'd like to use to build the application name: IMAGE_STREAM_TAG_NAME required: true - value: jboss-webserver30-tomcat8-openshift:1.2 + value: jboss-webserver31-tomcat8-openshift:1.0 diff --git a/basic-tomcat/files/deployment/build/params b/basic-tomcat/files/deployment/build/params new file mode 100644 index 00000000..c9140ccf --- /dev/null +++ b/basic-tomcat/files/deployment/build/params @@ -0,0 +1 @@ +MEMORY_LIMIT=512Mi diff --git a/basic-tomcat/files/deployment/dev/params b/basic-tomcat/files/deployment/dev/params new file mode 100644 index 00000000..401a2810 --- /dev/null +++ b/basic-tomcat/files/deployment/dev/params @@ -0,0 +1,2 @@ +APPLICATION_NAME=basic-tomcat +ENV=-dev diff --git a/basic-tomcat/files/deployment/prod/params b/basic-tomcat/files/deployment/prod/params new file mode 100644 index 00000000..818be586 --- /dev/null +++ b/basic-tomcat/files/deployment/prod/params @@ -0,0 +1,2 @@ +APPLICATION_NAME=basic-tomcat +ENV=-prod diff --git a/basic-tomcat/files/deployment/stage/params b/basic-tomcat/files/deployment/stage/params new file mode 100644 index 00000000..1f5469cc --- /dev/null +++ b/basic-tomcat/files/deployment/stage/params @@ -0,0 +1,2 @@ +APPLICATION_NAME=basic-tomcat +ENV=-stage diff --git a/basic-tomcat/deploy/basic-tomcat-template.yml b/basic-tomcat/files/deployment/template.yml similarity index 76% rename from basic-tomcat/deploy/basic-tomcat-template.yml rename to basic-tomcat/files/deployment/template.yml index a50771f2..f5fa035d 100644 --- a/basic-tomcat/deploy/basic-tomcat-template.yml +++ b/basic-tomcat/files/deployment/template.yml @@ -1,58 +1,19 @@ apiVersion: v1 kind: Template labels: - template: jws30-tomcat8-deployment + template: deployment-template metadata: annotations: - description: Application template for JWS applications built using a Jenkins Pipeline - iconClass: icon-tomcat - tags: tomcat,tomcat8,java,jboss,xpaas - version: 1.2.0 - name: jws30-tomcat8-deployment + description: Application template for applications built using a Jenkins Pipeline + name: deployment-template objects: -- apiVersion: v1 - kind: Service - metadata: - annotations: - description: The web server's http port. - labels: - application: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - namespace: ${NAMESPACE} - spec: - ports: - - port: 8080 - targetPort: 8080 - selector: - deploymentConfig: ${APPLICATION_NAME} -- apiVersion: v1 - id: ${APPLICATION_NAME}-http - kind: Route - metadata: - annotations: - description: Route for application's http service. - labels: - application: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - namespace: ${NAMESPACE} - spec: - host: ${HOSTNAME_HTTP} - to: - name: ${APPLICATION_NAME} -- apiVersion: v1 - kind: ImageStream - metadata: - labels: - application: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - namespace: ${NAMESPACE} - apiVersion: v1 kind: DeploymentConfig metadata: labels: application: ${APPLICATION_NAME} name: ${APPLICATION_NAME} - namespace: ${NAMESPACE} + namespace: ${APPLICATION_NAME}${ENV} spec: replicas: 1 selector: @@ -100,6 +61,63 @@ objects: name: ${APPLICATION_NAME}:latest type: ImageChange - type: ConfigChange +- apiVersion: v1 + kind: ImageStream + metadata: + labels: + application: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + namespace: ${APPLICATION_NAME}${ENV} +- apiVersion: v1 + id: ${APPLICATION_NAME}-http + kind: Route + metadata: + annotations: + description: Route for application's service. + labels: + application: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + namespace: ${APPLICATION_NAME}${ENV} + spec: + host: ${HOSTNAME_HTTP} + to: + name: ${APPLICATION_NAME} +- apiVersion: v1 + kind: Service + metadata: + annotations: + description: Service for application. + labels: + application: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + namespace: ${APPLICATION_NAME}${ENV} + spec: + ports: + - name: 8080-tcp + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + application: ${APPLICATION_NAME} + deploymentConfig: ${APPLICATION_NAME} +- apiVersion: v1 + kind: Service + metadata: + annotations: + description: Service for application. + labels: + application: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + namespace: ${APPLICATION_NAME}${ENV} + spec: + ports: + - name: 8080-tcp + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + application: ${APPLICATION_NAME} + deploymentConfig: ${APPLICATION_NAME} - apiVersion: v1 groupNames: null kind: RoleBinding @@ -108,7 +126,7 @@ objects: labels: template: basic-tomcat-template name: jenkins_edit - namespace: ${NAMESPACE} + namespace: ${APPLICATION_NAME}${ENV} roleRef: name: edit subjects: @@ -122,8 +140,8 @@ parameters: name: APPLICATION_NAME required: true value: jws-app -- description: The namespace to deploy into - name: NAMESPACE +- description: The environment + name: ENV required: true - description: Name of a service account that can deploy to this project name: SA_NAME @@ -132,6 +150,7 @@ parameters: - description: Namespace of service account that can deploy to this project name: SA_NAMESPACE required: true + value: build - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' name: HOSTNAME_HTTP diff --git a/basic-tomcat/files/imagestreams/imagestreams.yml b/basic-tomcat/files/imagestreams/imagestreams.yml new file mode 100644 index 00000000..ace835ad --- /dev/null +++ b/basic-tomcat/files/imagestreams/imagestreams.yml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Template +metadata: + annotations: + description: ImageStream template +objects: + - apiVersion: v1 + kind: ImageStream + metadata: + name: jboss-webserver31-tomcat8-openshift + namespace: "${NAMESPACE}" + spec: + lookupPolicy: + local: false + tags: + - from: + kind: DockerImage + name: "${IMAGE}" + name: "${TAG}" + referencePolicy: + type: Source +parameters: +- description: Image name to use for the ImageStream + name: IMAGE + required: true +- description: The namespace where to create the ImageStream + name: NAMESPACE + required: true +- description: Image tag to sync + name: TAG + required: true + value: latest diff --git a/basic-tomcat/files/imagestreams/openshift/params b/basic-tomcat/files/imagestreams/openshift/params new file mode 100644 index 00000000..f3cd3f78 --- /dev/null +++ b/basic-tomcat/files/imagestreams/openshift/params @@ -0,0 +1,3 @@ +IMAGE=registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift +NAMESPACE=openshift +TAG=1.0 diff --git a/basic-tomcat/projects/projects.yml b/basic-tomcat/files/projects/projects.yml similarity index 77% rename from basic-tomcat/projects/projects.yml rename to basic-tomcat/files/projects/projects.yml index 5dc18580..efba0a1e 100644 --- a/basic-tomcat/projects/projects.yml +++ b/basic-tomcat/files/projects/projects.yml @@ -19,3 +19,9 @@ items: name: basic-tomcat-prod creationTimestam: null displayName: Prod - Basic Tomcat App +- kind: ProjectRequest + apiVersion: v1 + metadata: + name: build + creationTimestam: null + displayName: Build - Jenkins is here diff --git a/basic-tomcat/inventory/group_vars/all.yml b/basic-tomcat/inventory/group_vars/all.yml new file mode 100644 index 00000000..dfba37c5 --- /dev/null +++ b/basic-tomcat/inventory/group_vars/all.yml @@ -0,0 +1,31 @@ +--- +openshift_cluster_content: +- object: projectrequest + content: + - name: basic-tomcat-spaces + file: "{{ inventory_dir }}/../files/projects/projects.yml" +- object: imagestreams + content: + - name: jboss-webserver31-tomcat8-openshift + template: "{{ inventory_dir }}/../files/imagestreams/imagestreams.yml" + params: "{{ inventory_dir }}/../files/imagestreams/openshift/params" +- object: deployments + content: + - name: jenkins + namespace: build + template: openshift//jenkins-ephemeral + params: "{{ inventory_dir }}/../files/deployment/build/params" + - name: basic-tomcat-dev + template: "{{ inventory_dir }}/../files/deployment/template.yml" + params: "{{ inventory_dir }}/../files/deployment/dev/params" + - name: basic-tomcat-stage + template: "{{ inventory_dir }}/../files/deployment/template.yml" + params: "{{ inventory_dir }}/../files/deployment/stage/params" + - name: basic-tomcat-prod + template: "{{ inventory_dir }}/../files/deployment/template.yml" + params: "{{ inventory_dir }}/../files/deployment/prod/params" +- object: builds + content: + - name: jenkins + template: "{{ inventory_dir }}/../files/builds/template.yml" + params: "{{ inventory_dir }}/../files/builds/params" diff --git a/basic-tomcat/inventory/hosts b/basic-tomcat/inventory/hosts new file mode 100644 index 00000000..05c07035 --- /dev/null +++ b/basic-tomcat/inventory/hosts @@ -0,0 +1,2 @@ +[seed-hosts] +localhost diff --git a/blue-green-spring/README.md b/blue-green-spring/README.md index 2c4258e5..171a7c7d 100644 --- a/blue-green-spring/README.md +++ b/blue-green-spring/README.md @@ -14,17 +14,19 @@ This sample demonstrates the following capabilities: ## Quickstart +### Requirements +1. [OpenShift Applier](https://github.com/redhat-cop/casl-ansible) + `git clone git@github.com:redhat-cop/casl-ansible.git` + `git checkout v3.6.1` +2. [Ansible](https://www.ansible.com/) + `sudo dnf install ansible` + +### Installation Run the following commands to instantiate this example. - ``` -cd ./blue-green-spring -oc create -f projects/projects.yml -oc process openshift//jenkins-ephemeral | oc apply -f- -n simple-spring-boot-dev -oc process -f deploy/simple-spring-boot-template.yml --param-file=deploy/dev/params | oc apply -f- -oc process -f deploy/simple-spring-boot-template.yml --param-file=deploy/stage/params | oc apply -f- -oc process -f deploy/simple-spring-boot-template-prod.yml --param-file=deploy/prod/params | oc apply -f- -oc process -f build/basic-java-template.yml --param-file build/dev/params | oc apply -f- +ansible-playbook -i inventory/hosts ../casl-ansible/playbooks/openshift-cluster-seed.yml --connection=local ``` +The above command will create all the necessary projects and OpenShift objects as well as a Jenkins instance that will build, promote and deploy the application. ## Architecture @@ -32,7 +34,7 @@ oc process -f build/basic-java-template.yml --param-file build/dev/params | oc a The components of this pipeline are divided into three templates. -The first template, `build/simple-spring-boot-template.yml` is what we are calling the "Build" template. It contains: +The first template, `files/builds/template.yml` is what we are calling the "Build" template. It contains: * A `jenkinsPipelineStrategy` BuildConfig * An `s2i` BuildConfig @@ -40,13 +42,13 @@ The first template, `build/simple-spring-boot-template.yml` is what we are calli The build template contains a default source code repo for a java application compatible with this pipelines architecture (https://github.com/malacourse/simple-spring-boot-web). -The second template, `deploy/simple-spring-boot-template.yml` is the "Deploy" template. It contains: +The second template, `files/deployment/template.yml` is the "Deploy" template. It contains: * A openjdk8 DeploymentConfig * A Service definition * A Route -The third template, `deploy/simple-spring-boot-template-prod.yml` is the "Deploy" template for a blue/green project. It contains: +The third template, `files/deployment/template-bg.yml` is the "Deploy" template for a blue/green project. It contains: * Two openjdk8 DeploymentConfig's * Two Service definition's @@ -76,38 +78,22 @@ https://github.com/malacourse/simple-spring-boot-web ### 1. Create Lifecycle Stages -For the purposes of this demo, we are going to create three stages for our application to be promoted through. +For the purposes of this demo, we are going to create four stages for our application to be promoted through. -- `simple-spring-boot-dev` -- `simple-spring-boot-stage` -- `simple-spring-boot-prod` +- 'build' +- `spring-boot-web-dev` +- `spring-boot-web-stage` +- `spring-boot-web-prod` In the spirit of _Infrastructure as Code_ we have a YAML file that defines the `ProjectRequests` for us. This is as an alternative to running `oc new-project`, but will yeild the same result. -``` -$ oc create -f projects/projects.yml -projectrequest "simple-spring-boot-dev" created -projectrequest "simple-spring-boot-stage" created -projectrequest "simple-spring-boot-prod" created -``` - -### 2. Stand up Jenkins master in dev +### 2. Stand up Jenkins master in build -For this step, the OpenShift default template set provides exactly what we need to get jenkins up and running. - -``` -$ oc process openshift//jenkins-ephemeral | oc apply -f- -n simple-spring-boot-dev -route "jenkins" created -deploymentconfig "jenkins" created -serviceaccount "jenkins" created -rolebinding "jenkins_edit" created -service "jenkins-jnlp" created -service "jenkins" created -``` +For this step, the OpenShift default template set provides exactly what we need to get jenkins up and running. Jenkins will be running in the `build` project and promote and deploy to the `spring-boot-web-dev` project. ### 4. Instantiate Pipeline -A _deploy template_ is provided at `deploy/simple-spring-boot-template.yml` that defines all of the resources required to run the openjdk8 application. It includes: +A _deploy template_ is provided at `files/deployment/template.yml` that defines all of the resources required to run the openjdk8 application. It includes: * A `Service` * A `Route` @@ -127,40 +113,11 @@ A production blue/green_deploy template_ is provided at `deploy/simple-spring-bo This template should be instantiated in the production blue/green namespace that our app will be deployed to. For this purpose, we have created a param file to be fed to `oc process` to customize the template for each environment. -Deploy the deployment template to all three projects. -``` -$ oc process -f deploy/simple-spring-boot-template.yml --param-file=deploy/dev/params | oc apply -f- -service "simple-spring-boot" created -route "simple-spring-boot" created -imagestream "simple-spring-boot" created -deploymentconfig "simple-spring-boot" created -rolebinding "jenkins_edit" configured -$ oc process -f deploy/simple-spring-boot-template.yml --param-file=deploy/stage/params | oc apply -f- -service "simple-spring-boot" created -route "simple-spring-boot" created -imagestream "simple-spring-boot" created -deploymentconfig "simple-spring-boot" created -rolebinding "jenkins_edit" created -$ oc process -f deploy/simple-spring-boot-template-prod.yml --param-file=deploy/prod/params | oc apply -f- -service "simple-spring-boot" created -route "simple-spring-boot" created -imagestream "simple-spring-boot" created -deploymentconfig "simple-spring-boot" created -rolebinding "jenkins_edit" created -``` - -A _build template_ is provided at `build/basic-java-template.yml` that defines all the resources required to build our java app. It includes: +A _build template_ is provided at `builds/template.yml` that defines all the resources required to build our java app. It includes: * A `BuildConfig` that defines a `JenkinsPipelineStrategy` build, which will be used to define out pipeline. * A `BuildConfig` that defines a `Source` build with `Binary` input. This will build our image. -Deploy the pipeline template in dev only. -``` -$ oc process -f build/basic-java-template.yml --param-file build/dev/params | oc apply -f- -buildconfig "simple-spring-boot-pipeline" created -buildconfig "simple-spring-boot" created -``` - At this point you should be able to go to the Web Console and follow the pipeline by clicking in your `myapp-dev` project, and going to *Builds* -> *Pipelines*. There is a prompt for input on the pipeline before the production route is switched to the new deployment. You can interact with it by clicking on the _input required_ link, which takes you to Jenkins, where you can click the *Proceed* button. By the time you get through the end of the pipeline you should be able to visit the Route for your app deployed to the `myapp-prod` project to confirm that your image has been promoted through all stages. ## Cleanup @@ -168,5 +125,5 @@ At this point you should be able to go to the Web Console and follow the pipelin Cleaning up this example is as simple as deleting the projects we created at the beginning. ``` -oc delete project simple-spring-boot-dev simple-spring-boot-prod simple-spring-boot-stage +oc delete project spring-boot-web-dev spring-boot-web-prod spring-boot-web-stage ``` diff --git a/blue-green-spring/build/dev/params b/blue-green-spring/build/dev/params deleted file mode 100644 index ae507548..00000000 --- a/blue-green-spring/build/dev/params +++ /dev/null @@ -1,3 +0,0 @@ -APPLICATION_NAME=spring-boot-web -NAMESPACE=simple-spring-boot-dev -IMAGE_STREAM_TAG_NAME=redhat-openjdk18-openshift:1.1 diff --git a/blue-green-spring/deploy/dev/params b/blue-green-spring/deploy/dev/params deleted file mode 100644 index 56d804f7..00000000 --- a/blue-green-spring/deploy/dev/params +++ /dev/null @@ -1,3 +0,0 @@ -APPLICATION_NAME=spring-boot-web -NAMESPACE=simple-spring-boot-dev -SA_NAMESPACE=simple-spring-boot-dev diff --git a/blue-green-spring/deploy/prod/params b/blue-green-spring/deploy/prod/params deleted file mode 100644 index db6a9d17..00000000 --- a/blue-green-spring/deploy/prod/params +++ /dev/null @@ -1,4 +0,0 @@ -APPLICATION_NAME=spring-boot-web -NAMESPACE=simple-spring-boot-prod -SA_NAME=jenkins -SA_NAMESPACE=simple-spring-boot-dev diff --git a/blue-green-spring/deploy/stage/params b/blue-green-spring/deploy/stage/params deleted file mode 100644 index 75ef207f..00000000 --- a/blue-green-spring/deploy/stage/params +++ /dev/null @@ -1,4 +0,0 @@ -APPLICATION_NAME=spring-boot-web -NAMESPACE=simple-spring-boot-stage -SA_NAME=jenkins -SA_NAMESPACE=simple-spring-boot-dev diff --git a/blue-green-spring/files/builds/params b/blue-green-spring/files/builds/params new file mode 100644 index 00000000..857ad03a --- /dev/null +++ b/blue-green-spring/files/builds/params @@ -0,0 +1,5 @@ +APPLICATION_NAME=spring-boot-web +NAMESPACE=build +IMAGE_STREAM_TAG_NAME=redhat-openjdk18-openshift:1.1 +SOURCE_REPOSITORY_URL=https://github.com/pabrahamsson/simple-spring-boot-web.git +SOURCE_REPOSITORY_REF=build diff --git a/blue-green-spring/build/basic-java-template.yml b/blue-green-spring/files/builds/template.yml similarity index 94% rename from blue-green-spring/build/basic-java-template.yml rename to blue-green-spring/files/builds/template.yml index 4eb63261..f38a14bc 100644 --- a/blue-green-spring/build/basic-java-template.yml +++ b/blue-green-spring/files/builds/template.yml @@ -58,6 +58,13 @@ objects: name: ${IMAGE_STREAM_TAG_NAME} namespace: ${IMAGE_STREAM_NAMESPACE} type: Source +- apiVersion: v1 + kind: ImageStream + metadata: + labels: + application: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + namespace: ${NAMESPACE} parameters: - description: The name for the application. name: APPLICATION_NAME diff --git a/blue-green-spring/files/deployment/build/params b/blue-green-spring/files/deployment/build/params new file mode 100644 index 00000000..c9140ccf --- /dev/null +++ b/blue-green-spring/files/deployment/build/params @@ -0,0 +1 @@ +MEMORY_LIMIT=512Mi diff --git a/blue-green-spring/files/deployment/dev/params b/blue-green-spring/files/deployment/dev/params new file mode 100644 index 00000000..87c73d1b --- /dev/null +++ b/blue-green-spring/files/deployment/dev/params @@ -0,0 +1,2 @@ +APPLICATION_NAME=spring-boot-web +NAMESPACE=spring-boot-web-dev diff --git a/blue-green-spring/files/deployment/prod/params b/blue-green-spring/files/deployment/prod/params new file mode 100644 index 00000000..7995c9bd --- /dev/null +++ b/blue-green-spring/files/deployment/prod/params @@ -0,0 +1,2 @@ +APPLICATION_NAME=spring-boot-web +NAMESPACE=spring-boot-web-prod diff --git a/blue-green-spring/files/deployment/stage/params b/blue-green-spring/files/deployment/stage/params new file mode 100644 index 00000000..3d8d3871 --- /dev/null +++ b/blue-green-spring/files/deployment/stage/params @@ -0,0 +1,2 @@ +APPLICATION_NAME=spring-boot-web +NAMESPACE=spring-boot-web-stage diff --git a/blue-green-spring/deploy/simple-spring-boot-template-prod.yml b/blue-green-spring/files/deployment/template-bg.yml similarity index 99% rename from blue-green-spring/deploy/simple-spring-boot-template-prod.yml rename to blue-green-spring/files/deployment/template-bg.yml index 3c1d44d4..05f1ca33 100644 --- a/blue-green-spring/deploy/simple-spring-boot-template-prod.yml +++ b/blue-green-spring/files/deployment/template-bg.yml @@ -228,6 +228,7 @@ parameters: - description: Namespace of service account that can deploy to this project name: SA_NAMESPACE required: true + value: build - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' name: HOSTNAME_HTTP diff --git a/blue-green-spring/deploy/simple-spring-boot-template.yml b/blue-green-spring/files/deployment/template.yml similarity index 99% rename from blue-green-spring/deploy/simple-spring-boot-template.yml rename to blue-green-spring/files/deployment/template.yml index d6f5d480..7e3490d5 100644 --- a/blue-green-spring/deploy/simple-spring-boot-template.yml +++ b/blue-green-spring/files/deployment/template.yml @@ -123,6 +123,7 @@ parameters: - description: Namespace of service account that can deploy to this project name: SA_NAMESPACE required: true + value: build - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' name: HOSTNAME_HTTP diff --git a/blue-green-spring/files/imagestreams/imagestreams.yml b/blue-green-spring/files/imagestreams/imagestreams.yml new file mode 100644 index 00000000..87a4a366 --- /dev/null +++ b/blue-green-spring/files/imagestreams/imagestreams.yml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Template +metadata: + annotations: + description: ImageStream template +objects: + - apiVersion: v1 + kind: ImageStream + metadata: + name: redhat-openjdk18-openshift + namespace: "${NAMESPACE}" + spec: + lookupPolicy: + local: false + tags: + - from: + kind: DockerImage + name: "${IMAGE}" + name: "${TAG}" + referencePolicy: + type: Source +parameters: +- description: Image name to use for the ImageStream + name: IMAGE + required: true +- description: The namespace where to create the ImageStream + name: NAMESPACE + required: true +- description: Image tag to sync + name: TAG + required: true + value: latest diff --git a/blue-green-spring/files/imagestreams/openshift/params b/blue-green-spring/files/imagestreams/openshift/params new file mode 100644 index 00000000..b933e5ff --- /dev/null +++ b/blue-green-spring/files/imagestreams/openshift/params @@ -0,0 +1,3 @@ +IMAGE=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift +NAMESPACE=openshift +TAG=1.1 diff --git a/blue-green-spring/projects/projects.yml b/blue-green-spring/files/projects/projects.yml similarity index 64% rename from blue-green-spring/projects/projects.yml rename to blue-green-spring/files/projects/projects.yml index a0026032..7b7fa944 100644 --- a/blue-green-spring/projects/projects.yml +++ b/blue-green-spring/files/projects/projects.yml @@ -4,18 +4,24 @@ items: - kind: ProjectRequest apiVersion: v1 metadata: - name: simple-spring-boot-dev + name: spring-boot-web-dev creationTimestam: null displayName: Dev - Spring Boot Blue Green - kind: ProjectRequest apiVersion: v1 metadata: - name: simple-spring-boot-stage + name: spring-boot-web-stage creationTimestam: null displayName: Staging - Spring Boot Blue Green - kind: ProjectRequest apiVersion: v1 metadata: - name: simple-spring-boot-prod + name: spring-boot-web-prod creationTimestam: null displayName: Prod - Spring Boot Blue Green +- kind: ProjectRequest + apiVersion: v1 + metadata: + name: build + creationTimestam: null + displayName: Build - Jenkins is here diff --git a/blue-green-spring/inventory/group_vars/all.yml b/blue-green-spring/inventory/group_vars/all.yml new file mode 100644 index 00000000..4be464c9 --- /dev/null +++ b/blue-green-spring/inventory/group_vars/all.yml @@ -0,0 +1,31 @@ +--- +openshift_cluster_content: +- object: projectrequest + content: + - name: simple-spring-boot-spaces + file: "{{ inventory_dir }}/../files/projects/projects.yml" +- object: imagestreams + content: + - name: redhat-openjdk18-openshift + template: "{{ inventory_dir }}/../files/imagestreams/imagestreams.yml" + params: "{{ inventory_dir }}/../files/imagestreams/openshift/params" +- object: deployments + content: + - name: jenkins + namespace: build + template: openshift//jenkins-ephemeral + params: "{{ inventory_dir }}/../files/deployment/build/params" + - name: basic-tomcat-dev + template: "{{ inventory_dir }}/../files/deployment/template.yml" + params: "{{ inventory_dir }}/../files/deployment/dev/params" + - name: basic-tomcat-stage + template: "{{ inventory_dir }}/../files/deployment/template.yml" + params: "{{ inventory_dir }}/../files/deployment/stage/params" + - name: basic-tomcat-prod + template: "{{ inventory_dir }}/../files/deployment/template-bg.yml" + params: "{{ inventory_dir }}/../files/deployment/prod/params" +- object: builds + content: + - name: jenkins + template: "{{ inventory_dir }}/../files/builds/template.yml" + params: "{{ inventory_dir }}/../files/builds/params" diff --git a/blue-green-spring/inventory/hosts b/blue-green-spring/inventory/hosts new file mode 100644 index 00000000..05c07035 --- /dev/null +++ b/blue-green-spring/inventory/hosts @@ -0,0 +1,2 @@ +[seed-hosts] +localhost From ef520deaefd057061914241259cc81a96b52eac1 Mon Sep 17 00:00:00 2001 From: Petter Abrahamsson Date: Wed, 6 Dec 2017 16:53:19 -0500 Subject: [PATCH 2/3] Use per app build namespace(s) --- basic-tomcat/README.md | 2 +- basic-tomcat/files/builds/params | 2 +- basic-tomcat/files/deployment/template.yml | 2 +- basic-tomcat/files/projects/projects.yml | 2 +- basic-tomcat/inventory/group_vars/all.yml | 2 +- blue-green-spring/README.md | 2 +- blue-green-spring/files/builds/params | 2 +- blue-green-spring/files/deployment/template-bg.yml | 2 +- blue-green-spring/files/deployment/template.yml | 2 +- blue-green-spring/files/projects/projects.yml | 2 +- blue-green-spring/inventory/group_vars/all.yml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/basic-tomcat/README.md b/basic-tomcat/README.md index 2911ab82..610c647b 100644 --- a/basic-tomcat/README.md +++ b/basic-tomcat/README.md @@ -71,7 +71,7 @@ https://github.com/etsauer/ticket-monster For the purposes of this demo, we are going to create three stages for our application to be promoted through. -- `build` +- `basic-tomcat-build` - `basic-tomcat-dev` - `basic-tomcat-stage` - `basic-tomcat-prod` diff --git a/basic-tomcat/files/builds/params b/basic-tomcat/files/builds/params index 7f29d6e4..e2fe86d5 100644 --- a/basic-tomcat/files/builds/params +++ b/basic-tomcat/files/builds/params @@ -1,3 +1,3 @@ -NAMESPACE=build +NAMESPACE=basic-tomcat-build SOURCE_REPOSITORY_URL=https://github.com/pabrahamsson/ticket-monster.git SOURCE_REPOSITORY_REF=build diff --git a/basic-tomcat/files/deployment/template.yml b/basic-tomcat/files/deployment/template.yml index f5fa035d..988cd82d 100644 --- a/basic-tomcat/files/deployment/template.yml +++ b/basic-tomcat/files/deployment/template.yml @@ -150,7 +150,7 @@ parameters: - description: Namespace of service account that can deploy to this project name: SA_NAMESPACE required: true - value: build + value: basic-tomcat-build - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' name: HOSTNAME_HTTP diff --git a/basic-tomcat/files/projects/projects.yml b/basic-tomcat/files/projects/projects.yml index efba0a1e..20e2644f 100644 --- a/basic-tomcat/files/projects/projects.yml +++ b/basic-tomcat/files/projects/projects.yml @@ -22,6 +22,6 @@ items: - kind: ProjectRequest apiVersion: v1 metadata: - name: build + name: basic-tomcat-build creationTimestam: null displayName: Build - Jenkins is here diff --git a/basic-tomcat/inventory/group_vars/all.yml b/basic-tomcat/inventory/group_vars/all.yml index dfba37c5..3ecb04e1 100644 --- a/basic-tomcat/inventory/group_vars/all.yml +++ b/basic-tomcat/inventory/group_vars/all.yml @@ -12,7 +12,7 @@ openshift_cluster_content: - object: deployments content: - name: jenkins - namespace: build + namespace: basic-tomcat-build template: openshift//jenkins-ephemeral params: "{{ inventory_dir }}/../files/deployment/build/params" - name: basic-tomcat-dev diff --git a/blue-green-spring/README.md b/blue-green-spring/README.md index 171a7c7d..43260aac 100644 --- a/blue-green-spring/README.md +++ b/blue-green-spring/README.md @@ -80,7 +80,7 @@ https://github.com/malacourse/simple-spring-boot-web For the purposes of this demo, we are going to create four stages for our application to be promoted through. -- 'build' +- 'spring-boot-web-build' - `spring-boot-web-dev` - `spring-boot-web-stage` - `spring-boot-web-prod` diff --git a/blue-green-spring/files/builds/params b/blue-green-spring/files/builds/params index 857ad03a..543c13b3 100644 --- a/blue-green-spring/files/builds/params +++ b/blue-green-spring/files/builds/params @@ -1,5 +1,5 @@ APPLICATION_NAME=spring-boot-web -NAMESPACE=build +NAMESPACE=spring-boot-web-build IMAGE_STREAM_TAG_NAME=redhat-openjdk18-openshift:1.1 SOURCE_REPOSITORY_URL=https://github.com/pabrahamsson/simple-spring-boot-web.git SOURCE_REPOSITORY_REF=build diff --git a/blue-green-spring/files/deployment/template-bg.yml b/blue-green-spring/files/deployment/template-bg.yml index 05f1ca33..853bc075 100644 --- a/blue-green-spring/files/deployment/template-bg.yml +++ b/blue-green-spring/files/deployment/template-bg.yml @@ -228,7 +228,7 @@ parameters: - description: Namespace of service account that can deploy to this project name: SA_NAMESPACE required: true - value: build + value: spring-boot-web-build - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' name: HOSTNAME_HTTP diff --git a/blue-green-spring/files/deployment/template.yml b/blue-green-spring/files/deployment/template.yml index 7e3490d5..985b5764 100644 --- a/blue-green-spring/files/deployment/template.yml +++ b/blue-green-spring/files/deployment/template.yml @@ -123,7 +123,7 @@ parameters: - description: Namespace of service account that can deploy to this project name: SA_NAMESPACE required: true - value: build + value: spring-boot-web-build - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' name: HOSTNAME_HTTP diff --git a/blue-green-spring/files/projects/projects.yml b/blue-green-spring/files/projects/projects.yml index 7b7fa944..27bc3934 100644 --- a/blue-green-spring/files/projects/projects.yml +++ b/blue-green-spring/files/projects/projects.yml @@ -22,6 +22,6 @@ items: - kind: ProjectRequest apiVersion: v1 metadata: - name: build + name: spring-boot-web-build creationTimestam: null displayName: Build - Jenkins is here diff --git a/blue-green-spring/inventory/group_vars/all.yml b/blue-green-spring/inventory/group_vars/all.yml index 4be464c9..af8891bc 100644 --- a/blue-green-spring/inventory/group_vars/all.yml +++ b/blue-green-spring/inventory/group_vars/all.yml @@ -12,7 +12,7 @@ openshift_cluster_content: - object: deployments content: - name: jenkins - namespace: build + namespace: spring-boot-web-build template: openshift//jenkins-ephemeral params: "{{ inventory_dir }}/../files/deployment/build/params" - name: basic-tomcat-dev From 3e4fef41f7f9d44505b016bdce67a7acfc86e593 Mon Sep 17 00:00:00 2001 From: Petter Abrahamsson Date: Thu, 7 Dec 2017 07:49:06 -0500 Subject: [PATCH 3/3] Remove imagestreams + doc update --- basic-tomcat/README.md | 2 +- .../files/imagestreams/imagestreams.yml | 32 ------------------- .../files/imagestreams/openshift/params | 3 -- basic-tomcat/inventory/group_vars/all.yml | 6 +--- blue-green-spring/README.md | 2 +- .../files/imagestreams/imagestreams.yml | 32 ------------------- .../files/imagestreams/openshift/params | 3 -- .../inventory/group_vars/all.yml | 6 +--- 8 files changed, 4 insertions(+), 82 deletions(-) delete mode 100644 basic-tomcat/files/imagestreams/imagestreams.yml delete mode 100644 basic-tomcat/files/imagestreams/openshift/params delete mode 100644 blue-green-spring/files/imagestreams/imagestreams.yml delete mode 100644 blue-green-spring/files/imagestreams/openshift/params diff --git a/basic-tomcat/README.md b/basic-tomcat/README.md index 610c647b..b65dec1f 100644 --- a/basic-tomcat/README.md +++ b/basic-tomcat/README.md @@ -106,5 +106,5 @@ At this point you should be able to go to the Web Console and follow the pipelin Cleaning up this example is as simple as deleting the projects we created at the beginning. ``` -oc delete project basic-tomcat-dev basic-tomcat-prod basic-tomcat-stage +oc delete project basic-tomcat-build basic-tomcat-dev basic-tomcat-prod basic-tomcat-stage ``` diff --git a/basic-tomcat/files/imagestreams/imagestreams.yml b/basic-tomcat/files/imagestreams/imagestreams.yml deleted file mode 100644 index ace835ad..00000000 --- a/basic-tomcat/files/imagestreams/imagestreams.yml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: v1 -kind: Template -metadata: - annotations: - description: ImageStream template -objects: - - apiVersion: v1 - kind: ImageStream - metadata: - name: jboss-webserver31-tomcat8-openshift - namespace: "${NAMESPACE}" - spec: - lookupPolicy: - local: false - tags: - - from: - kind: DockerImage - name: "${IMAGE}" - name: "${TAG}" - referencePolicy: - type: Source -parameters: -- description: Image name to use for the ImageStream - name: IMAGE - required: true -- description: The namespace where to create the ImageStream - name: NAMESPACE - required: true -- description: Image tag to sync - name: TAG - required: true - value: latest diff --git a/basic-tomcat/files/imagestreams/openshift/params b/basic-tomcat/files/imagestreams/openshift/params deleted file mode 100644 index f3cd3f78..00000000 --- a/basic-tomcat/files/imagestreams/openshift/params +++ /dev/null @@ -1,3 +0,0 @@ -IMAGE=registry.access.redhat.com/jboss-webserver-3/webserver31-tomcat8-openshift -NAMESPACE=openshift -TAG=1.0 diff --git a/basic-tomcat/inventory/group_vars/all.yml b/basic-tomcat/inventory/group_vars/all.yml index 3ecb04e1..1adaf74f 100644 --- a/basic-tomcat/inventory/group_vars/all.yml +++ b/basic-tomcat/inventory/group_vars/all.yml @@ -4,11 +4,7 @@ openshift_cluster_content: content: - name: basic-tomcat-spaces file: "{{ inventory_dir }}/../files/projects/projects.yml" -- object: imagestreams - content: - - name: jboss-webserver31-tomcat8-openshift - template: "{{ inventory_dir }}/../files/imagestreams/imagestreams.yml" - params: "{{ inventory_dir }}/../files/imagestreams/openshift/params" + file_action: create - object: deployments content: - name: jenkins diff --git a/blue-green-spring/README.md b/blue-green-spring/README.md index 43260aac..0096af64 100644 --- a/blue-green-spring/README.md +++ b/blue-green-spring/README.md @@ -125,5 +125,5 @@ At this point you should be able to go to the Web Console and follow the pipelin Cleaning up this example is as simple as deleting the projects we created at the beginning. ``` -oc delete project spring-boot-web-dev spring-boot-web-prod spring-boot-web-stage +oc delete project spring-boot-web-build spring-boot-web-dev spring-boot-web-prod spring-boot-web-stage ``` diff --git a/blue-green-spring/files/imagestreams/imagestreams.yml b/blue-green-spring/files/imagestreams/imagestreams.yml deleted file mode 100644 index 87a4a366..00000000 --- a/blue-green-spring/files/imagestreams/imagestreams.yml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: v1 -kind: Template -metadata: - annotations: - description: ImageStream template -objects: - - apiVersion: v1 - kind: ImageStream - metadata: - name: redhat-openjdk18-openshift - namespace: "${NAMESPACE}" - spec: - lookupPolicy: - local: false - tags: - - from: - kind: DockerImage - name: "${IMAGE}" - name: "${TAG}" - referencePolicy: - type: Source -parameters: -- description: Image name to use for the ImageStream - name: IMAGE - required: true -- description: The namespace where to create the ImageStream - name: NAMESPACE - required: true -- description: Image tag to sync - name: TAG - required: true - value: latest diff --git a/blue-green-spring/files/imagestreams/openshift/params b/blue-green-spring/files/imagestreams/openshift/params deleted file mode 100644 index b933e5ff..00000000 --- a/blue-green-spring/files/imagestreams/openshift/params +++ /dev/null @@ -1,3 +0,0 @@ -IMAGE=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift -NAMESPACE=openshift -TAG=1.1 diff --git a/blue-green-spring/inventory/group_vars/all.yml b/blue-green-spring/inventory/group_vars/all.yml index af8891bc..843ff8db 100644 --- a/blue-green-spring/inventory/group_vars/all.yml +++ b/blue-green-spring/inventory/group_vars/all.yml @@ -4,11 +4,7 @@ openshift_cluster_content: content: - name: simple-spring-boot-spaces file: "{{ inventory_dir }}/../files/projects/projects.yml" -- object: imagestreams - content: - - name: redhat-openjdk18-openshift - template: "{{ inventory_dir }}/../files/imagestreams/imagestreams.yml" - params: "{{ inventory_dir }}/../files/imagestreams/openshift/params" + file_action: create - object: deployments content: - name: jenkins