├── .editorconfig ├── .github └── workflows │ └── docs.yml ├── .gitignore ├── .nvmrc ├── CONTRIBUTING.adoc ├── Dockerfile ├── LICENSE ├── README.adoc ├── apps ├── app1 │ └── run.sh └── todo │ ├── .dockerignore │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── src │ ├── main │ │ ├── docker │ │ │ ├── Dockerfile.jvm │ │ │ └── Dockerfile.native │ │ ├── java │ │ │ └── io │ │ │ │ └── quarkus │ │ │ │ └── sample │ │ │ │ ├── Todo.java │ │ │ │ ├── TodoApplication.java │ │ │ │ ├── TodoGraphQLEndpoint.java │ │ │ │ └── TodoResource.java │ │ ├── kubernetes │ │ │ ├── openshift-postgres-deployment.yaml │ │ │ ├── openshift-postgres-service.yaml │ │ │ ├── openshift-todo-service.yaml │ │ │ ├── postgresql-create-table.yaml │ │ │ ├── postgresql-deployment.yaml │ │ │ ├── postgresql-service.yaml │ │ │ ├── todo-deployment.yaml │ │ │ ├── todo-ingress.yaml │ │ │ ├── todo-insert-data.yaml │ │ │ ├── todo-route.yaml │ │ │ └── todo-service.yaml │ │ └── resources │ │ │ ├── META-INF │ │ │ └── resources │ │ │ │ ├── js │ │ │ │ ├── app.js │ │ │ │ ├── routes.js │ │ │ │ └── store.js │ │ │ │ ├── package.json │ │ │ │ ├── quarkus_icon.png │ │ │ │ └── todo.html │ │ │ └── application.properties │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── sample │ │ ├── NativeTodoResourceIT.java │ │ └── TodoResourceTest.java │ └── token.yaml ├── assets ├── bgd-app │ └── bgd-app.yaml ├── examples │ └── bgd-yaml │ │ ├── bgd-deployment.yaml │ │ ├── bgd-namespace.yaml │ │ ├── bgd-route.yaml │ │ ├── bgd-svc.yaml │ │ └── kustomization.yaml ├── operator-install │ ├── kustomization.yaml │ └── openshift-gitops-operator-sub.yaml ├── scripts │ └── argocd-postinstall.sh └── syncwaves-hooks │ └── welcome-syncwaves.yaml ├── dev-site.yml ├── documentation ├── antora.yml └── modules │ └── ROOT │ ├── assets │ └── images │ │ ├── appk-overview.png │ │ ├── argocd-app1.png │ │ ├── argocd-app2.png │ │ ├── argocd-app3.png │ │ ├── argocd-login.png │ │ ├── argocd-login2.png │ │ ├── argocd-logo.png │ │ ├── argocd-sync-flow.png │ │ ├── argocd.png │ │ ├── argopad.png │ │ ├── bgd-green.png │ │ ├── bgd.png │ │ ├── bgdapp.png │ │ ├── bgdk-app.png │ │ ├── fullysynced.png │ │ ├── green-square.png │ │ ├── hooks-card.png │ │ ├── hooks-tree.png │ │ ├── install-argo-operator.gif │ │ ├── kubelogo.png │ │ ├── kustomize_logo.png │ │ ├── ocp-install1.png │ │ ├── ocp-install2.png │ │ ├── ocp-install3.png │ │ ├── ocp-install4.png │ │ ├── ocp-install5.png │ │ ├── os-gitops-installed.png │ │ ├── out-of-sync.png │ │ ├── presyncpost.excalidraw │ │ ├── presyncpost.png │ │ ├── resource-hooks.png │ │ ├── synced-app.png │ │ ├── synced-appk.png │ │ ├── syncwave.gif │ │ ├── todo-app-screenshot.png │ │ ├── todo-app.png │ │ ├── todo-argocd.png │ │ ├── todo-card.png │ │ ├── todo-schema.excalidraw │ │ ├── two-apps.png │ │ ├── waves-and-hooks-card.png │ │ ├── waves-and-hooks-tree.png │ │ ├── welcome-syncwaves-tree.png │ │ ├── welcome-syncwaves.png │ │ └── yellow-square.png │ ├── examples │ ├── bgd-app │ │ └── bgd-app.yaml │ ├── bgd-yaml │ │ ├── bgd-deployment.yaml │ │ ├── bgd-namespace.yaml │ │ ├── bgd-route.yaml │ │ ├── bgd-svc.yaml │ │ └── kustomization.yaml │ ├── bgdk-app │ │ └── bgdk-app.yaml │ ├── kustomize-build │ │ ├── kustomization.yaml │ │ └── welcome.yaml │ ├── minikube │ │ ├── bgd-app │ │ │ └── bgd-app.yaml │ │ ├── bgd-yaml │ │ │ ├── bgd-deployment.yaml │ │ │ ├── bgd-ingress.yaml │ │ │ ├── bgd-svc.yaml │ │ │ └── kustomization.yaml │ │ ├── bgdk-app │ │ │ └── bgdk-app.yaml │ │ ├── syncwaves-hooks │ │ │ ├── hooks │ │ │ │ └── welcome-php-presync-job.yaml │ │ │ ├── syncwaves-and-hooks │ │ │ │ ├── welcome-php-postsync-pod.yaml │ │ │ │ ├── welcome-php-presync-job.yaml │ │ │ │ └── welcome-php-presync-pod.yaml │ │ │ ├── welcome-hooks.yaml │ │ │ ├── welcome-syncwaves-and-hooks.yaml │ │ │ └── welcome-syncwaves.yaml │ │ ├── todo-yaml │ │ │ ├── postgresql-create-table.yaml │ │ │ ├── postgresql-deployment.yaml │ │ │ ├── postgresql-service.yaml │ │ │ ├── todo-application.yaml │ │ │ ├── todo-deployment.yaml │ │ │ ├── todo-ingress.yaml │ │ │ ├── todo-insert-data.yaml │ │ │ ├── todo-namespace.yaml │ │ │ └── todo-service.yaml │ │ └── welcome-php-yaml │ │ │ ├── kustomization.yaml │ │ │ ├── welcome-php-deployment.yaml │ │ │ ├── welcome-php-ingress.yaml │ │ │ ├── welcome-php-ns.yaml │ │ │ └── welcome-php-svc.yaml │ ├── run.sh │ ├── syncwaves-hooks │ │ ├── hooks │ │ │ └── welcome-php-presync-job.yaml │ │ ├── syncwaves-and-hooks │ │ │ ├── welcome-php-postsync-pod.yaml │ │ │ ├── welcome-php-presync-job.yaml │ │ │ └── welcome-php-presync-pod.yaml │ │ ├── welcome-hooks.yaml │ │ ├── welcome-syncwaves-and-hooks.yaml │ │ └── welcome-syncwaves.yaml │ ├── todo-yaml │ │ ├── postgres-create-table.yaml │ │ ├── postgres-deployment.yaml │ │ ├── postgres-service.yaml │ │ ├── todo-application.yaml │ │ ├── todo-deployment.yaml │ │ ├── todo-insert-data.yaml │ │ ├── todo-namespace.yaml │ │ ├── todo-route.yaml │ │ └── todo-service.yaml │ ├── welcome-php-yaml │ │ ├── kustomization.yaml │ │ ├── welcome-php-deployment.yaml │ │ ├── welcome-php-ns.yaml │ │ ├── welcome-php-route.yaml │ │ └── welcome-php-svc.yaml │ └── welcome-php │ │ ├── welcome-hooks.yaml │ │ ├── welcome-syncwaves-and-hooks.yaml │ │ └── welcome-syncwaves.yaml │ ├── nav.adoc │ ├── pages │ ├── 01-setup.adoc │ ├── 02-getting_started.adoc │ ├── 03-kustomize.adoc │ ├── 04-syncwaves-hooks.adoc │ ├── _attributes.adoc │ └── index.adoc │ └── partials │ └── exec_pod.adoc ├── gulpfile.babel.js ├── lib ├── remote-include-processor.js └── tab-block.js ├── package.json ├── site.sh ├── site.yml ├── supplemental-ui ├── .nojekyll ├── img │ └── favicon.ico ├── partials │ └── footer-nav.hbs └── ui.yml └── vscode-asciidoc-extra.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = false 8 | insert_final_newline = false -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | env: 8 | SITE_DIR: "gh-pages" 9 | jobs: 10 | build_site: 11 | name: "Build site with Antora" 12 | runs-on: [ubuntu-latest] 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v2 16 | - name: "Generate site using antora site action" 17 | uses: kameshsampath/antora-site-action@master 18 | with: 19 | antora_playbook: site.yml 20 | - name: "Upload generated site" 21 | uses: actions/upload-artifact@v1.0.0 22 | with: 23 | name: site 24 | path: "${{ github.workspace }}/${{ env.SITE_DIR }}" 25 | deploy_site: 26 | runs-on: [ubuntu-latest] 27 | needs: [build_site] 28 | name: "Deploy GitHub Pages" 29 | steps: 30 | - name: Checkout 31 | uses: actions/checkout@v2 32 | - name: Download generated site 33 | uses: actions/download-artifact@v1 34 | with: 35 | name: site 36 | path: "${{ github.workspace }}/${{ env.SITE_DIR }}" 37 | - name: Deploy to GitHub Pages 38 | uses: JamesIves/github-pages-deploy-action@3.2.1 39 | with: 40 | # ACCESS_TOKEN: # optional 41 | GITHUB_TOKEN: "${{ github.token}}" 42 | FOLDER: "${{ env.SITE_DIR }}" 43 | BRANCH: "gh-pages" 44 | COMMIT_MESSAGE: "[CI] Publish Documentation for ${{ github.sha }}" 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | audit.log 4 | .cache/ 5 | *.log 6 | 7 | docs/ 8 | gh-pages/ 9 | dependency-reduced-pom.xml 10 | svm.jar 11 | 12 | ### STS ### 13 | .apt_generated 14 | .classpath 15 | .factorypath 16 | .project 17 | .settings 18 | .springBeans 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | 26 | ### NetBeans ### 27 | nbproject/private/ 28 | build/ 29 | nbbuild/ 30 | dist/ 31 | nbdist/ 32 | .nb-gradle/ 33 | 34 | .DS_Store 35 | .vscode 36 | istio-1.1.1 37 | firebase* 38 | yarn* 39 | package* 40 | !package.json 41 | node_modules 42 | .firebaserc 43 | .firebase 44 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 12 -------------------------------------------------------------------------------- /CONTRIBUTING.adoc: -------------------------------------------------------------------------------- 1 | # Contributing Guide 2 | 3 | The sources of this tutorial docs is in https://github.com/redhat-scholars/argocd-tutorial/tree/master/documentation[documentation] folder. 4 | The site generation is done by https://docs.antora.org/[Antora] 5 | 6 | ### Visual Studio Code Remote Development 7 | 8 | If you are using link:https://code.visualstudio.com/[Visual Studio Code] with the link:https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers[Remote Containers Extension], you don't need to install anything locally. 9 | 10 | Simply follow these instructions: 11 | 12 | 1. (Only if running with podman) Set the environment variable `DEVCONTAINER_TARGET_PREFIX=podman` 13 | 2. Open VS Code from the root of `argocd-tutorial` repository and when prompted indicate that you want to open the folder in a container. 14 | 15 | Once the devcontainer is initialized, from the Visual Studio Code terminal run `npm run dev` to start the development site. (Visual Studio Code should handle all the port forwarding into the devcontainer so that you can interact with the site from an VSCode assigned port on your localhost) 16 | 17 | Alternatively, you can run the `Build and watch dev-site` VSCode task that should be installed in your workspace when starting up the container 18 | 19 | ## Running site in development mode 20 | 21 | To run the site in development mode you need to have https://yarnpkg.com[yarn] or https://nodejs.org/en/[npm] installed with https://nodejs.org[NodeJS] v12.x or above. 22 | 23 | Clone this repository 24 | ``` 25 | git clone https://github.com/redhat-scholars/openshift-starter-guides.git 26 | ``` 27 | 28 | Run `yarn install` or `npm install` from the `openshift-starter-guides` repository to install needed nodejs packages. 29 | ``` 30 | npm install 31 | ``` 32 | 33 | Start the development site using `yarn run dev` or `npm run dev` or `gulp` command, this should open a local development site at http://localhost:3000 in your default browser: 34 | ``` 35 | gulp 36 | ``` 37 | 38 | Making any changes to your local repositories above cloned earlier, will be automatically built and the development site gets reloaded automatically. 39 | 40 | ## Send your contribution 41 | 42 | Now you are all set: 43 | 44 | - Open an Issue in http://github.com/redhat-scholars/argocd-tutorial.git 45 | - Prepare your changes in the respective documentation repository 46 | - Send the PR to respective repositories listed above 47 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/antora/antora as builder 2 | 3 | ADD . /antora/ 4 | 5 | RUN antora generate --stacktrace site.yml 6 | 7 | FROM registry.access.redhat.com/rhscl/httpd-24-rhel7 8 | 9 | COPY --from=builder /antora/gh-pages/ /var/www/html/ 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = ArgoCD and GitOps Tutorial for Kubernetes 2 | 3 | image::https://github.com/redhat-scholars/openshift-starter-guides/workflows/docs/badge.svg[docs] 4 | 5 | == Overview 6 | 7 | |=== 8 | || 9 | 10 | |Audience Experience Level 11 | |Beginner 12 | 13 | |Average Time to Complete 14 | |45 minutes 15 | |=== 16 | 17 | 18 | image::https://redhat-scholars.github.io/argocd-tutorial/argocd-tutorial/_images/argocd-logo.png[ArgoCD,400] 19 | 20 | https://argoproj.github.io/argo-cd/[Argo CD,window='_blank'] is a declarative, GitOps continuous delivery tool for Kubernetes. 21 | 22 | It follows the https://www.openshift.com/learn/topics/gitops/[GitOps,window='_blank'] pattern of using Git repositories as the source of truth for defining the desired application state. 23 | 24 | It automates the deployment of the desired application states in the specified target environments. Application deployments can track updates to branches, tags, or pinned to a specific version of manifests at a Git commit. 25 | 26 | == Who is this for? 27 | 28 | Developers/DevOps that want to take benefit from GitOps approach. Having Git repositories as the source of truth, it allows development teams to store the entire state of the cluster configuration in Git so that the trail of changes are visible and auditable. 29 | 30 | This workshop is intended to give you a hands on introduction to ArgoCD on Kubernetes using https://minikube.sigs.k8s.io/docs/start[Minikube,window='_blank'] and https://try.openshift.com[OpenShift,window='_blank']. 31 | 32 | == What you will learn 33 | 34 | * The fundamentals of GitOps and ArgoCD 35 | * How to install and managed ArgoCD in Kubernetes and OpenShift 36 | * Deploying and sync applications 37 | * Use Kustomize with ArgoCD 38 | * Use Sync Waves and Hooks with ArgoCD 39 | 40 | 41 | == Documentation 42 | 43 | This workshop is based on link:https://antora.org/[Antora] and link:https://github.com/redhat-scholars/courseware-template[Red Hat scholars template] to build HTML based tutorials. 44 | 45 | To start this workshop, follow the step by step tutorial link for your cluster available below: 46 | 47 | https://redhat-scholars.github.io/argocd-tutorial/ 48 | 49 | == Contributing 50 | 51 | Please refer to the link:CONTRIBUTING.adoc#contributing-guide[how to contribute] on how you can contribute to the tutorial. 52 | -------------------------------------------------------------------------------- /apps/app1/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Hello World" -------------------------------------------------------------------------------- /apps/todo/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* 5 | !target/quarkus-app/* -------------------------------------------------------------------------------- /apps/todo/.gitignore: -------------------------------------------------------------------------------- 1 | #Maven 2 | target/ 3 | pom.xml.tag 4 | pom.xml.releaseBackup 5 | pom.xml.versionsBackup 6 | release.properties 7 | # Eclipse 8 | .project 9 | .classpath 10 | .settings/ 11 | bin/ 12 | 13 | # IntelliJ 14 | .idea 15 | *.ipr 16 | *.iml 17 | *.iws 18 | 19 | # NetBeans 20 | nb-configuration.xml 21 | 22 | # Visual Studio Code 23 | .vscode 24 | .factorypath 25 | 26 | # OSX 27 | .DS_Store 28 | 29 | # Vim 30 | *.swp 31 | *.swo 32 | 33 | # patch 34 | *.orig 35 | *.rej 36 | 37 | -------------------------------------------------------------------------------- /apps/todo/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.*; 17 | import java.io.*; 18 | import java.nio.channels.*; 19 | import java.util.Properties; 20 | 21 | public class MavenWrapperDownloader { 22 | 23 | private static final String WRAPPER_VERSION = "0.5.6"; 24 | /** 25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 26 | */ 27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 29 | 30 | /** 31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 32 | * use instead of the default one. 33 | */ 34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 35 | ".mvn/wrapper/maven-wrapper.properties"; 36 | 37 | /** 38 | * Path where the maven-wrapper.jar will be saved to. 39 | */ 40 | private static final String MAVEN_WRAPPER_JAR_PATH = 41 | ".mvn/wrapper/maven-wrapper.jar"; 42 | 43 | /** 44 | * Name of the property which should be used to override the default download url for the wrapper. 45 | */ 46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 47 | 48 | public static void main(String args[]) { 49 | System.out.println("- Downloader started"); 50 | File baseDirectory = new File(args[0]); 51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 52 | 53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 54 | // wrapperUrl parameter. 55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 56 | String url = DEFAULT_DOWNLOAD_URL; 57 | if(mavenWrapperPropertyFile.exists()) { 58 | FileInputStream mavenWrapperPropertyFileInputStream = null; 59 | try { 60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 61 | Properties mavenWrapperProperties = new Properties(); 62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 64 | } catch (IOException e) { 65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 66 | } finally { 67 | try { 68 | if(mavenWrapperPropertyFileInputStream != null) { 69 | mavenWrapperPropertyFileInputStream.close(); 70 | } 71 | } catch (IOException e) { 72 | // Ignore ... 73 | } 74 | } 75 | } 76 | System.out.println("- Downloading from: " + url); 77 | 78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 79 | if(!outputFile.getParentFile().exists()) { 80 | if(!outputFile.getParentFile().mkdirs()) { 81 | System.out.println( 82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 83 | } 84 | } 85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 86 | try { 87 | downloadFileFromURL(url, outputFile); 88 | System.out.println("Done"); 89 | System.exit(0); 90 | } catch (Throwable e) { 91 | System.out.println("- Error downloading"); 92 | e.printStackTrace(); 93 | System.exit(1); 94 | } 95 | } 96 | 97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 99 | String username = System.getenv("MVNW_USERNAME"); 100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 101 | Authenticator.setDefault(new Authenticator() { 102 | @Override 103 | protected PasswordAuthentication getPasswordAuthentication() { 104 | return new PasswordAuthentication(username, password); 105 | } 106 | }); 107 | } 108 | URL website = new URL(urlString); 109 | ReadableByteChannel rbc; 110 | rbc = Channels.newChannel(website.openStream()); 111 | FileOutputStream fos = new FileOutputStream(destination); 112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 113 | fos.close(); 114 | rbc.close(); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /apps/todo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/apps/todo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /apps/todo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /apps/todo/README.md: -------------------------------------------------------------------------------- 1 | # todo-backend project 2 | 3 | This project uses Quarkus, the Supersonic Subatomic Java Framework. 4 | 5 | If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . 6 | 7 | ## Running the application in dev mode 8 | 9 | You can run your application in dev mode that enables live coding using: 10 | ```shell script 11 | ./mvnw compile quarkus:dev 12 | ``` 13 | 14 | ## Packaging and running the application 15 | 16 | The application can be packaged using: 17 | ```shell script 18 | ./mvnw package 19 | ``` 20 | It produces the `todo-backend-1.0.0-runner.jar` file in the `/target` directory. 21 | Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory. 22 | 23 | If you want to build an _über-jar_, execute the following command: 24 | ```shell script 25 | ./mvnw package -Dquarkus.package.type=uber-jar 26 | ``` 27 | 28 | The application is now runnable using `java -jar target/todo-backend-1.0.0-runner.jar`. 29 | 30 | ## Creating a native executable 31 | 32 | You can create a native executable using: 33 | ```shell script 34 | ./mvnw package -Pnative 35 | ``` 36 | 37 | Or, if you don't have GraalVM installed, you can run the native executable build in a container using: 38 | ```shell script 39 | ./mvnw package -Pnative -Dquarkus.native.container-build=true 40 | ``` 41 | 42 | You can then execute your native executable with: `./target/todo-backend-1.0.0-runner` 43 | 44 | If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html. 45 | 46 | # RESTEasy JAX-RS 47 | 48 | Guide: https://quarkus.io/guides/rest-json 49 | 50 | 51 | -------------------------------------------------------------------------------- /apps/todo/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | fi 118 | 119 | if [ -z "$JAVA_HOME" ]; then 120 | javaExecutable="`which javac`" 121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 122 | # readlink(1) is not available as standard on Solaris 10. 123 | readLink=`which readlink` 124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 125 | if $darwin ; then 126 | javaHome="`dirname \"$javaExecutable\"`" 127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 128 | else 129 | javaExecutable="`readlink -f \"$javaExecutable\"`" 130 | fi 131 | javaHome="`dirname \"$javaExecutable\"`" 132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 133 | JAVA_HOME="$javaHome" 134 | export JAVA_HOME 135 | fi 136 | fi 137 | fi 138 | 139 | if [ -z "$JAVACMD" ] ; then 140 | if [ -n "$JAVA_HOME" ] ; then 141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 142 | # IBM's JDK on AIX uses strange locations for the executables 143 | JAVACMD="$JAVA_HOME/jre/sh/java" 144 | else 145 | JAVACMD="$JAVA_HOME/bin/java" 146 | fi 147 | else 148 | JAVACMD="`which java`" 149 | fi 150 | fi 151 | 152 | if [ ! -x "$JAVACMD" ] ; then 153 | echo "Error: JAVA_HOME is not defined correctly." >&2 154 | echo " We cannot execute $JAVACMD" >&2 155 | exit 1 156 | fi 157 | 158 | if [ -z "$JAVA_HOME" ] ; then 159 | echo "Warning: JAVA_HOME environment variable is not set." 160 | fi 161 | 162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 163 | 164 | # traverses directory structure from process work directory to filesystem root 165 | # first directory with .mvn subdirectory is considered project base directory 166 | find_maven_basedir() { 167 | 168 | if [ -z "$1" ] 169 | then 170 | echo "Path not specified to find_maven_basedir" 171 | return 1 172 | fi 173 | 174 | basedir="$1" 175 | wdir="$1" 176 | while [ "$wdir" != '/' ] ; do 177 | if [ -d "$wdir"/.mvn ] ; then 178 | basedir=$wdir 179 | break 180 | fi 181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 182 | if [ -d "${wdir}" ]; then 183 | wdir=`cd "$wdir/.."; pwd` 184 | fi 185 | # end of workaround 186 | done 187 | echo "${basedir}" 188 | } 189 | 190 | # concatenates all lines of a file 191 | concat_lines() { 192 | if [ -f "$1" ]; then 193 | echo "$(tr -s '\n' ' ' < "$1")" 194 | fi 195 | } 196 | 197 | BASE_DIR=`find_maven_basedir "$(pwd)"` 198 | if [ -z "$BASE_DIR" ]; then 199 | exit 1; 200 | fi 201 | 202 | ########################################################################################## 203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 204 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 205 | ########################################################################################## 206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 207 | if [ "$MVNW_VERBOSE" = true ]; then 208 | echo "Found .mvn/wrapper/maven-wrapper.jar" 209 | fi 210 | else 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 213 | fi 214 | if [ -n "$MVNW_REPOURL" ]; then 215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 216 | else 217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 218 | fi 219 | while IFS="=" read key value; do 220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 221 | esac 222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Downloading from: $jarUrl" 225 | fi 226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 227 | if $cygwin; then 228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 229 | fi 230 | 231 | if command -v wget > /dev/null; then 232 | if [ "$MVNW_VERBOSE" = true ]; then 233 | echo "Found wget ... using wget" 234 | fi 235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 236 | wget "$jarUrl" -O "$wrapperJarPath" 237 | else 238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 239 | fi 240 | elif command -v curl > /dev/null; then 241 | if [ "$MVNW_VERBOSE" = true ]; then 242 | echo "Found curl ... using curl" 243 | fi 244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 245 | curl -o "$wrapperJarPath" "$jarUrl" -f 246 | else 247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 248 | fi 249 | 250 | else 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Falling back to using Java to download" 253 | fi 254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 255 | # For Cygwin, switch paths to Windows format before running javac 256 | if $cygwin; then 257 | javaClass=`cygpath --path --windows "$javaClass"` 258 | fi 259 | if [ -e "$javaClass" ]; then 260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 261 | if [ "$MVNW_VERBOSE" = true ]; then 262 | echo " - Compiling MavenWrapperDownloader.java ..." 263 | fi 264 | # Compiling the Java class 265 | ("$JAVA_HOME/bin/javac" "$javaClass") 266 | fi 267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 268 | # Running the downloader 269 | if [ "$MVNW_VERBOSE" = true ]; then 270 | echo " - Running MavenWrapperDownloader.java ..." 271 | fi 272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 273 | fi 274 | fi 275 | fi 276 | fi 277 | ########################################################################################## 278 | # End of extension 279 | ########################################################################################## 280 | 281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 282 | if [ "$MVNW_VERBOSE" = true ]; then 283 | echo $MAVEN_PROJECTBASEDIR 284 | fi 285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 286 | 287 | # For Cygwin, switch paths to Windows format before running java 288 | if $cygwin; then 289 | [ -n "$M2_HOME" ] && 290 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 291 | [ -n "$JAVA_HOME" ] && 292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 293 | [ -n "$CLASSPATH" ] && 294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 295 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 297 | fi 298 | 299 | # Provide a "standardized" way to retrieve the CLI args that will 300 | # work with both Windows and non-Windows executions. 301 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 302 | export MAVEN_CMD_LINE_ARGS 303 | 304 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 305 | 306 | exec "$JAVACMD" \ 307 | $MAVEN_OPTS \ 308 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 309 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 310 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 311 | -------------------------------------------------------------------------------- /apps/todo/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /apps/todo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | io.quarkus.sample 6 | todo-gitops 7 | 1.0.0 8 | 9 | 3.8.1 10 | true 11 | 11 12 | 11 13 | UTF-8 14 | UTF-8 15 | 1.13.7.Final 16 | quarkus-universe-bom 17 | io.quarkus 18 | 1.13.7.Final 19 | 2.22.1 20 | 21 | 22 | 23 | 24 | ${quarkus.platform.group-id} 25 | ${quarkus.platform.artifact-id} 26 | ${quarkus.platform.version} 27 | pom 28 | import 29 | 30 | 31 | 32 | 33 | 34 | io.quarkus 35 | quarkus-resteasy-jsonb 36 | 37 | 38 | io.quarkus 39 | quarkus-smallrye-openapi 40 | 41 | 42 | io.quarkus 43 | quarkus-resteasy 44 | 45 | 46 | io.quarkus 47 | quarkus-hibernate-orm-panache 48 | 49 | 50 | io.quarkus 51 | quarkus-jdbc-postgresql 52 | 53 | 54 | io.quarkus 55 | quarkus-jdbc-h2 56 | 57 | 58 | io.quarkus 59 | quarkus-arc 60 | 61 | 62 | io.quarkus 63 | quarkus-junit5 64 | test 65 | 66 | 67 | io.rest-assured 68 | rest-assured 69 | test 70 | 71 | 72 | io.quarkus 73 | quarkus-container-image-jib 74 | 75 | 76 | io.quarkus 77 | quarkus-smallrye-graphql 78 | 79 | 80 | 81 | 82 | 83 | io.quarkus 84 | quarkus-maven-plugin 85 | ${quarkus-plugin.version} 86 | 87 | 88 | 89 | build 90 | generate-code 91 | generate-code-tests 92 | 93 | 94 | 95 | 96 | 97 | maven-compiler-plugin 98 | ${compiler-plugin.version} 99 | 100 | 101 | maven-surefire-plugin 102 | ${surefire-plugin.version} 103 | 104 | 105 | org.jboss.logmanager.LogManager 106 | ${maven.home} 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | native 115 | 116 | 117 | native 118 | 119 | 120 | 121 | 122 | 123 | maven-failsafe-plugin 124 | ${surefire-plugin.version} 125 | 126 | 127 | 128 | integration-test 129 | verify 130 | 131 | 132 | 133 | ${project.build.directory}/${project.build.finalName}-runner 134 | org.jboss.logmanager.LogManager 135 | ${maven.home} 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | native 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /apps/todo/src/main/docker/Dockerfile.jvm: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode 3 | # 4 | # Before building the docker image run: 5 | # 6 | # mvn package 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.jvm -t quarkus/todo-backend-jvm . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/todo-backend-jvm 15 | # 16 | ### 17 | FROM adoptopenjdk/openjdk14:ubi-slim 18 | ENV JAVA_OPTIONS=-Dquarkus.http.host=0.0.0.0 19 | COPY target/lib/* /deployments/lib/ 20 | COPY target/*-runner.jar /deployments/app.jar 21 | ENTRYPOINT [ "/deployments/run-java.sh" ] -------------------------------------------------------------------------------- /apps/todo/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the docker image run: 5 | # 6 | # mvn package -Pnative -Dnative-image.docker-build=true 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/todo-backend . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/todo-backend 15 | # 16 | ### 17 | FROM registry.fedoraproject.org/fedora-minimal 18 | WORKDIR /work/ 19 | COPY target/*-runner /work/application 20 | RUN chmod 775 /work 21 | EXPOSE 8080 22 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] -------------------------------------------------------------------------------- /apps/todo/src/main/java/io/quarkus/sample/Todo.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.sample; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.validation.constraints.NotBlank; 8 | import java.util.List; 9 | 10 | @Entity 11 | public class Todo extends PanacheEntity { 12 | 13 | @NotBlank 14 | @Column(unique = true) 15 | public String title; 16 | 17 | public boolean completed; 18 | 19 | @Column(name = "ordering") 20 | public int order; 21 | 22 | public String url; 23 | 24 | public static List findNotCompleted() { 25 | return list("completed", false); 26 | } 27 | 28 | public static List findCompleted() { 29 | return list("completed", true); 30 | } 31 | 32 | public static long deleteCompleted() { 33 | return delete("completed", true); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /apps/todo/src/main/java/io/quarkus/sample/TodoApplication.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.sample; 2 | 3 | import javax.ws.rs.core.Application; 4 | import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition; 5 | import org.eclipse.microprofile.openapi.annotations.info.Contact; 6 | import org.eclipse.microprofile.openapi.annotations.info.Info; 7 | import org.eclipse.microprofile.openapi.annotations.info.License; 8 | 9 | @OpenAPIDefinition( 10 | info = @Info( 11 | title="TODOS API", 12 | version = "1.0.0", 13 | contact = @Contact( 14 | name = "TODOS API Support", 15 | url = "http://todos.com/contact", 16 | email = "techsupport@todos.com"), 17 | license = @License( 18 | name = "Apache 2.0", 19 | url = "http://www.apache.org/licenses/LICENSE-2.0.html")) 20 | ) 21 | public class TodoApplication extends Application { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /apps/todo/src/main/java/io/quarkus/sample/TodoGraphQLEndpoint.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.sample; 2 | 3 | import io.quarkus.panache.common.Sort; 4 | 5 | import javax.validation.Valid; 6 | import java.util.List; 7 | import org.eclipse.microprofile.graphql.Description; 8 | import org.eclipse.microprofile.graphql.GraphQLApi; 9 | import org.eclipse.microprofile.graphql.Mutation; 10 | import org.eclipse.microprofile.graphql.Query; 11 | 12 | @GraphQLApi 13 | public class TodoGraphQLEndpoint { 14 | 15 | @Query 16 | @Description("Get all the todos") 17 | public List getAllTodos() { 18 | return Todo.listAll(Sort.by("order")); 19 | } 20 | 21 | @Query 22 | @Description("Get a specific todo by id") 23 | public Todo getTodo(Long id) { 24 | return Todo.findById(id); 25 | } 26 | 27 | @Mutation 28 | @Description("Create a new todo") 29 | public Todo create(@Valid Todo item) { 30 | item.persist(); 31 | return item; 32 | } 33 | 34 | @Mutation 35 | @Description("Update an exiting todo") 36 | public Todo update(@Valid Todo todo, Long id) { 37 | Todo entity = Todo.findById(id); 38 | entity.id = id; 39 | entity.completed = todo.completed; 40 | entity.order = todo.order; 41 | entity.title = todo.title; 42 | entity.url = todo.url; 43 | return entity; 44 | } 45 | 46 | @Mutation 47 | @Description("Remove all completed todos") 48 | public List deleteCompleted() { 49 | List completed = Todo.findCompleted(); 50 | Todo.deleteCompleted(); 51 | return completed; 52 | } 53 | 54 | @Mutation 55 | @Description("Delete a specific todo") 56 | public Todo deleteTodo(Long id) { 57 | Todo entity = Todo.findById(id); 58 | if (entity == null) { 59 | return null; 60 | } 61 | entity.delete(); 62 | return entity; 63 | } 64 | } -------------------------------------------------------------------------------- /apps/todo/src/main/java/io/quarkus/sample/TodoResource.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.sample; 2 | 3 | import io.quarkus.panache.common.Sort; 4 | 5 | import javax.transaction.Transactional; 6 | import javax.validation.Valid; 7 | import javax.ws.rs.*; 8 | import javax.ws.rs.core.MediaType; 9 | import javax.ws.rs.core.Response; 10 | import javax.ws.rs.core.Response.Status; 11 | import java.util.List; 12 | 13 | import org.eclipse.microprofile.config.inject.ConfigProperty; 14 | import org.eclipse.microprofile.openapi.annotations.Operation; 15 | import org.eclipse.microprofile.openapi.annotations.tags.Tag; 16 | 17 | @Path("/api") 18 | @Produces(MediaType.APPLICATION_JSON) 19 | @Consumes(MediaType.APPLICATION_JSON) 20 | @Tag(name = "Todo Resource", description = "All Todo Operations") 21 | public class TodoResource { 22 | 23 | @ConfigProperty(name = "worker.cloud.id", defaultValue = "unknown") 24 | String cloudId; 25 | 26 | @OPTIONS 27 | @Operation(hidden = true) 28 | public Response opt() { 29 | return Response.ok().build(); 30 | } 31 | 32 | @GET 33 | @Operation(description = "Get all the todos") 34 | public List getAll() { 35 | return Todo.listAll(Sort.by("order")); 36 | } 37 | 38 | @GET 39 | @Path("/cloud") 40 | @Produces(MediaType.TEXT_PLAIN) 41 | @Operation(description = "Gets Cloud Id") 42 | public String getCloudId() { 43 | return cloudId; 44 | } 45 | 46 | @GET 47 | @Path("/{id}") 48 | @Operation(description = "Get a specific todo by id") 49 | public Todo getOne(@PathParam("id") Long id) { 50 | Todo entity = Todo.findById(id); 51 | if (entity == null) { 52 | throw new WebApplicationException("Todo with id of " + id + " does not exist.", Status.NOT_FOUND); 53 | } 54 | return entity; 55 | } 56 | 57 | @POST 58 | @Transactional 59 | @Operation(description = "Create a new todo") 60 | public Response create(@Valid Todo item) { 61 | item.persist(); 62 | return Response.status(Status.CREATED).entity(item).build(); 63 | } 64 | 65 | @PATCH 66 | @Path("/{id}") 67 | @Transactional 68 | @Operation(description = "Update an exiting todo") 69 | public Response update(@Valid Todo todo, @PathParam("id") Long id) { 70 | Todo entity = Todo.findById(id); 71 | entity.id = id; 72 | entity.completed = todo.completed; 73 | entity.order = todo.order; 74 | entity.title = todo.title; 75 | entity.url = todo.url; 76 | return Response.ok(entity).build(); 77 | } 78 | 79 | @DELETE 80 | @Transactional 81 | @Operation(description = "Remove all completed todos") 82 | public Response deleteCompleted() { 83 | Todo.deleteCompleted(); 84 | return Response.noContent().build(); 85 | } 86 | 87 | @DELETE 88 | @Transactional 89 | @Path("/{id}") 90 | @Operation(description = "Delete a specific todo") 91 | public Response deleteOne(@PathParam("id") Long id) { 92 | Todo entity = Todo.findById(id); 93 | if (entity == null) { 94 | throw new WebApplicationException("Todo with id of " + id + " does not exist.", Status.NOT_FOUND); 95 | } 96 | entity.delete(); 97 | return Response.noContent().build(); 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/openshift-postgres-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: postgresql 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | matchLabels: 12 | app: postgresql 13 | template: 14 | metadata: 15 | labels: 16 | app: postgresql 17 | spec: 18 | containers: 19 | - name: postgresql 20 | image: quay.io/redhatdemo/openshift-pgsql12-primary:centos7 21 | imagePullPolicy: Always 22 | ports: 23 | - name: tcp 24 | containerPort: 5432 25 | env: 26 | - name: PG_USER_PASSWORD 27 | value: admin 28 | - name: PG_USER_NAME 29 | value: admin 30 | - name: PG_DATABASE 31 | value: todo 32 | - name: PG_NETWORK_MASK 33 | value: all 34 | 35 | -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/openshift-postgres-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: postgresql 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | app: postgresql 12 | ports: 13 | - name: pgsql 14 | port: 5432 15 | targetPort: 5432 -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/openshift-todo-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "Service" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | annotations: 10 | argocd.argoproj.io/sync-wave: "2" 11 | namespace: todo 12 | spec: 13 | ports: 14 | - name: "http" 15 | port: 8080 16 | targetPort: 8080 17 | selector: 18 | app.kubernetes.io/name: "todo-gitops" 19 | app.kubernetes.io/version: "1.0.0" -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/postgresql-create-table.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: todo-table 5 | namespace: todo 6 | annotations: 7 | argocd.argoproj.io/sync-wave: "1" 8 | spec: 9 | ttlSecondsAfterFinished: 100 10 | template: 11 | spec: 12 | containers: 13 | - name: postgresql-client 14 | image: postgres:12 15 | imagePullPolicy: Always 16 | env: 17 | - name: PGPASSWORD 18 | value: admin 19 | command: ["psql"] 20 | args: 21 | [ 22 | "--host=postgresql", 23 | "--username=admin", 24 | "--no-password", 25 | "--dbname=todo", 26 | "--command=create table Todo (id bigint not null,completed boolean not null,ordering integer,title varchar(255),url varchar(255),primary key (id));create sequence hibernate_sequence start with 1 increment by 1;", 27 | ] 28 | restartPolicy: Never 29 | backoffLimit: 1 -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/postgresql-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: postgresql 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | matchLabels: 12 | app: postgresql 13 | template: 14 | metadata: 15 | labels: 16 | app: postgresql 17 | spec: 18 | containers: 19 | - name: postgresql 20 | image: postgres:12 21 | imagePullPolicy: Always 22 | ports: 23 | - name: tcp 24 | containerPort: 5432 25 | env: 26 | - name: POSTGRES_PASSWORD 27 | value: admin 28 | - name: POSTGRES_USER 29 | value: admin 30 | - name: POSTGRES_DB 31 | value: todo -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/postgresql-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: postgres 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | app: postgresql 12 | ports: 13 | - name: pgsql 14 | port: 5432 15 | targetPort: 5432 -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/todo-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "ServiceAccount" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | namespace: todo 10 | annotations: 11 | argocd.argoproj.io/sync-wave: "2" 12 | --- 13 | apiVersion: "apps/v1" 14 | kind: "Deployment" 15 | metadata: 16 | labels: 17 | app.kubernetes.io/name: "todo-gitops" 18 | app.kubernetes.io/version: "1.0.0" 19 | name: "todo-gitops" 20 | namespace: todo 21 | annotations: 22 | argocd.argoproj.io/sync-wave: "2" 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app.kubernetes.io/name: "todo-gitops" 28 | app.kubernetes.io/version: "1.0.0" 29 | template: 30 | metadata: 31 | labels: 32 | app.kubernetes.io/name: "todo-gitops" 33 | app.kubernetes.io/version: "1.0.0" 34 | spec: 35 | containers: 36 | - env: 37 | - name: "KUBERNETES_NAMESPACE" 38 | valueFrom: 39 | fieldRef: 40 | fieldPath: "metadata.namespace" 41 | image: "quay.io/rhdevelopers/todo-gitops:1.0.0" 42 | imagePullPolicy: "Always" 43 | name: "todo-gitops" 44 | ports: 45 | - containerPort: 8080 46 | name: "http" 47 | protocol: "TCP" 48 | serviceAccount: "todo-gitops" -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/todo-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: todo 5 | namespace: todo 6 | annotations: 7 | argocd.argoproj.io/sync-wave: "3" 8 | spec: 9 | rules: 10 | - host: todo.devnation 11 | http: 12 | paths: 13 | - path: / 14 | pathType: Prefix 15 | backend: 16 | service: 17 | name: todo-gitops 18 | port: 19 | number: 8080 -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/todo-insert-data.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: todo-insert 5 | annotations: 6 | argocd.argoproj.io/hook: PostSync 7 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 8 | spec: 9 | ttlSecondsAfterFinished: 100 10 | template: 11 | spec: 12 | containers: 13 | - name: httpie 14 | image: alpine/httpie:2.4.0 15 | imagePullPolicy: Always 16 | command: ["http"] 17 | args: 18 | [ 19 | "POST", 20 | "todo-gitops:8080/api", 21 | "title=Finish ArgoCD tutorial", 22 | "--ignore-stdin" 23 | ] 24 | restartPolicy: Never 25 | backoffLimit: 1 -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/todo-route.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: route.openshift.io/v1 2 | kind: Route 3 | metadata: 4 | labels: 5 | app: todo 6 | name: todo 7 | namespace: todo 8 | annotations: 9 | argocd.argoproj.io/sync-wave: "3" 10 | spec: 11 | port: 12 | targetPort: 8080 13 | to: 14 | kind: Service 15 | name: todo-gitops 16 | weight: 100 -------------------------------------------------------------------------------- /apps/todo/src/main/kubernetes/todo-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "Service" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | annotations: 10 | argocd.argoproj.io/sync-wave: "2" 11 | namespace: todo 12 | spec: 13 | ports: 14 | - name: "http" 15 | port: 8080 16 | targetPort: 8080 17 | selector: 18 | app.kubernetes.io/name: "todo-gitops" 19 | app.kubernetes.io/version: "1.0.0" 20 | type: "NodePort" -------------------------------------------------------------------------------- /apps/todo/src/main/resources/META-INF/resources/js/app.js: -------------------------------------------------------------------------------- 1 | /*global Vue, todoStorage */ 2 | (function (exports) { 3 | 4 | 'use strict'; 5 | 6 | var filters = { 7 | all: function (todos) { 8 | return todos; 9 | }, 10 | active: function (todos) { 11 | return todos.filter(function (todo) { 12 | return !todo.completed; 13 | }); 14 | }, 15 | completed: function (todos) { 16 | return todos.filter(function (todo) { 17 | return todo.completed; 18 | }); 19 | } 20 | }; 21 | 22 | exports.app = new Vue({ 23 | 24 | // the root element that will be compiled 25 | el: '.todoapp', 26 | 27 | // app initial state 28 | data: { 29 | todos: [], 30 | newTodo: '', 31 | editedTodo: null, 32 | visibility: 'all', 33 | currentCloud: '', 34 | }, 35 | 36 | computed: { 37 | filteredTodos: function () { 38 | return filters[this.visibility](this.todos); 39 | }, 40 | remaining: function () { 41 | return filters.active(this.todos).length; 42 | }, 43 | allDone: { 44 | get: function () { 45 | return this.remaining === 0; 46 | }, 47 | set: function (value) { 48 | this.todos.forEach(function (todo) { 49 | todo.completed = value; 50 | }); 51 | } 52 | } 53 | }, 54 | 55 | methods: { 56 | 57 | pluralize: function (word, count) { 58 | return word + (count === 1 ? '' : 's'); 59 | }, 60 | 61 | addTodo: async function () { 62 | var value = this.newTodo && this.newTodo.trim(); 63 | if (!value) { 64 | return; 65 | } 66 | 67 | const item = await todoStorage.add({ 68 | title : value, 69 | order: this.todos.length + 1, 70 | completed: false 71 | }); 72 | this.todos.push(item); 73 | this.currentCloud = await todoStorage.fetchcloud() 74 | this.newTodo = ''; 75 | }, 76 | 77 | removeTodo: async function (todo) { 78 | await todoStorage.delete(todo); 79 | await this.reload(); 80 | }, 81 | 82 | toggleTodo: function (todo) { 83 | todo.completed = ! todo.completed; 84 | todoStorage.save(todo); 85 | }, 86 | 87 | editTodo: async function (todo) { 88 | this.beforeEditCache = todo.title; 89 | this.editedTodo = todo; 90 | }, 91 | 92 | doneEdit: function (todo) { 93 | if (!this.editedTodo) { 94 | return; 95 | } 96 | this.editedTodo = null; 97 | todo.title = todo.title.trim(); 98 | if (!todo.title) { 99 | this.removeTodo(todo); 100 | } else { 101 | todoStorage.save(todo); 102 | } 103 | }, 104 | 105 | cancelEdit: function (todo) { 106 | this.editedTodo = null; 107 | todo.title = this.beforeEditCache; 108 | }, 109 | 110 | removeCompleted: async function () { 111 | await todoStorage.deleteCompleted(); 112 | await this.reload(); 113 | }, 114 | 115 | reload: async function () { 116 | const data = await todoStorage.fetch(); 117 | app.todos = data; 118 | } 119 | }, 120 | 121 | // a custom directive to wait for the DOM to be updated 122 | // before focusing on the input field. 123 | // http://vuejs.org/guide/custom-directive.html 124 | directives: { 125 | 'todo-focus': function (el, binding) { 126 | if (binding.value) { 127 | el.focus(); 128 | } 129 | } 130 | }, 131 | 132 | mounted : async function() { 133 | this.reload(); 134 | } 135 | }); 136 | 137 | })(window); -------------------------------------------------------------------------------- /apps/todo/src/main/resources/META-INF/resources/js/routes.js: -------------------------------------------------------------------------------- 1 | /*global app, Router */ 2 | 3 | (function (app, Router) { 4 | 5 | 'use strict'; 6 | 7 | var router = new Router(); 8 | 9 | ['all', 'active', 'completed'].forEach(function (visibility) { 10 | router.on(visibility, function () { 11 | app.visibility = visibility; 12 | }); 13 | }); 14 | 15 | router.configure({ 16 | notfound: function () { 17 | window.location.hash = ''; 18 | app.visibility = 'all'; 19 | } 20 | }); 21 | 22 | router.init(); 23 | 24 | })(app, Router); 25 | -------------------------------------------------------------------------------- /apps/todo/src/main/resources/META-INF/resources/js/store.js: -------------------------------------------------------------------------------- 1 | /*jshint unused:false */ 2 | 3 | (function (exports) { 4 | 5 | 'use strict'; 6 | // axios.defaults.baseURL = 'http://todo-backend:8080/'; 7 | 8 | var serverUrl = 'api/'; 9 | 10 | exports.todoStorage = { 11 | fetch: async function () { 12 | const response = await axios.get(serverUrl); 13 | console.log(response.data); 14 | return response.data; 15 | }, 16 | add : async function(item) { 17 | console.log("Adding todo item " + item.title); 18 | return (await axios.post(serverUrl, item)).data; 19 | }, 20 | save: async function (item) { 21 | console.log("save called with", item); 22 | await axios.patch(serverUrl + item.id, item); 23 | }, 24 | delete: async function(item) { 25 | await axios.delete(serverUrl + item.id); 26 | }, 27 | deleteCompleted: async function() { 28 | await axios.delete(serverUrl); 29 | }, 30 | fetchcloud: async function () { 31 | const response = await axios.get(serverUrl + "cloud"); 32 | console.log("Fetched Cloud" + response.data); 33 | return response.data; 34 | } 35 | }; 36 | 37 | })(window); 38 | -------------------------------------------------------------------------------- /apps/todo/src/main/resources/META-INF/resources/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "dependencies": { 4 | "director": "^1.2.0", 5 | "vue": "^2.1.8", 6 | "vue-axios": "^2.1.4", 7 | "todomvc-common": "^1.0.1", 8 | "todomvc-app-css": "^2.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/todo/src/main/resources/META-INF/resources/quarkus_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/apps/todo/src/main/resources/META-INF/resources/quarkus_icon.png -------------------------------------------------------------------------------- /apps/todo/src/main/resources/META-INF/resources/todo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue.js • TodoMVC 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |

todos

14 | 15 |
16 |
17 | 18 | 19 |
    20 |
  • 21 |
    22 | 23 | 24 | 25 |
    26 | 27 |
  • 28 |
29 |
30 |
31 | 32 | {{pluralize('item', remaining)}} left 33 | 34 | 40 | 43 |
44 |
45 | 46 | 47 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /apps/todo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Configuration file 2 | # key = value 3 | 4 | %dev.quarkus.datasource.db-kind=h2 5 | %dev.quarkus.datasource.username=sa 6 | %dev.quarkus.datasource.password= 7 | %dev.quarkus.datasource.jdbc.url=jdbc:h2:mem:todo 8 | %dev.quarkus.hibernate-orm.database.generation=update 9 | 10 | quarkus.http.port=8080 11 | quarkus.datasource.db-kind=postgresql 12 | quarkus.datasource.username=admin 13 | quarkus.datasource.password=admin 14 | quarkus.datasource.jdbc.url=jdbc:postgresql://postgresql:5432/todo 15 | quarkus.hibernate-orm.database.generation=none 16 | 17 | quarkus.hibernate-orm.log.sql=true 18 | 19 | quarkus.swagger-ui.always-include=true 20 | 21 | quarkus.container-image.group=rhdevelopers 22 | quarkus.container-image.registry=quay.io -------------------------------------------------------------------------------- /apps/todo/src/test/java/io/quarkus/sample/NativeTodoResourceIT.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.sample; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeTodoResourceIT extends TodoResourceTest { 7 | 8 | // Execute the same tests but in native mode. 9 | } -------------------------------------------------------------------------------- /apps/todo/src/test/java/io/quarkus/sample/TodoResourceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.sample; 2 | 3 | import java.util.stream.Stream; 4 | 5 | import io.quarkus.test.junit.QuarkusTest; 6 | import io.restassured.http.ContentType; 7 | import org.junit.jupiter.api.MethodOrderer; 8 | import org.junit.jupiter.api.Order; 9 | import org.junit.jupiter.api.Test; 10 | import org.junit.jupiter.api.TestMethodOrder; 11 | import org.junit.jupiter.params.ParameterizedTest; 12 | import org.junit.jupiter.params.provider.Arguments; 13 | import org.junit.jupiter.params.provider.MethodSource; 14 | 15 | import static io.restassured.RestAssured.given; 16 | import static org.hamcrest.CoreMatchers.is; 17 | 18 | @QuarkusTest 19 | @TestMethodOrder(MethodOrderer.OrderAnnotation.class) 20 | public class TodoResourceTest { 21 | 22 | @Test @Order(1) 23 | public void testGetAll() { 24 | given() 25 | .accept(ContentType.JSON) 26 | .when() 27 | .get("/api") 28 | .then() 29 | .statusCode(200) 30 | .body(is(ALL)); 31 | } 32 | 33 | @Test @Order(2) 34 | public void testGet() { 35 | given() 36 | .accept(ContentType.JSON) 37 | .when() 38 | .get("/api/1") 39 | .then() 40 | .statusCode(200) 41 | .body(is(ONE)); 42 | } 43 | 44 | @Test @Order(3) 45 | public void testCreateNew() { 46 | given() 47 | .contentType(ContentType.JSON) 48 | .when() 49 | .body(CREATE_NEW) 50 | .post("/api") 51 | .then() 52 | .statusCode(201) 53 | .body(is(NEW_CREATED)); 54 | } 55 | 56 | @Test @Order(4) 57 | public void testUpdate() { 58 | given() 59 | .contentType(ContentType.JSON) 60 | .when() 61 | .body(UPDATE) 62 | .patch("/api/5") 63 | .then() 64 | .statusCode(200) 65 | .body(is(UPDATED)); 66 | } 67 | 68 | @ParameterizedTest @Order(5) 69 | @MethodSource("todoItemsToDelete") 70 | public void testDelete(int id, int expectedStatus) { 71 | given() 72 | .pathParam("id", id) 73 | .when() 74 | .delete("/api/{id}") 75 | .then() 76 | .statusCode(expectedStatus); 77 | } 78 | 79 | private static Stream todoItemsToDelete() { 80 | return Stream.of( 81 | Arguments.of(5, 204), 82 | Arguments.of(15, 404) 83 | ); 84 | } 85 | 86 | private static final String ALL = "[{\"id\":1,\"completed\":true,\"order\":0,\"title\":\"Introduction to Quarkus\"},{\"id\":2,\"completed\":false,\"order\":1,\"title\":\"Hibernate with Panache\"},{\"id\":3,\"completed\":false,\"order\":2,\"title\":\"Visit Quarkus web site\",\"url\":\"https://quarkus.io\"},{\"id\":4,\"completed\":false,\"order\":3,\"title\":\"Star Quarkus project\",\"url\":\"https://github.com/quarkusio/quarkus/\"}]"; 87 | 88 | private static final String ONE = "{\"id\":1,\"completed\":true,\"order\":0,\"title\":\"Introduction to Quarkus\"}"; 89 | 90 | private static final String CREATE_NEW = "{\"completed\":false,\"order\":0,\"title\":\"Use the REST Endpoint\"}"; 91 | 92 | private static final String NEW_CREATED = "{\"id\":5,\"completed\":false,\"order\":0,\"title\":\"Use the REST Endpoint\"}"; 93 | 94 | private static final String UPDATE = "{\"id\":5,\"completed\":false,\"order\":0,\"title\":\"Use the GraphQL Endpoint\"}"; 95 | 96 | private static final String UPDATED = "{\"id\":5,\"completed\":false,\"order\":0,\"title\":\"Use the GraphQL Endpoint\"}"; 97 | } -------------------------------------------------------------------------------- /apps/todo/token.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | data: 3 | ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURGVENDQWYyZ0F3SUJBZ0lRUUxmajRSLzBUVmw4NEZqWDkyc29mREFOQmdrcWhraUc5dzBCQVFzRkFEQWUKTVJ3d0dnWURWUVFERXhOemEzVndjR1Z5TFdsdWRHVnlibUZzTFdOaE1CNFhEVEl3TVRFeU5ERTBNakl4TWxvWApEVEkxTVRFeU16RTBNakl4TWxvd0hqRWNNQm9HQTFVRUF4TVRjMnQxY0hCbGNpMXBiblJsY201aGJDMWpZVENDCkFTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTmFBTEJaR3NoeVlHUUdxcll6bkIxb0EKL2J4eEVGTlgxNzFBSGRJQ0IwSVFnU0NWa09BWldSNDVxVUdLUzIyVnh0eEVXa2x2N3BCR0NyT2dtSVM5WkNCeApxazdhbEp5Y2FTanU5bGJTSWRnYVJsSHJJcFhjK0lJb1BLdElmVndMUXJHb1RXVDMwaWM5cXFpcHNBaEdncFBRCmErVitFbk55Wk8xei8zay9oaStLdGN3S0preXdqUmF0b2E1TVBYOUNXcStQRXk0QzQ4a1RZVWQxUmhVakJydFkKa0VDMFlsR3dQS1ZsQnBCUmRDM25SVHNJZU9ycFJuQmhPcFJQb1d6UzYrWWo2bXliRDA4c0h1OTJTaVB2NTBmZwo4OGZ0S1JWUnFwSm9JZ2lFYU5zZ1pCRUNQeWdNbmczZEVzb3BJc3c3azhTM0dkZlBabHZsajRiSFJKS2hRNkVDCkF3RUFBYU5QTUUwd0RnWURWUjBQQVFIL0JBUURBZ0trTUIwR0ExVWRKUVFXTUJRR0NDc0dBUVVGQndNQkJnZ3IKQmdFRkJRY0RBakFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQXNHQTFVZEVRUUVNQUtDQURBTkJna3Foa2lHOXcwQgpBUXNGQUFPQ0FRRUFGbm1zZjJFU2FpbDJGYUJkSzV3bzRtLzM3UlRyVEdDQ2hYMjZWckdPN1I5eEE0blVrRVpvCjlRMnBoOGxqZUIxWlByY1ZORG1sQjlNejZsazV6cGNxb1Q2N3NEZEE5Q2JZNEpsOTdUNStVZzh1MTlWdnF5UjIKRHVxdlNRUEN4MWlzTm9mRVNVSWtIQnhkRUpNeGxISTZWZ0tNaVBRNVNidTlUbDJWUkV6OGFpRnVlQk1nSDV5eAp3d1pxZHNsOVdpdXp1bWFqRDJRazY0S3c2aFRNMUQwbk10Q1V2T2ZoTitQRVllZ1h6dzMvZnVhcHdyUTQ1cFFlCnp1R1ZzcFhGNmVVemxiMUg2Rzh4NklUQS9NcWtFbXRiUUpIUEp1emsySUJlWFZoNEczalZwbVlRdkVYalg5ZVMKM1ExM2VZOU5kQUVnR2IvRm5MZVJ5T00wL0lON1lrdmx2UT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K 4 | tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURhakNDQWxLZ0F3SUJBZ0lRTUJad1QrYURDdHVoa0xSYXg4V0NzekFOQmdrcWhraUc5dzBCQVFzRkFEQWUKTVJ3d0dnWURWUVFERXhOemEzVndjR1Z5TFdsdWRHVnlibUZzTFdOaE1CNFhEVEl3TVRFeU5qRXpNalV6T1ZvWApEVEkxTVRFeU5URXpNalV6T1Zvd0VqRVFNQTRHQTFVRUF4TUhjMnQxY0hCbGNqQ0NBU0l3RFFZSktvWklodmNOCkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQkFMTEJlSjBBY0xzeTZGZmlzRlBoS3BRcG83NldESUN2NHdES2Z4b1MKOTZWY1phend0cUpnTy9kSEs3bmlvaU91YS8zUGZ5Tkw4ZmxacUQyTFc1RkVIT3o4TU9YTTdyaTFxOElBRG9FRQp3ZEhWWDUzclBDVGJLY1B0TTJzWWtCYWtPUnpRc0ZQdFo1RGg1R1RVcmNEb2tlYzJReGtZNlhyLzltZCtHWWVqCkJXbW44NVEwN3lKN0xkck9IeEtKK1BRSFFyZGhOTmhldFd1SC84WFVIdEtwaXJHdVJ5VnBLMHd3TEV2VjlzdmoKbloweHVKeU5RcnJFeWpnWHUxUU5SbjBONXg3WkZMRTN5ODhwdDMxTU9zdW1XVzY5M0VsNXFaSlpvSmpGS0ZwTApGOXBGT1NGRjdvSEhkK0hMTEwvK0ZyL2NFSTNlUG5sRnVNWGhmdVNHNk5rcHEzY0NBd0VBQWFPQnJ6Q0JyREFPCkJnTlZIUThCQWY4RUJBTUNCYUF3SFFZRFZSMGxCQll3RkFZSUt3WUJCUVVIQXdFR0NDc0dBUVVGQndNQ01Bd0cKQTFVZEV3RUIvd1FDTUFBd2JRWURWUjBSQkdZd1pJSXNjMnQxY0hCbGNpMWxaR2RsTFhSdlpHOHVZWEJ3Y3k1dgpjR1Z1YzJocFpuUXVjMjkwYjJkamNDNWpiMjJDTkhOcmRYQndaWEl0YVc1MFpYSXRjbTkxZEdWeUxYUnZaRzh1CllYQndjeTV2Y0dWdWMyaHBablF1YzI5MGIyZGpjQzVqYjIwd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFIMkoKdkxvSEExTHdDVE1oUzJiaEdpTkdnbGhldDVVVmYvOEZNd2RzM2NiQUdQR2x5bjVkRUR4YzdVNGpGQ204RnlsRwoxVzdPcHQ0U1ZBalMxbGlkOG1pMEcxb3RKQ3NJL1Q2Q2FWQ3B2cFVhZmNld3RoMWx4VnE1QWMvbVdxZFRJQk9ECml3WlZSdnZRYXpOdG12cXBWblYzTTV3UlZ4aHNHVjFqYTV3dFdpb0ZEcHRmUllSTERJZXNlMlhNMkxOaStoYjAKUk5Nbjk3bWREUHVSVlUrcHRDa05OdWNXQ1VBRVdLZEZFbnhNWit6bm9CUW14cHkwWFA5R2M1S0ZGMS9WaWt1SwplZmt4WkpQRkc0SFM1cmROQlNpUGtWY3k1bmlwUXVSWHptNzNieVA1eWdCRVVDdzNRaGpYamoxM0ZvNXBtNCtUClBMbno3SkMxckFObFNhcnZydDQ9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K 5 | tls.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVBc3NGNG5RQnd1ekxvVitLd1UrRXFsQ21qdnBZTWdLL2pBTXAvR2hMM3BWeGxyUEMyCm9tQTc5MGNydWVLaUk2NXIvYzkvSTB2eCtWbW9QWXRia1VRYzdQd3c1Y3p1dUxXcndnQU9nUVRCMGRWZm5lczgKSk5zcHcrMHpheGlRRnFRNUhOQ3dVKzFua09Ia1pOU3R3T2lSNXpaREdSanBldi8yWjM0Wmg2TUZhYWZ6bERUdgpJbnN0MnM0ZkVvbjQ5QWRDdDJFMDJGNjFhNGYveGRRZTBxbUtzYTVISldrclREQXNTOVgyeStPZG5URzRuSTFDCnVzVEtPQmU3VkExR2ZRM25IdGtVc1RmTHp5bTNmVXc2eTZaWmJyM2NTWG1wa2xtZ21NVW9Xa3NYMmtVNUlVWHUKZ2NkMzRjc3N2LzRXdjl3UWpkNCtlVVc0eGVGKzVJYm8yU21yZHdJREFRQUJBb0lCQUV5Y2pzejdPMVYvNUFTRwpxM3ZIclRBRENLTE9QRjJMQklkNlFpOHlvZURGVU81bDNHQ0xUaWdVNExDeWFUdFJyZ2NCdjBPcGNQT2xjVzJ2CkpIZUY4YisvOWxVSEYra2lNNUxaNDExNFpIbENNZERFMk9vUzVEdU1sZFQ0bWdpYUtjQW4wT3FuZlJPalBQZmEKRHYzMnIxR2c5L0R4dEY5N0JHZ21xMXB1akF0VHNISmhFWDU2a0tQOGE2ZkE4WHkxdkhMd0JCQmNFRUt1QmpONgpGbUd5dXFvMDFnbGJ4UHRLZFNBY1I5UTBEelozNDVZSjBsQk1ydXM3QlluRTVXSG93ODIwR0RORkd2ZTRWN3NJClhXTVlQQVU0aSsvZzhpTjVNT29HY0k1b3p6S3hxL2xRTkNyUWNkSDJpN1hPaUlFb21IbDVZOUxDY2Y4ZHprUHQKSUM2eko4RUNnWUVBNGpQOVl6TkJpeHB6L3NPTlliMWNHdWFOMXVaL0hmeUcySmp1NGE1REt4ajBKR3RDQUs1Qgo2cWRGQzg3V29rMzNYdGFIM2EwaTZ0dXp3ckdqdVJsV2V1U1hJb1VQdk5sdEJJUUo3RmpFWmFyemhleVNQM1duCnFoVnI3YjNUMWF1eUp0cmVyS3BvUXFQV2FYZm52ckhFMSthZlVkVlAreE1nclpBMEpXZldCelVDZ1lFQXlrMTIKMzVJVHpUTktjL20xYW1TY2ZVT3lhMGpidUxHWElPUWYvWWJsYkJlL1QzQ1JEV01ZTFpGekszQ1ZYMEJKNzN2Mgo0YmRpY2RobUp0RnJZZ1JLRXJRWTZpaGp0OGk0SEUyZWlkZUdkQjI1YVN1M016MmZMeU5CRWl3OVBiUEhwNENNCjUxUHdlNVR3VmhjUm5yWVM1NDN0Z1NDN0plQ3d6UEJUNUlLNUFYc0NnWUF6bU5KU24yMXk4bXpGRHd3ZjRGYXoKR0NZQWdBRTg4TTQ5ZDl6OWc0ZDB2RE5zWHo3bDh0bThVYjFSTFRRT1A2U09jSGI3WExQYlNKUWZjKys1bUFyKwo2MGVDSzBIa3ZOKytLUFF1Z2kwQ1Y5VkdsaWpoNnM5ODMzZ0grY1hwTmtuanpRYi84YnJvZ0lDMi9BL1RrcThvCjVFVXhJR3duQkR6dStqYTYxWTJmaFFLQmdRQ1B1Z05uaVYvYUhNT2JxK0FReTVSR2hxOGUrNjluQTN6c21FYUcKRjYydFl4Mi9NYWxNU29mbDcvMVQ4bk9kTFk2WnY0ZkNDMGk4dTFLdjUzOFVMeG4xT2RDdG82NWM1eFN1dnhLUQp1ZmZEVFU3cUFtM3cwS25ra25acms5U2FucnlOSzQ1djF6bjJndlZSSktpWENxSlpzb0wzaDZxT21aamlzU2ZaCkpHcU9Pd0tCZ0dvKzJkTVZneHhHbFVlUE9IZ3dxUkwzVmxGZDdPU2c3LzczZHBzQ2t1VGhlMW92K1BHVG1qWmMKNC9iVWtFc1NJYm9wWDNHTEYwcGM4RlBEZXNOMHhDQnZ2c0IzWlRubVhDQWRrMHZFVUQyeFNDVWozdjhOcUM5ZAo2bDFlY3VSdFc2eWRyR2JUeUZKMUVZbzJCelpJUlB0Y00yY1ArOVRPOWt0SU5adGRISkJxCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg== 6 | kind: Secret 7 | metadata: 8 | annotations: 9 | edge-host: skupper-edge-todo.apps.openshift.sotogcp.com 10 | edge-port: "443" 11 | inter-router-host: skupper-inter-router-todo.apps.openshift.sotogcp.com 12 | inter-router-port: "443" 13 | creationTimestamp: null 14 | labels: 15 | skupper.io/type: connection-token 16 | name: skupper 17 | type: kubernetes.io/tls 18 | -------------------------------------------------------------------------------- /assets/bgd-app/bgd-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: bgd-app 5 | spec: 6 | destination: 7 | namespace: bgd 8 | server: https://kubernetes.default.svc 9 | project: default 10 | source: 11 | path: apps/bgd/overlays/bgd 12 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 13 | targetRevision: main 14 | syncPolicy: 15 | automated: 16 | prune: true 17 | selfHeal: false 18 | syncOptions: 19 | - CreateNamespace=true 20 | sync: 21 | comparedTo: 22 | destination: 23 | namespace: bgd 24 | server: https://kubernetes.default.svc 25 | source: 26 | path: apps/bgd/overlays/bgd 27 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 28 | targetRevision: main 29 | -------------------------------------------------------------------------------- /assets/examples/bgd-yaml/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | creationTimestamp: null 6 | labels: 7 | app: bgd 8 | name: bgd 9 | namespace: bgd 10 | spec: 11 | replicas: 1 12 | selector: 13 | matchLabels: 14 | app: bgd 15 | strategy: {} 16 | template: 17 | metadata: 18 | creationTimestamp: null 19 | labels: 20 | app: bgd 21 | spec: 22 | containers: 23 | - image: quay.io/redhatworkshops/bgd:latest 24 | name: bgd 25 | env: 26 | - name: COLOR 27 | value: "blue" 28 | resources: {} 29 | --- 30 | -------------------------------------------------------------------------------- /assets/examples/bgd-yaml/bgd-namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | creationTimestamp: null 5 | name: bgd 6 | spec: {} 7 | status: {} 8 | -------------------------------------------------------------------------------- /assets/examples/bgd-yaml/bgd-route.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: route.openshift.io/v1 2 | kind: Route 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgd 9 | spec: 10 | host: "" 11 | port: 12 | targetPort: 8080 13 | to: 14 | kind: Service 15 | name: bgd 16 | weight: 100 17 | status: 18 | ingress: 19 | - conditions: 20 | - status: "True" 21 | type: Admitted 22 | -------------------------------------------------------------------------------- /assets/examples/bgd-yaml/bgd-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | creationTimestamp: null 6 | labels: 7 | app: bgd 8 | name: bgd 9 | namespace: bgd 10 | spec: 11 | ports: 12 | - port: 8080 13 | protocol: TCP 14 | targetPort: 8080 15 | selector: 16 | app: bgd 17 | --- 18 | -------------------------------------------------------------------------------- /assets/examples/bgd-yaml/kustomization.yaml: -------------------------------------------------------------------------------- 1 | namespace: bgd 2 | resources: 3 | - bgd-namespace.yaml 4 | - bgd-deployment.yaml 5 | - bgd-route.yaml 6 | - bgd-svc.yaml 7 | -------------------------------------------------------------------------------- /assets/operator-install/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - openshift-gitops-operator-sub.yaml 3 | -------------------------------------------------------------------------------- /assets/operator-install/openshift-gitops-operator-sub.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: operators.coreos.com/v1alpha1 2 | kind: Subscription 3 | metadata: 4 | name: openshift-gitops-operator 5 | namespace: openshift-operators 6 | spec: 7 | channel: preview 8 | installPlanApproval: Automatic 9 | name: openshift-gitops-operator 10 | source: redhat-operators 11 | sourceNamespace: openshift-marketplace -------------------------------------------------------------------------------- /assets/scripts/argocd-postinstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | logfile=/root/.katacoda-argocd-setup.log 3 | 4 | # 5 | ## Create logfile 6 | touch ${logfile} 7 | 8 | # 9 | ## Clear the screen in attempt to make it look neater 10 | clear 11 | 12 | # 13 | ## Start the setup process 14 | echo -n "Setting up lab environment, please wait" 15 | 16 | # 17 | ## Login as admin 18 | oc login --insecure-skip-tls-verify -u admin -p admin >>${logfile} 2>&1 19 | echo -n '.' 20 | 21 | # 22 | ## Check if the operator resource is there 23 | if [[ ! -d resources/operator-install ]]; then 24 | echo -e "\nERROR: Operator install resource not found!" 25 | exit 3 26 | fi 27 | 28 | # 29 | ## Install the OpenShift GitOps via Operator 30 | oc apply -k resources/operator-install >>${logfile} 2>&1 31 | echo -n '.' 32 | 33 | # 34 | ## Wait until the deployment appears 35 | until oc wait --for=condition=available --timeout=60s deploy argocd-cluster-server -n openshift-gitops >>${logfile} 2>&1 36 | do 37 | sleep 15 38 | echo -n '.' 39 | done 40 | 41 | # 42 | ## Wait for the rollout to finish 43 | oc rollout status deploy argocd-cluster-server -n openshift-gitops >>${logfile} 2>&1 44 | echo -n '.' 45 | 46 | # 47 | ## Installs the argocd CLI tool. 48 | wget -q -O /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/v1.8.7/argocd-linux-amd64 49 | if [[ -f /usr/local/bin/argocd ]] ; then 50 | chmod +x /usr/local/bin/argocd 51 | echo -n '.' 52 | else 53 | echo -e "\nFATAL: ArgoCD cli failed to download" 54 | fi 55 | 56 | # 57 | ## This patches the Argo CD Controller in the following ways 58 | ## - Ignores .spec.host field in routes 59 | ## - Uses SSL edge termination because of Katacoda 60 | ## - Uses Argo CD version 1.8.7 61 | oc patch argocd argocd-cluster -n openshift-gitops --type=merge \ 62 | -p='{"spec":{"resourceCustomizations":"route.openshift.io/Route:\n ignoreDifferences: |\n jsonPointers:\n - /spec/host\n","server":{"insecure":true,"route":{"enabled":true,"tls":{"insecureEdgeTerminationPolicy":"Redirect","termination":"edge"}}},"version":"v1.8.7"}}' >>${logfile} 2>&1 63 | echo -n '.' 64 | 65 | # 66 | ## Sleep here because CRC is slow to start the rollout process 67 | sleep 5 68 | 69 | # 70 | ## Give the user some hope 71 | echo -n "Halfway there" 72 | 73 | # 74 | ## Wait for the rollout of a new controller 75 | oc rollout status deploy argocd-cluster-server -n openshift-gitops >>${logfile} 2>&1 76 | echo -n '.' 77 | 78 | # 79 | ## This gives the serviceAccount for ArgoCD the ability to manage the cluster. 80 | oc adm policy add-cluster-role-to-user cluster-admin -z argocd-cluster-argocd-application-controller -n openshift-gitops >>${logfile} 2>&1 81 | echo -n '.' 82 | 83 | # 84 | ## This recycles the pods to make sure the new configurations took. 85 | oc delete pods -l app.kubernetes.io/name=argocd-cluster-server -n openshift-gitops >>${logfile} 2>&1 86 | echo -n '.' 87 | 88 | # 89 | ## Wait for rollout of new pods and the deployment to be available 90 | until oc wait --for=condition=available --timeout=60s deploy argocd-cluster-server -n openshift-gitops >>${logfile} 2>&1 91 | do 92 | sleep 20 93 | echo -n '.' 94 | done 95 | oc rollout status deploy argocd-cluster-server -n openshift-gitops >>${logfile} 2>&1 96 | echo -n '.' 97 | 98 | # 99 | ## Sleep here because CRC is slow on the rollout process 100 | sleep 5 101 | 102 | # 103 | ## Login to argocd locally for the user. 104 | argoRoute=$(oc get route argocd-cluster-server -n openshift-gitops -o jsonpath='{.spec.host}{"\n"}') 105 | argoUser=admin 106 | argoPass=$(oc get secret/argocd-cluster-cluster -n openshift-gitops -o jsonpath='{.data.admin\.password}' | base64 -d) 107 | argocd login --insecure --grpc-web --username ${argoUser} --password ${argoPass} ${argoRoute} >>${logfile} 2>&1 108 | 109 | echo -n '.' 110 | 111 | # 112 | ## Ready! 113 | echo -e "\nReady!" 114 | ## 115 | ## -------------------------------------------------------------------------------- /assets/syncwaves-hooks/welcome-syncwaves.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | sync: 22 | comparedTo: 23 | destination: 24 | namespace: welcome 25 | server: https://kubernetes.default.svc 26 | source: 27 | path: apps/welcome-php/overlays/syncwaves 28 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 29 | targetRevision: main 30 | -------------------------------------------------------------------------------- /dev-site.yml: -------------------------------------------------------------------------------- 1 | runtime: 2 | cache_dir: ./.cache/antora 3 | 4 | site: 5 | title: ArgoCD Tutorial (Dev Mode) 6 | url: http://localhost:3000/rhs-build-course/index.html 7 | start_page: argocd-tutorial::index.adoc 8 | 9 | content: 10 | sources: 11 | - url: . 12 | branches: HEAD 13 | start_path: documentation 14 | asciidoc: 15 | attributes: 16 | release-version: master 17 | page-pagination: true 18 | extensions: 19 | - ./lib/remote-include-processor.js 20 | - ./lib/tab-block.js 21 | ui: 22 | bundle: 23 | url: https://github.com/redhat-developer-demos/rhd-tutorial-ui/releases/download/v0.1.10/ui-bundle.zip 24 | snapshot: true 25 | supplemental_files: ./supplemental-ui 26 | output: 27 | dir: ./gh-pages 28 | -------------------------------------------------------------------------------- /documentation/antora.yml: -------------------------------------------------------------------------------- 1 | name: argocd-tutorial 2 | title: ArgoCD Tutorial 3 | version: master 4 | nav: 5 | - modules/ROOT/nav.adoc 6 | 7 | start_page: ROOT:index.adoc 8 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/appk-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/appk-overview.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-app1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-app1.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-app2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-app2.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-app3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-app3.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-login.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-login2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-login2.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-logo.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd-sync-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd-sync-flow.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argocd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argocd.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/argopad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/argopad.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/bgd-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/bgd-green.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/bgd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/bgd.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/bgdapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/bgdapp.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/bgdk-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/bgdk-app.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/fullysynced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/fullysynced.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/green-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/green-square.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/hooks-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/hooks-card.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/hooks-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/hooks-tree.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/install-argo-operator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/install-argo-operator.gif -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/kubelogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/kubelogo.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/kustomize_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/kustomize_logo.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/ocp-install1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/ocp-install1.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/ocp-install2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/ocp-install2.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/ocp-install3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/ocp-install3.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/ocp-install4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/ocp-install4.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/ocp-install5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/ocp-install5.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/os-gitops-installed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/os-gitops-installed.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/out-of-sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/out-of-sync.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/presyncpost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/presyncpost.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/resource-hooks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/resource-hooks.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/synced-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/synced-app.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/synced-appk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/synced-appk.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/syncwave.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/syncwave.gif -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/todo-app-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/todo-app-screenshot.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/todo-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/todo-app.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/todo-argocd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/todo-argocd.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/todo-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/todo-card.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/two-apps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/two-apps.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/waves-and-hooks-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/waves-and-hooks-card.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/waves-and-hooks-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/waves-and-hooks-tree.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/welcome-syncwaves-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/welcome-syncwaves-tree.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/welcome-syncwaves.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/welcome-syncwaves.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/assets/images/yellow-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/documentation/modules/ROOT/assets/images/yellow-square.png -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgd-app/bgd-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: bgd-app 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: bgd 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/bgd/overlays/bgd 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgd-yaml/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgd 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: bgd 14 | strategy: {} 15 | template: 16 | metadata: 17 | labels: 18 | app: bgd 19 | spec: 20 | containers: 21 | - image: quay.io/redhatworkshops/bgd:latest 22 | name: bgd 23 | env: 24 | - name: COLOR 25 | value: "blue" 26 | resources: {} 27 | --- 28 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgd-yaml/bgd-namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: bgd 5 | spec: {} 6 | status: {} 7 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgd-yaml/bgd-route.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: route.openshift.io/v1 2 | kind: Route 3 | metadata: 4 | labels: 5 | app: bgd 6 | name: bgd 7 | namespace: bgd 8 | spec: 9 | port: 10 | targetPort: 8080 11 | to: 12 | kind: Service 13 | name: bgd 14 | weight: 100 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgd-yaml/bgd-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | creationTimestamp: null 6 | labels: 7 | app: bgd 8 | name: bgd 9 | namespace: bgd 10 | spec: 11 | ports: 12 | - port: 8080 13 | protocol: TCP 14 | targetPort: 8080 15 | selector: 16 | app: bgd 17 | --- 18 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgd-yaml/kustomization.yaml: -------------------------------------------------------------------------------- 1 | namespace: bgd 2 | resources: 3 | - bgd-namespace.yaml 4 | - bgd-deployment.yaml 5 | - bgd-route.yaml 6 | - bgd-svc.yaml 7 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/bgdk-app/bgdk-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: bgdk-app 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: bgdk 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/bgd/overlays/bgdk 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/kustomize-build/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ./welcome.yaml 5 | patchesJson6902: 6 | - patch: |- 7 | - op: add 8 | path: /metadata/labels/testkey 9 | value: testvalue 10 | target: 11 | group: apps 12 | kind: Deployment 13 | name: welcome-php 14 | version: v1 15 | images: 16 | - name: quay.io/redhatworkshops/welcome-php 17 | newTag: ffcd15 18 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/kustomize-build/welcome.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | app: welcome-php 7 | name: welcome-php 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | app: welcome-php 13 | strategy: {} 14 | template: 15 | metadata: 16 | creationTimestamp: null 17 | labels: 18 | app: welcome-php 19 | spec: 20 | containers: 21 | - image: quay.io/redhatworkshops/welcome-php:latest 22 | name: welcome-php 23 | resources: {} 24 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/bgd-app/bgd-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: bgd-app 5 | namespace: argocd 6 | spec: 7 | destination: 8 | namespace: bgd 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/bgd/overlays/bgd 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: minikube 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/bgd-yaml/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgd 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: bgd 14 | strategy: {} 15 | template: 16 | metadata: 17 | labels: 18 | app: bgd 19 | spec: 20 | containers: 21 | - image: quay.io/redhatworkshops/bgd:latest 22 | name: bgd 23 | env: 24 | - name: COLOR 25 | value: "blue" 26 | resources: {} 27 | --- 28 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/bgd-yaml/bgd-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: bgd 5 | spec: 6 | rules: 7 | - host: bgd.devnation 8 | http: 9 | paths: 10 | - path: / 11 | pathType: Prefix 12 | backend: 13 | service: 14 | name: bgd 15 | port: 16 | number: 8080 17 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/bgd-yaml/bgd-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgd 9 | spec: 10 | type: NodePort 11 | ports: 12 | - port: 8080 13 | protocol: TCP 14 | targetPort: 8080 15 | selector: 16 | app: bgd 17 | --- 18 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/bgd-yaml/kustomization.yaml: -------------------------------------------------------------------------------- 1 | namespace: bgd 2 | resources: 3 | - bgd-svc.yaml 4 | - bgd-deployment.yaml 5 | - bgd-ingress.yaml 6 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/bgdk-app/bgdk-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: bgdk-app 5 | namespace: argocd 6 | spec: 7 | destination: 8 | namespace: bgdk 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/bgd/overlays/bgdk 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: minikube 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/hooks/welcome-php-presync-job.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | creationTimestamp: null 5 | name: welcome-presyncjob 6 | annotations: 7 | argocd.argoproj.io/hook: PreSync 8 | spec: 9 | template: 10 | metadata: 11 | creationTimestamp: null 12 | spec: 13 | containers: 14 | - command: 15 | - /bin/bash 16 | - -c 17 | - | 18 | sleep 15 19 | image: registry.access.redhat.com/ubi8/ubi:latest 20 | imagePullPolicy: IfNotPresent 21 | name: welcome-sleep-job 22 | restartPolicy: Never 23 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/syncwaves-and-hooks/welcome-php-postsync-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: welcome-postsync-pod 5 | annotations: 6 | argocd.argoproj.io/hook: PostSync 7 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 8 | spec: 9 | containers: 10 | - command: 11 | - /bin/bash 12 | - -c 13 | - | 14 | echo "Post deployment work" 15 | sleep 10 16 | image: registry.access.redhat.com/ubi8/ubi:latest 17 | imagePullPolicy: IfNotPresent 18 | name: welcome-sleep-pod 19 | dnsPolicy: ClusterFirst 20 | restartPolicy: Never 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/syncwaves-and-hooks/welcome-php-presync-job.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: welcome-presyncjob 5 | annotations: 6 | argocd.argoproj.io/hook: PreSync 7 | argocd.argoproj.io/sync-wave: "0" 8 | spec: 9 | template: 10 | metadata: 11 | creationTimestamp: null 12 | spec: 13 | containers: 14 | - command: 15 | - /bin/bash 16 | - -c 17 | - | 18 | sleep 15 19 | image: registry.access.redhat.com/ubi8/ubi:latest 20 | imagePullPolicy: IfNotPresent 21 | name: welcome-sleep-job 22 | restartPolicy: Never 23 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/syncwaves-and-hooks/welcome-php-presync-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: welcome-presync-pod 5 | annotations: 6 | argocd.argoproj.io/hook: PreSync 7 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 8 | argocd.argoproj.io/sync-wave: "1" 9 | spec: 10 | containers: 11 | - command: 12 | - /bin/bash 13 | - -c 14 | - | 15 | echo "Pre deployment tasks" 16 | sleep 10 17 | image: registry.access.redhat.com/ubi8/ubi:latest 18 | imagePullPolicy: IfNotPresent 19 | name: welcome-sleep-pod 20 | dnsPolicy: ClusterFirst 21 | restartPolicy: Never 22 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/welcome-hooks.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-hooks 5 | namespace: argocd 6 | spec: 7 | destination: 8 | namespace: welcome-hooks 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/hooks 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: minikube 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/welcome-syncwaves-and-hooks.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves-hooks 5 | namespace: argocd 6 | spec: 7 | destination: 8 | namespace: welcome-waves-and-hooks 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves-and-hooks 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: minikube 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/syncwaves-hooks/welcome-syncwaves.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves 5 | namespace: argocd 6 | spec: 7 | destination: 8 | namespace: welcome 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: minikube 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/postgresql-create-table.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: todo-table 5 | namespace: todo 6 | annotations: 7 | argocd.argoproj.io/sync-wave: "1" 8 | spec: 9 | ttlSecondsAfterFinished: 100 10 | template: 11 | spec: 12 | containers: 13 | - name: postgresql-client 14 | image: postgres:12 15 | imagePullPolicy: Always 16 | env: 17 | - name: PGPASSWORD 18 | value: admin 19 | command: ["psql"] 20 | args: 21 | [ 22 | "--host=postgresql", 23 | "--username=admin", 24 | "--no-password", 25 | "--dbname=todo", 26 | "--command=create table Todo (id bigint not null,completed boolean not null,ordering integer,title varchar(255),url varchar(255),primary key (id));create sequence hibernate_sequence start with 1 increment by 1;", 27 | ] 28 | restartPolicy: Never 29 | backoffLimit: 1 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/postgresql-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: postgresql 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | matchLabels: 12 | app: postgresql 13 | template: 14 | metadata: 15 | labels: 16 | app: postgresql 17 | spec: 18 | containers: 19 | - name: postgresql 20 | image: postgres:12 21 | imagePullPolicy: Always 22 | ports: 23 | - name: tcp 24 | containerPort: 5432 25 | env: 26 | - name: POSTGRES_PASSWORD 27 | value: admin 28 | - name: POSTGRES_USER 29 | value: admin 30 | - name: POSTGRES_DB 31 | value: todo -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/postgresql-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: postgres 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | app: postgresql 12 | ports: 13 | - name: pgsql 14 | port: 5432 15 | targetPort: 5432 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/todo-application.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: todo-app 5 | namespace: argocd 6 | spec: 7 | destination: 8 | namespace: todo 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/todo 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: minikube 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/todo-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "ServiceAccount" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | namespace: todo 10 | annotations: 11 | argocd.argoproj.io/sync-wave: "2" 12 | --- 13 | apiVersion: "apps/v1" 14 | kind: "Deployment" 15 | metadata: 16 | labels: 17 | app.kubernetes.io/name: "todo-gitops" 18 | app.kubernetes.io/version: "1.0.0" 19 | name: "todo-gitops" 20 | namespace: todo 21 | annotations: 22 | argocd.argoproj.io/sync-wave: "2" 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app.kubernetes.io/name: "todo-gitops" 28 | app.kubernetes.io/version: "1.0.0" 29 | template: 30 | metadata: 31 | labels: 32 | app.kubernetes.io/name: "todo-gitops" 33 | app.kubernetes.io/version: "1.0.0" 34 | spec: 35 | containers: 36 | - env: 37 | - name: "KUBERNETES_NAMESPACE" 38 | valueFrom: 39 | fieldRef: 40 | fieldPath: "metadata.namespace" 41 | image: "quay.io/rhdevelopers/todo-gitops:1.0.0" 42 | imagePullPolicy: "Always" 43 | name: "todo-gitops" 44 | ports: 45 | - containerPort: 8080 46 | name: "http" 47 | protocol: "TCP" 48 | serviceAccount: "todo-gitops" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/todo-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: todo 5 | namespace: todo 6 | annotations: 7 | argocd.argoproj.io/sync-wave: "3" 8 | spec: 9 | rules: 10 | - host: todo.devnation 11 | http: 12 | paths: 13 | - path: / 14 | pathType: Prefix 15 | backend: 16 | service: 17 | name: todo-gitops 18 | port: 19 | number: 8080 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/todo-insert-data.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: todo-insert 5 | annotations: 6 | argocd.argoproj.io/hook: PostSync 7 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 8 | spec: 9 | ttlSecondsAfterFinished: 100 10 | template: 11 | spec: 12 | containers: 13 | - name: httpie 14 | image: alpine/httpie:2.4.0 15 | imagePullPolicy: Always 16 | command: ["http"] 17 | args: 18 | [ 19 | "POST", 20 | "todo-gitops:8080/api", 21 | "title=Finish ArgoCD tutorial", 22 | "--ignore-stdin" 23 | ] 24 | restartPolicy: Never 25 | backoffLimit: 1 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/todo-namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: todo 5 | annotations: 6 | argocd.argoproj.io/sync-wave: "-1" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/todo-yaml/todo-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "Service" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | annotations: 10 | argocd.argoproj.io/sync-wave: "2" 11 | namespace: todo 12 | spec: 13 | ports: 14 | - name: "http" 15 | port: 8080 16 | targetPort: 8080 17 | selector: 18 | app.kubernetes.io/name: "todo-gitops" 19 | app.kubernetes.io/version: "1.0.0" 20 | type: "NodePort" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/welcome-php-yaml/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - welcome-php-deployment.yaml 3 | - welcome-php-ingress.yaml 4 | - welcome-php-svc.yaml 5 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/welcome-php-yaml/welcome-php-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "1" 6 | labels: 7 | app: welcome-php 8 | name: welcome-php 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: welcome-php 14 | strategy: {} 15 | template: 16 | metadata: 17 | creationTimestamp: null 18 | labels: 19 | app: welcome-php 20 | spec: 21 | containers: 22 | - image: quay.io/redhatworkshops/welcome-php:latest 23 | name: welcome-php 24 | resources: {} 25 | status: {} 26 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/welcome-php-yaml/welcome-php-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: welcome-php 5 | annotations: 6 | argocd.argoproj.io/sync-wave: "3" 7 | spec: 8 | rules: 9 | - host: welcome-php.devnation 10 | http: 11 | paths: 12 | - path: / 13 | pathType: Prefix 14 | backend: 15 | service: 16 | name: welcome-php 17 | port: 18 | number: 8080 19 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/welcome-php-yaml/welcome-php-ns.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "0" 6 | name: welcome 7 | spec: {} 8 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/minikube/welcome-php-yaml/welcome-php-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "2" 6 | labels: 7 | app: welcome-php 8 | name: welcome-php 9 | spec: 10 | type: NodePort 11 | ports: 12 | - port: 8080 13 | protocol: TCP 14 | targetPort: 8080 15 | selector: 16 | app: welcome-php 17 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Hello World" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/hooks/welcome-php-presync-job.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | creationTimestamp: null 5 | name: welcome-presyncjob 6 | annotations: 7 | argocd.argoproj.io/hook: PreSync 8 | spec: 9 | template: 10 | metadata: 11 | creationTimestamp: null 12 | spec: 13 | containers: 14 | - command: 15 | - /bin/bash 16 | - -c 17 | - | 18 | sleep 15 19 | image: registry.access.redhat.com/ubi8/ubi:latest 20 | imagePullPolicy: IfNotPresent 21 | name: welcome-sleep-job 22 | restartPolicy: Never 23 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/syncwaves-and-hooks/welcome-php-postsync-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | creationTimestamp: null 5 | name: welcome-postsync-pod 6 | annotations: 7 | argocd.argoproj.io/hook: PostSync 8 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 9 | spec: 10 | containers: 11 | - command: 12 | - /bin/bash 13 | - -c 14 | - | 15 | echo "Post deployment work" 16 | sleep 10 17 | image: registry.access.redhat.com/ubi8/ubi:latest 18 | imagePullPolicy: IfNotPresent 19 | name: welcome-sleep-pod 20 | dnsPolicy: ClusterFirst 21 | restartPolicy: Never 22 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/syncwaves-and-hooks/welcome-php-presync-job.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | creationTimestamp: null 5 | name: welcome-presyncjob 6 | annotations: 7 | argocd.argoproj.io/hook: PreSync 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | template: 11 | metadata: 12 | creationTimestamp: null 13 | spec: 14 | containers: 15 | - command: 16 | - /bin/bash 17 | - -c 18 | - | 19 | sleep 15 20 | image: registry.access.redhat.com/ubi8/ubi:latest 21 | imagePullPolicy: IfNotPresent 22 | name: welcome-sleep-job 23 | restartPolicy: Never 24 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/syncwaves-and-hooks/welcome-php-presync-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | creationTimestamp: null 5 | name: welcome-presync-pod 6 | annotations: 7 | argocd.argoproj.io/hook: PreSync 8 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 9 | argocd.argoproj.io/sync-wave: "1" 10 | spec: 11 | containers: 12 | - command: 13 | - /bin/bash 14 | - -c 15 | - | 16 | echo "Pre deployment tasks" 17 | sleep 10 18 | image: registry.access.redhat.com/ubi8/ubi:latest 19 | imagePullPolicy: IfNotPresent 20 | name: welcome-sleep-pod 21 | dnsPolicy: ClusterFirst 22 | restartPolicy: Never 23 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/welcome-hooks.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-hooks 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome-hooks 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/hooks 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/welcome-syncwaves-and-hooks.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves-hooks 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome-waves-and-hooks 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves-and-hooks 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/syncwaves-hooks/welcome-syncwaves.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/postgres-create-table.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: todo-table 5 | namespace: todo 6 | annotations: 7 | argocd.argoproj.io/sync-wave: "1" 8 | spec: 9 | ttlSecondsAfterFinished: 100 10 | template: 11 | spec: 12 | containers: 13 | - name: postgresql-client 14 | image: postgres:12 15 | imagePullPolicy: Always 16 | env: 17 | - name: PGPASSWORD 18 | value: admin 19 | command: ["psql"] 20 | args: 21 | [ 22 | "--host=postgresql", 23 | "--username=admin", 24 | "--no-password", 25 | "--dbname=todo", 26 | "--command=create table Todo (id bigint not null,completed boolean not null,ordering integer,title varchar(255),url varchar(255),primary key (id));create sequence hibernate_sequence start with 1 increment by 1;", 27 | ] 28 | restartPolicy: Never 29 | backoffLimit: 1 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/postgres-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: postgresql 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | matchLabels: 12 | app: postgresql 13 | template: 14 | metadata: 15 | labels: 16 | app: postgresql 17 | spec: 18 | containers: 19 | - name: postgresql 20 | image: quay.io/redhatdemo/openshift-pgsql12-primary:centos7 21 | imagePullPolicy: Always 22 | ports: 23 | - name: tcp 24 | containerPort: 5432 25 | env: 26 | - name: PG_USER_PASSWORD 27 | value: admin 28 | - name: PG_USER_NAME 29 | value: admin 30 | - name: PG_DATABASE 31 | value: todo 32 | - name: PG_NETWORK_MASK 33 | value: all 34 | 35 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/postgres-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: postgresql 6 | namespace: todo 7 | annotations: 8 | argocd.argoproj.io/sync-wave: "0" 9 | spec: 10 | selector: 11 | app: postgresql 12 | ports: 13 | - name: pgsql 14 | port: 5432 15 | targetPort: 5432 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/todo-application.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: todo-app 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: todo 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/todo 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/todo-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "ServiceAccount" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | namespace: todo 10 | annotations: 11 | argocd.argoproj.io/sync-wave: "2" 12 | --- 13 | apiVersion: "apps/v1" 14 | kind: "Deployment" 15 | metadata: 16 | labels: 17 | app.kubernetes.io/name: "todo-gitops" 18 | app.kubernetes.io/version: "1.0.0" 19 | name: "todo-gitops" 20 | namespace: todo 21 | annotations: 22 | argocd.argoproj.io/sync-wave: "2" 23 | spec: 24 | replicas: 1 25 | selector: 26 | matchLabels: 27 | app.kubernetes.io/name: "todo-gitops" 28 | app.kubernetes.io/version: "1.0.0" 29 | template: 30 | metadata: 31 | labels: 32 | app.kubernetes.io/name: "todo-gitops" 33 | app.kubernetes.io/version: "1.0.0" 34 | spec: 35 | containers: 36 | - env: 37 | - name: "KUBERNETES_NAMESPACE" 38 | valueFrom: 39 | fieldRef: 40 | fieldPath: "metadata.namespace" 41 | image: "quay.io/rhdevelopers/todo-gitops:1.0.0" 42 | imagePullPolicy: "Always" 43 | name: "todo-gitops" 44 | ports: 45 | - containerPort: 8080 46 | name: "http" 47 | protocol: "TCP" 48 | serviceAccount: "todo-gitops" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/todo-insert-data.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: todo-insert 5 | annotations: 6 | argocd.argoproj.io/hook: PostSync # <1> 7 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 8 | spec: 9 | ttlSecondsAfterFinished: 100 10 | template: 11 | spec: 12 | containers: 13 | - name: httpie 14 | image: alpine/httpie:2.4.0 15 | imagePullPolicy: Always 16 | command: ["http"] 17 | args: 18 | [ 19 | "POST", 20 | "todo-gitops:8080/api", 21 | "title=Finish ArgoCD tutorial", 22 | "--ignore-stdin" 23 | ] 24 | restartPolicy: Never 25 | backoffLimit: 1 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/todo-namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: todo 5 | annotations: 6 | argocd.argoproj.io/sync-wave: "-1" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/todo-route.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: route.openshift.io/v1 2 | kind: Route 3 | metadata: 4 | labels: 5 | app: todo 6 | name: todo 7 | namespace: todo 8 | annotations: 9 | argocd.argoproj.io/sync-wave: "3" 10 | spec: 11 | port: 12 | targetPort: 8080 13 | to: 14 | kind: Service 15 | name: todo-gitops 16 | weight: 100 -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/todo-yaml/todo-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "Service" 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: "todo-gitops" 7 | app.kubernetes.io/version: "1.0.0" 8 | name: "todo-gitops" 9 | annotations: 10 | argocd.argoproj.io/sync-wave: "2" 11 | namespace: todo 12 | spec: 13 | ports: 14 | - name: "http" 15 | port: 8080 16 | targetPort: 8080 17 | selector: 18 | app.kubernetes.io/name: "todo-gitops" 19 | app.kubernetes.io/version: "1.0.0" -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php-yaml/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - welcome-php-deployment.yaml 3 | - welcome-php-route.yaml 4 | - welcome-php-svc.yaml 5 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php-yaml/welcome-php-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "1" 6 | labels: 7 | app: welcome-php 8 | name: welcome-php 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: welcome-php 14 | strategy: {} 15 | template: 16 | metadata: 17 | creationTimestamp: null 18 | labels: 19 | app: welcome-php 20 | spec: 21 | containers: 22 | - image: quay.io/redhatworkshops/welcome-php:latest 23 | name: welcome-php 24 | resources: {} 25 | status: {} 26 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php-yaml/welcome-php-ns.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "0" 6 | name: welcome 7 | spec: {} 8 | status: {} 9 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php-yaml/welcome-php-route.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: route.openshift.io/v1 2 | kind: Route 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "3" 6 | labels: 7 | app: welcome-php 8 | name: welcome-php 9 | spec: 10 | port: 11 | targetPort: 8080 12 | to: 13 | kind: Service 14 | name: welcome-php 15 | weight: null 16 | status: {} 17 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php-yaml/welcome-php-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | argocd.argoproj.io/sync-wave: "2" 6 | labels: 7 | app: welcome-php 8 | name: welcome-php 9 | spec: 10 | ports: 11 | - port: 8080 12 | protocol: TCP 13 | targetPort: 8080 14 | selector: 15 | app: welcome-php 16 | status: 17 | loadBalancer: {} 18 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php/welcome-hooks.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-hooks 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome-hooks 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/hooks 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php/welcome-syncwaves-and-hooks.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves-hooks 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome-waves-and-hooks 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves-and-hooks 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/examples/welcome-php/welcome-syncwaves.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: Application 3 | metadata: 4 | name: welcome-syncwaves 5 | namespace: openshift-gitops 6 | spec: 7 | destination: 8 | namespace: welcome 9 | server: https://kubernetes.default.svc 10 | project: default 11 | source: 12 | path: apps/welcome-php/overlays/syncwaves 13 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 14 | targetRevision: main 15 | syncPolicy: 16 | automated: 17 | prune: true 18 | selfHeal: false 19 | syncOptions: 20 | - CreateNamespace=true 21 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:01-setup.adoc[Setup] 2 | ** xref:01-setup.adoc#prerequisite[Prerequisites] 3 | ** xref:01-setup.adoc#kubernetes[Setup Kubernetes] 4 | ** xref:01-setup.adoc#install_argocd[Install ArgoCD] 5 | 6 | * xref:02-getting_started.adoc[Getting Started] 7 | ** xref:02-getting_started.adoc#connect_argocd[Connecting to ArgoCD] 8 | ** xref:02-getting_started.adoc#deploy_sample_application[Deploy a Sample Application] 9 | 10 | * xref:03-kustomize.adoc[Work with Kustomize] 11 | ** xref:03-kustomize.adoc#exploring_kustomize[Exploring the Kustomize] 12 | *** xref:03-kustomize.adoc#exploring_kustomize_cli[Exploring the Kustomize CLI] 13 | *** xref:03-kustomize.adoc#exploring_kustomize_with_kubectl[Exploring Kustomize with Kubectl] 14 | ** xref:03-kustomize.adoc#deploying_kustomized_application[Deploying Kustomized Application] 15 | *** xref:03-kustomize.adoc#argocd_web_console[The ArgoCD Web Console] 16 | *** xref:03-kustomize.adoc#kustomized_application[Kustomized Application] 17 | 18 | * xref:04-syncwaves-hooks.adoc[Sync Waves and Hooks] 19 | ** xref:04-syncwaves-hooks.adoc#using_syncwaves[Using Sync Waves] 20 | *** xref:04-syncwaves-hooks.adoc#exploring_the_manifests[Exploring the Manifests] 21 | *** xref:04-syncwaves-hooks.adoc#deploying_the_application[Deploying the Application] 22 | ** xref:04-syncwaves-hooks.adoc#exploring_resource_hooks[Exploring Resource Hooks] 23 | *** xref:04-syncwaves-hooks.adoc#exploring_the_manifests_hooks[Exploring the Manifests] 24 | *** xref:04-syncwaves-hooks.adoc#deploying_the_application_hooks[Deploying the Application] 25 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/pages/01-setup.adoc: -------------------------------------------------------------------------------- 1 | = Setup 2 | include::_attributes.adoc[] 3 | 4 | [#prerequisite] 5 | == Prerequisite CLI Tools 6 | 7 | The following CLI tools are required for running the exercises in this tutorial. 8 | Please have them installed and configured before you get started with any of the tutorial chapters. 9 | 10 | [cols="4*^,4*.",options="header,+attributes"] 11 | |=== 12 | |**Tool**|**macOS**|**Fedora**|**Windows** 13 | 14 | | `Git` 15 | | https://git-scm.com/download/mac[Download] 16 | | https://git-scm.com/download/linux[Download] 17 | | https://git-scm.com/download/win[Download] 18 | 19 | | `Docker` 20 | | https://docs.docker.com/docker-for-mac/install[Docker for Mac] 21 | | `dnf install podman podman-docker` 22 | | https://docs.docker.com/docker-for-windows/install[Docker for Windows] 23 | 24 | | `VirtualBox` 25 | | https://download.virtualbox.org/virtualbox/6.1.6/VirtualBox-6.1.6-137129-OSX.dmg[Download] 26 | | https://www.virtualbox.org/wiki/Linux_Downloads[Download] 27 | | https://download.virtualbox.org/virtualbox/6.1.6/VirtualBox-6.1.6-137129-Win.exe[Download] 28 | 29 | | https://kubernetes.io/docs/tasks/tools/install-minikube[Minikube] {minikube-version} 30 | | https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-darwin-amd64[Download] 31 | | https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-linux-amd64[Download] 32 | | https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-windows-amd64.exe[Download] 33 | 34 | | `kubectl {kubernetes-version}` 35 | | https://storage.googleapis.com/kubernetes-release/release/{kubernetes-version}/bin/darwin/amd64/kubectl[Download] 36 | | https://storage.googleapis.com/kubernetes-release/release/{kubernetes-version}/bin/linux/amd64/kubectl[Download] 37 | | https://storage.googleapis.com/kubernetes-release/release/{kubernetes-version}/bin/windows/amd64/kubectl.exe[Download] 38 | 39 | | `argocd {argocd-version}` 40 | | https://github.com/argoproj/argo-cd/releases/download/{argocd-version}/argocd-darwin-amd64[Download] 41 | | https://github.com/argoproj/argo-cd/releases/download/{argocd-version}/argocd-linux-amd64[Download] 42 | | https://github.com/argoproj/argo-cd/releases/download/{argocd-version}/argocd-windows-amd64.exe[Download] 43 | 44 | | `kustomize {kustomize-version}` 45 | | https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.1.2/kustomize_{kustomize-version}_darwin_amd64.tar.gz[Download] 46 | | https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.1.2/kustomize_{kustomize-version}_linux_amd64.tar.gz[Download] 47 | | https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.1.2/kustomize_{kustomize-version}_windows_amd64.tar.gz[Download] 48 | 49 | |=== 50 | 51 | The following CLI tools are optional for running the exercises in this tutorial. 52 | Although they are used in the tutorial, you could use others without any problem. 53 | 54 | [cols="4*^,4*.",options="header,+attributes"] 55 | |=== 56 | |**Tool**|**macOS**|**Fedora**|**Windows** 57 | 58 | | https://github.com/mikefarah/yq[yq v2.4.1] 59 | | https://github.com/mikefarah/yq/releases/download/2.4.1/yq_darwin_amd64[Download] 60 | | https://github.com/mikefarah/yq/releases/download/2.4.1/yq_linux_amd64[Download] 61 | | https://github.com/mikefarah/yq/releases/download/2.4.1/yq_windows_amd64.exe[Download] 62 | 63 | | https://github.com/stedolan/jq[jq v1.6.0] 64 | | https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64[Download] 65 | | https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64[Download] 66 | | https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe[Download] 67 | 68 | | watch 69 | | `brew install watch` 70 | | `dnf install procps-ng` 71 | | 72 | 73 | |=== 74 | 75 | 76 | [#downloadtutorial] 77 | == Download Tutorial Source Files 78 | 79 | :tutorial-url: https://github.com/redhat-scholars/argocd-tutorial.git 80 | :folder: gitops 81 | include::https://raw.githubusercontent.com/redhat-developer-demos/rhd-tutorial-common/master/download-sources.adoc[] 82 | 83 | 84 | [#kubernetes] 85 | == Setup OpenShift / Kubernetes Cluster 86 | 87 | :profile: gitops 88 | 89 | include::https://raw.githubusercontent.com/redhat-developer-demos/rhd-tutorial-common/master/kubernetes-setup.adoc[] 90 | 91 | Now you're ready to install Argo CD on Kubernetes. 92 | 93 | [#install_argocd] 94 | == Argo CD Installation 95 | 96 | In this section we will be exploring how to install Argo CD on Minikube, and how to install it on OpenShift with the OpenShift GitOps Operator. 97 | 98 | [tabs, subs="attributes+,+macros"] 99 | ==== 100 | Minikube:: 101 | + 102 | -- 103 | In the minikube guide, an Argo CD upstream deployment will be installed and used. 104 | 105 | Enable the Ingress Addon for Minikube: 106 | 107 | [.console-input] 108 | [source,bash,subs="attributes+,+macros"] 109 | ---- 110 | minikube addons enable ingress -p {profile} 111 | ---- 112 | 113 | Check that the addon has been enabled: 114 | 115 | [.console-output] 116 | [source,bash,subs="attributes+,+macros"] 117 | ---- 118 | 🌟 The 'ingress' addon is enabled 119 | ---- 120 | 121 | Install ArgoCD and check that every pod is running properly in the argocd namespace: 122 | 123 | [.console-input] 124 | [source,bash,subs="attributes+,+macros"] 125 | ---- 126 | kubectl create namespace argocd 127 | kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml 128 | ---- 129 | 130 | [NOTE] 131 | ====== 132 | It will take few mins for the ArgoCD components to be installed, you can watch the status using the command: 133 | 134 | [.console-input] 135 | [source,bash,subs="+macros,attributes+"] 136 | ---- 137 | watch kubectl get pods -n argocd 138 | ---- 139 | 140 | You can use kbd:[Ctrl+c] to terminate the watch 141 | ====== 142 | 143 | A successful deployment of ArgoCD will show the following pods: 144 | 145 | [.console-output] 146 | [source,bash] 147 | ---- 148 | NAME READY STATUS RESTARTS AGE 149 | argocd-application-controller-0 1/1 Running 0 2m18s 150 | argocd-dex-server-5dd657bd9-2r24r 1/1 Running 0 2m19s 151 | argocd-redis-759b6bc7f4-bnljg 1/1 Running 0 2m19s 152 | argocd-repo-server-6c495f858f-p5267 1/1 Running 0 2m18s 153 | argocd-server-859b4b5578-cv2qx 1/1 Running 0 2m18s 154 | ---- 155 | 156 | Patch the ArgoCD service from ClusterIP to a LoadBalancer: 157 | 158 | [.console-input] 159 | [source,bash,subs="attributes+,+macros"] 160 | ---- 161 | kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' 162 | ---- 163 | 164 | Now with the minikube service list you can check the argocd service exposed: 165 | 166 | [.console-input] 167 | [source,bash,subs="attributes+,+macros"] 168 | ---- 169 | minikube -p {profile} service list | grep argocd 170 | ---- 171 | 172 | -- 173 | OpenShift:: 174 | + 175 | -- 176 | ArgoCD is supported in OpenShift 4.7 by **Red Hat OpenShift GitOps** operator. 177 | 178 | To install it, you need to follow the instructions from link:https://docs.openshift.com/container-platform/4.10/cicd/gitops/installing-openshift-gitops.html#installing-gitops-operator-in-web-console_installing-openshift-gitops[OpenShift GitOps installation documentation,window='_blank']. A summary of the documentation is provided below: 179 | 180 | [NOTE] 181 | ====== 182 | The ability to install Operators is limited to users with the `cluster-admin` role assigned to them. Make sure to login as a user with the necessary privileges to install the Operator. 183 | ====== 184 | 185 | . Switch to the *Administrator perspective* in the OpenShift web console. 186 | . Navigate to *Operators* -> *OperatorHub* using the menu on the left. 187 | . Search for OpenShift GitOps in OperatorHub. 188 | + 189 | image::ocp-install1.png[OperatorHub] 190 | . Click the *Red Hat OpenShift GitOps* tile. 191 | . Select the *Stable* channel. 192 | + 193 | image::ocp-install2.png[Install GitOps Operator] 194 | . Click the *Install* button. 195 | + 196 | image::ocp-install3.png[Install version] 197 | . Wait for the installation process to complete. 198 | + 199 | image::ocp-install4.png[OpenShift GitOps Installed] 200 | . Login to the cluster using the `oc` client. You can copy a login command from the OpenShift web console: 201 | + 202 | image::ocp-install5.png[OpenShift Login Command] 203 | . Verify that all the required Pods have been deployed in `openshift-gitops` namespace using the following command: 204 | + 205 | [.console-input] 206 | [source,bash,subs="attributes+,+macros"] 207 | ---- 208 | oc get pods -n openshift-gitops 209 | ---- 210 | The output should show a list of Pods similar to this: 211 | + 212 | [.console-output] 213 | [source,bash,subs="attributes+,+macros"] 214 | ---- 215 | NAME READY STATUS RESTARTS AGE 216 | argocd-cluster-application-controller-6f548f74b-48bvf 1/1 Running 0 54s 217 | argocd-cluster-redis-6cf68d494d-9qqq4 1/1 Running 0 54s 218 | argocd-cluster-repo-server-85b9d68f9b-4hj52 1/1 Running 0 54s 219 | argocd-cluster-server-78467b647-8lcv9 1/1 Running 0 54s 220 | cluster-86f8d97979-lfdhv 1/1 Running 0 56s 221 | kam-7ff6f58c-2jxkm 1/1 Running 0 55s 222 | ---- 223 | + 224 | . Verify that the Operator is listed when you issue the following command: 225 | + 226 | [.console-input] 227 | [source,bash,subs="attributes+,+macros"] 228 | ---- 229 | oc get operators 230 | ---- 231 | This should have the following output. 232 | + 233 | [.console-output] 234 | [source,bash,subs="attributes+,+macros"] 235 | ---- 236 | NAME AGE 237 | openshift-gitops-operator.openshift-operators 25m 238 | openshift-pipelines-operator-rh.openshift-operators 25m 239 | ---- 240 | . Give the ServiceAccount for ArgoCD the ability to manage the cluster: 241 | + 242 | [.console-input] 243 | [source,bash,subs="attributes+,+macros"] 244 | ---- 245 | oc adm policy add-cluster-role-to-user cluster-admin -z openshift-gitops-argocd-application-controller -n openshift-gitops 246 | ---- 247 | 248 | That's it! You learned how to install an Operator on OpenShift using OperatorHub, and how to use administrative commands via `oc adm` to apply cluster roles to users. -------------------------------------------------------------------------------- /documentation/modules/ROOT/pages/02-getting_started.adoc: -------------------------------------------------------------------------------- 1 | = Getting Started 2 | include::_attributes.adoc[] 3 | :profile: gitops 4 | 5 | Now that you've verified that Argo CD is up and running, let's explore how to access and manage Argo CD. 6 | 7 | [#connect_argocd] 8 | == Connecting to Argo CD 9 | 10 | Argo CD generates a default `admin` user, and a random password when first deployed. 11 | 12 | You can connect to Argo CD using this user account via the CLI or web console. 13 | 14 | === Connecting with the CLI 15 | 16 | To login using the CLI you'll need to obtain the admin password and URL for the Argo CD instance: 17 | 18 | [tabs, subs="attributes+,+macros"] 19 | ==== 20 | Minikube:: 21 | + 22 | -- 23 | 24 | To get the Argo CD password execute: 25 | 26 | [.console-input] 27 | [source,bash,subs="attributes+,+macros"] 28 | ---- 29 | argoPass=$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d) 30 | echo $argoPass 31 | ---- 32 | 33 | Get ArgoCD URL: 34 | 35 | [.console-input] 36 | [source,bash,subs="attributes+,+macros"] 37 | ---- 38 | argoURL=$(minikube -p gitops service argocd-server -n argocd --url -p gitops | tail -n 1 | sed -e 's|http://||') 39 | echo $argoURL 40 | ---- 41 | 42 | -- 43 | 44 | OpenShift:: 45 | + 46 | -- 47 | 48 | Extract the password from the admin user Secret: 49 | 50 | [.console-input] 51 | [source,bash,subs="attributes+,+macros"] 52 | ---- 53 | argoPass=$(oc get secret/openshift-gitops-cluster -n openshift-gitops -o jsonpath='{.data.admin\.password}' | base64 -d) 54 | echo $argoPass 55 | ---- 56 | 57 | Get the Route for the Argo CD/OpenShift GitOps server: 58 | 59 | [.console-input] 60 | [source,bash,subs="attributes+,+macros"] 61 | ---- 62 | argoURL=$(oc get route openshift-gitops-server -n openshift-gitops -o jsonpath='{.spec.host}{"\n"}') 63 | echo $argoURL 64 | ---- 65 | 66 | -- 67 | ==== 68 | 69 | Login to Argo CD with the `argocd` CLI using the URL and password: 70 | [.console-input] 71 | [source,bash,subs="attributes+,+macros"] 72 | ---- 73 | argocd login --insecure --grpc-web $argoURL --username admin --password $argoPass 74 | ---- 75 | 76 | The following message will be printed upon successful login: 77 | 78 | [.console-output] 79 | [source,bash,subs="attributes+,+macros"] 80 | ---- 81 | 'admin:login' logged in successfully 82 | ---- 83 | 84 | === Connecting with the Web Console 85 | 86 | [tabs, subs="attributes+,+macros"] 87 | ==== 88 | Minikube:: 89 | + 90 | -- 91 | Expose the ArgoCD console using the minikube service. 92 | 93 | [.console-input] 94 | [source,bash,subs="attributes+,+macros"] 95 | ---- 96 | minikube -p {profile} service argocd-server -n argocd 97 | ---- 98 | -- 99 | 100 | OpenShift:: 101 | + 102 | -- 103 | In the OpenShift Web Console, expand the *Application Launcher* in the top-right and click the *ArgoCD* icon: 104 | 105 | image::argopad.png[ArgoCD] 106 | 107 | Alternatively, get Argo CD Route using the `oc` CLI as previously done: 108 | [.console-input] 109 | [source,bash,subs="attributes+,+macros"] 110 | ---- 111 | oc get route openshift-gitops-server -n openshift-gitops -o jsonpath='{.spec.host}{"\n"}' 112 | ---- 113 | -- 114 | ==== 115 | 116 | 117 | Access the Argo CD console by logging in with the username `admin` and the password extracted in the previous step: 118 | 119 | image::argocd-login.png[ArgoCDLogin, 600] 120 | 121 | Once you've logged in, you should see the following page. This is the Argo CD Web UI. 122 | 123 | image::argocd-login2.png[ArgoCDLogin2, 600] 124 | 125 | [#deploy_sample_application] 126 | == Deploy a Sample Application 127 | 128 | We'll be using the https://github.com/redhat-developer-demos/openshift-gitops-examples[redhat-developer-demos/openshift-gitops-examples,window='_blank'] Git repository to deploy our first application. It contains the manifests that define the application state. 129 | 130 | === Review the Application Manifests 131 | 132 | The application manifests include a Namespace, Deployment, and networking manifests for Minikube/OpenShift. Deploying these manifests to a cluster will result in an application that supports ingress. 133 | 134 | [IMPORTANT] 135 | ==== 136 | Review, but do not apply these manifests to your cluster. We will do that shortly using Argo CD. 137 | ==== 138 | 139 | A *Namespace*: 140 | 141 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/bgd/overlays/bgd/bgd-ns.yaml[bgd-namespace.yaml,window='_blank'] 142 | [source,yaml,subs="+macros,attributes+"] 143 | ---- 144 | include::ROOT:example$bgd-yaml/bgd-namespace.yaml[] 145 | ---- 146 | 147 | A *Deployment*: 148 | 149 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/bgd/base/bgd-deployment.yaml[bgd-deployment.yaml,window='_blank'] 150 | [source,yaml,subs="+macros,attributes+"] 151 | ---- 152 | include::ROOT:example$bgd-yaml/bgd-deployment.yaml[] 153 | ---- 154 | 155 | [tabs, subs="attributes+,+macros"] 156 | ==== 157 | Minikube:: 158 | + 159 | -- 160 | A *Service* of type `NodePort`: 161 | 162 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/minikube/apps/bgd/base/bgd-svc.yaml[bgd-svc.yaml,window='_blank'] 163 | [source,yaml,subs="+macros,attributes+"] 164 | ---- 165 | include::ROOT:example$minikube/bgd-yaml/bgd-svc.yaml[] 166 | ---- 167 | 168 | An *Ingress*: 169 | 170 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/minikube/apps/bgd/base/bgd-ingress.yaml[bgd-ingress.yaml,window='_blank'] 171 | [source,yaml,subs="+macros,attributes+"] 172 | ---- 173 | include::ROOT:example$minikube/bgd-yaml/bgd-ingress.yaml[] 174 | ---- 175 | -- 176 | OpenShift:: 177 | + 178 | -- 179 | A *Service* of type `ClusterIP`: 180 | 181 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/bgd/base/bgd-svc.yaml[bgd-svc.yaml,window='_blank'] 182 | [source,yaml,subs="+macros,attributes+"] 183 | ---- 184 | include::ROOT:example$bgd-yaml/bgd-svc.yaml[] 185 | ---- 186 | 187 | A *Route*: 188 | 189 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/bgd/base/bgd-route.yaml[bgd-route.yaml,window='_blank'] 190 | [source,yaml,subs="+macros,attributes+"] 191 | ---- 192 | include::ROOT:example$bgd-yaml/bgd-route.yaml[] 193 | ---- 194 | 195 | -- 196 | ==== 197 | 198 | === Deploy the Application 199 | 200 | A managed collection of manifests is known as an `Application` within Argo CD. Therefore, you must define it as such using an link:https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#applications[Application CR (CustomResource)^] in order to have Argo CD apply these manifests in your cluster. 201 | 202 | Let's review the https://github.com/redhat-scholars/argocd-tutorial/blob/master/assets/bgd-app/bgd-app.yaml[Argo CD Application manifest] used to deploy this application and break this down a bit: 203 | 204 | [tabs, subs="attributes+,+macros"] 205 | ==== 206 | Minikube:: 207 | + 208 | -- 209 | .link:https://github.com/redhat-scholars/argocd-tutorial/blob/master/assets/bgd-app/bgd-app.yaml[bgd-app.yaml,window='_blank'] 210 | [source,yaml,subs="+macros,attributes+"] 211 | ---- 212 | apiVersion: argoproj.io/v1alpha1 213 | kind: Application 214 | metadata: 215 | name: bgd-app 216 | namespace: argocd 217 | spec: 218 | destination: 219 | namespace: bgd 220 | server: https://kubernetes.default.svc <1> 221 | project: default <2> 222 | source: <3> 223 | path: apps/bgd/overlays/bgd 224 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 225 | targetRevision: minikube 226 | syncPolicy: <4> 227 | automated: 228 | prune: true 229 | selfHeal: false 230 | syncOptions: 231 | - CreateNamespace=true 232 | ---- 233 | <1> The destination server is the same server we installed Argo CD on. 234 | <2> Here you're installing the application in Argo CD's `default` project (`.spec.project`). 235 | <3> The manifest repo, and the path within it where the YAML resides. 236 | <4> The `syncPolicy` is set to `automated`. It will automatically prune resources resources that have been removed from the Git repo, but will not automatically correct resources that deviate from the definition stored in the repo, i.e manual changes use `kubectl` will not be "healed". 237 | 238 | 239 | Apply the Application CR by running the following command: 240 | 241 | [.console-input] 242 | [source,bash,subs="attributes+,+macros"] 243 | ---- 244 | kubectl apply -f documentation/modules/ROOT/examples/minikube/bgd-app/bgd-app.yaml 245 | ---- 246 | -- 247 | OpenShift:: 248 | + 249 | -- 250 | .link:https://github.com/redhat-scholars/argocd-tutorial/blob/master/assets/bgd-app/bgd-app.yaml[bgd-app.yaml,window='_blank'] 251 | [source,yaml,subs="+macros,attributes+"] 252 | ---- 253 | apiVersion: argoproj.io/v1alpha1 254 | kind: Application 255 | metadata: 256 | name: bgd-app 257 | namespace: openshift-gitops 258 | spec: 259 | destination: 260 | namespace: bgd 261 | server: https://kubernetes.default.svc <1> 262 | project: default <2> 263 | source: <3> 264 | path: apps/bgd/overlays/bgd 265 | repoURL: https://github.com/redhat-developer-demos/openshift-gitops-examples 266 | targetRevision: main 267 | syncPolicy: <4> 268 | automated: 269 | prune: true 270 | selfHeal: false 271 | syncOptions: 272 | - CreateNamespace=true 273 | ---- 274 | <1> The destination server is the same server we installed Argo CD on. 275 | <2> Here you're installing the application in Argo CD's `default` project (`.spec.project`). 276 | [NOTE] 277 | Argo CD's concept of a `Project` is different than OpenShift's. Here you're installing the application in Argo CD's `default` project (`.spec.project`). *NOT* OpenShift's default project. 278 | <3> The manifest repo, and th path within it where the YAML resides. 279 | <4> The `syncPolicy` is set to `automated`. It will automatically prune resources resources that have been removed from the Git repo, but will not automatically correct resources that deviate from the definition stored in the repo, i.e manual changes made using `kubectl` will not be "healed". 280 | 281 | Apply the Application CR by running the following command: 282 | 283 | [.console-input] 284 | [source,bash,subs="attributes+,+macros"] 285 | ---- 286 | kubectl apply -f documentation/modules/ROOT/examples/bgd-app/bgd-app.yaml 287 | ---- 288 | -- 289 | ==== 290 | 291 | 292 | The newly created Application appears as a tile with the title `bgd-app` in the Argo CD UI. 293 | 294 | image::argocd-app1.png[SampleApp] 295 | 296 | Clicking on this tile takes you to the application details page. You may see it as still progressing or fully synced. 297 | 298 | image::argocd-app2.png[SampleApp] 299 | 300 | NOTE: You may have to click on `show hidden resources` on this page to see all of the resources. 301 | 302 | At this point the application should be up and running. Verify that the resources were created: 303 | 304 | [.console-input] 305 | [source,bash,subs="attributes+,+macros"] 306 | ---- 307 | kubectl get all -n bgd 308 | ---- 309 | 310 | The output should list a Service, Deployment, and Pod: 311 | 312 | [.console-output] 313 | [source,bash,subs="attributes+,+macros"] 314 | ---- 315 | NAME READY STATUS RESTARTS AGE 316 | pod/bgd-788cb756f7-kz448 1/1 Running 0 10m 317 | 318 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE 319 | service/bgd ClusterIP 172.30.111.118 8080/TCP 10m 320 | 321 | NAME READY UP-TO-DATE AVAILABLE AGE 322 | deployment.apps/bgd 1/1 1 1 10m 323 | ---- 324 | 325 | Verify the the rollout is complete: 326 | 327 | [.console-input] 328 | [source,bash,subs="attributes+,+macros"] 329 | ---- 330 | kubectl rollout status deploy/bgd -n bgd 331 | ---- 332 | 333 | Obtain the URL, and visit your application in a web browser: 334 | 335 | 336 | [tabs, subs="attributes+,+macros"] 337 | ==== 338 | Minikube:: 339 | + 340 | -- 341 | Add Minikube IP (`minikube ip`) and the Ingress hostname `bgd.devnation` to your Host file, like `/etc/hosts`. 342 | 343 | Example: 344 | [source,bash,subs="attributes+,+macros"] 345 | ---- 346 | 192.168.39.242 bgd.devnation 347 | ---- 348 | 349 | -- 350 | OpenShift:: 351 | + 352 | -- 353 | From *Web Console*, select *bgd* project from drop-down menu, then click to the application's Route to access it. 354 | 355 | image::bgdapp.png[BGD App] 356 | 357 | Alternatively, get app Route from CLI: 358 | 359 | [.console-input] 360 | [source,bash,subs="attributes+,+macros"] 361 | ---- 362 | oc get route bgd -n bgd -o jsonpath='{.spec.host}{"\n"}' 363 | ---- 364 | -- 365 | ==== 366 | 367 | Your application should look like this. 368 | 369 | image::bgd.png[SampleApp] 370 | 371 | === Addressing Configuration Drift 372 | 373 | Let's introduce a change in the application environment! Patch the live Deployment manifest to change the color 374 | of the bubbles in the application from blue to green: 375 | 376 | [.console-input] 377 | [source,bash,subs="attributes+,+macros"] 378 | ---- 379 | kubectl -n bgd patch deploy/bgd --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/env/0/value", "value":"green"}]' 380 | ---- 381 | 382 | Wait for the rollout to happen: 383 | 384 | [.console-input] 385 | [source,bash,subs="attributes+,+macros"] 386 | ---- 387 | kubectl rollout status deploy/bgd -n bgd 388 | ---- 389 | 390 | Refresh the tab where your application is running. You should see green bubbles. 391 | 392 | image::bgd-green.png[BDG Green] 393 | 394 | Looking over at your Argo CD Web UI, you can see that Argo detects your 395 | application as "Out of Sync". 396 | 397 | image::out-of-sync.png[Out of Sync] 398 | 399 | You can sync your app via the Argo CD by: 400 | 401 | * First clicking `SYNC` 402 | * Then clicking `SYNCHRONIZE` 403 | 404 | Alternatively, you can run the following command: 405 | 406 | [.console-input] 407 | [source,bash,subs="attributes+,+macros"] 408 | ---- 409 | argocd app sync bgd-app 410 | ---- 411 | 412 | After the sync process is done, the Argo CD UI should mark the application as in sync. 413 | 414 | image::fullysynced.png[Fully Synced] 415 | 416 | Reload the page on the tab where the application is running. The bubbles should have returned to their original blue color. 417 | 418 | image::bgd.png[BDG App] 419 | 420 | You can setup Argo CD to automatically correct drift by setting the 421 | `Application` manifest to do so. Example: 422 | 423 | [.console-input] 424 | [source,yaml,subs="attributes+,+macros"] 425 | ---- 426 | spec: 427 | syncPolicy: 428 | automated: 429 | prune: true 430 | selfHeal: true 431 | ---- 432 | 433 | Or, as in our case, after the fact by running the following command: 434 | 435 | [tabs, subs="attributes+,+macros"] 436 | ==== 437 | Minikube:: 438 | + 439 | -- 440 | [.console-input] 441 | [source,bash,subs="attributes+,+macros"] 442 | ---- 443 | kubectl patch application/bgd-app -n argocd --type=merge -p='{"spec":{"syncPolicy":{"automated":{"prune":true,"selfHeal":true}}}}' 444 | ---- 445 | -- 446 | OpenShift:: 447 | + 448 | -- 449 | [.console-input] 450 | [source,bash,subs="attributes+,+macros"] 451 | ---- 452 | kubectl patch application/bgd-app -n openshift-gitops --type=merge -p='{"spec":{"syncPolicy":{"automated":{"prune":true,"selfHeal":true}}}}' 453 | ---- 454 | -- 455 | ==== 456 | 457 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/pages/04-syncwaves-hooks.adoc: -------------------------------------------------------------------------------- 1 | = SyncWaves and Hooks 2 | include::_attributes.adoc[] 3 | 4 | https://argoproj.github.io/argo-cd/user-guide/sync-waves/[Syncwaves,window='_blank'] are used in Argo CD to order how manifests are applied to the cluster. 5 | 6 | On the other hand https://argoproj.github.io/argo-cd/user-guide/resource_hooks/[resource hooks,window='_blank'] breaks up the delivery of these manifests in different phases. 7 | 8 | Using a combination of syncwaves and resource hooks, you can control how your application rolls out. 9 | 10 | This example will take you through the following steps: 11 | 12 | * Using Syncwaves to order deployment 13 | * Exploring Resource Hooks 14 | * Using Syncwaves and Hooks together 15 | 16 | The sample application that we will deploy is a TODO application with a database and apart from deployment files, syncwaves and resource hooks are used: 17 | 18 | image::todo-app.png[] 19 | 20 | [#using_syncwaves] 21 | == Using Sync Waves 22 | 23 | A Syncwave is a way to order how Argo CD applies the manifests that are stored in git. All manifests have a wave of zero by default, but you can set these by using the `argocd.argoproj.io/sync-wave` annotation. 24 | 25 | Example: 26 | 27 | [.console-input] 28 | [source,yaml,subs="attributes+,+macros"] 29 | ---- 30 | metadata: 31 | annotations: 32 | argocd.argoproj.io/sync-wave: "2" 33 | ---- 34 | 35 | The wave can also be negative as well. 36 | 37 | [.console-input] 38 | [source,yaml,subs="attributes+,+macros"] 39 | ---- 40 | metadata: 41 | annotations: 42 | argocd.argoproj.io/sync-wave: "-5" 43 | ---- 44 | 45 | When Argo CD starts a sync action, the manifest get placed in the following order: 46 | 47 | * The Phase that they're in (we'll cover phases in the next section) 48 | * The wave the resource is annotated in (starting from the lowest value to the highest) 49 | * By kind (Namespaces first, then services, then deployments, etc ...) 50 | * By name (ascending order) 51 | 52 | Read more about syncwaves on the https://argoproj.github.io/argo-cd/user-guide/sync-waves/#how-do-i-configure-waves[official documentation site,window='_blank']. 53 | 54 | [#exploring_the_manifests] 55 | === Exploring the Manifests 56 | 57 | The sample application that we will deploy has the following manifests: 58 | 59 | The *Namespace* with syncwave as *-1*: 60 | 61 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/todo-namespace.yaml[todo-namespace.yaml,window='_blank'] 62 | [source,yaml,subs="+macros,attributes+"] 63 | ---- 64 | include::ROOT:example$todo-yaml/todo-namespace.yaml[] 65 | ---- 66 | 67 | The *PostgreSQL* with syncwave as *0*: 68 | 69 | [tabs, subs="attributes+,+macros"] 70 | ==== 71 | Minikube:: 72 | + 73 | -- 74 | The *PostgreSQL deployment* with syncwave as *0*: 75 | 76 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/minikube/apps/todo/postgresql-deployment.yaml[postgresql-deployment.yaml,window='_blank'] 77 | [source,yaml,subs="+macros,attributes+"] 78 | ---- 79 | include::ROOT:example$minikube/todo-yaml/postgresql-deployment.yaml[] 80 | ---- 81 | 82 | The *PostgreSQL Service* with syncwave as *0*: 83 | 84 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/minikube/apps/todo/postgresql-service.yaml[postgresql-service.yaml,window='_blank'] 85 | [source,yaml,subs="+macros,attributes+"] 86 | ---- 87 | include::ROOT:example$minikube/todo-yaml/postgresql-service.yaml[] 88 | ---- 89 | 90 | -- 91 | OpenShift:: 92 | + 93 | -- 94 | The *PostgreSQL deployment* with syncwave as *0*: 95 | 96 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/postgres-deployment.yaml[postgres-deployment.yaml,window='_blank'] 97 | [source,yaml,subs="+macros,attributes+"] 98 | ---- 99 | include::ROOT:example$todo-yaml/postgres-deployment.yaml[] 100 | ---- 101 | 102 | The *PostgreSQL Service* with syncwave as *0*: 103 | 104 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/postgres-service.yaml[postgres-service.yaml,window='_blank'] 105 | [source,yaml,subs="+macros,attributes+"] 106 | ---- 107 | include::ROOT:example$todo-yaml/postgres-service.yaml[] 108 | ---- 109 | 110 | -- 111 | ==== 112 | 113 | The *Database table creation* with syncwave as *1*: 114 | 115 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/postgres-create-table.yaml[postgres-create-table.yaml,window='_blank'] 116 | [source,yaml,subs="+macros,attributes+"] 117 | ---- 118 | include::ROOT:example$todo-yaml/postgres-create-table.yaml[] 119 | ---- 120 | 121 | The *TODO application deployment* with syncwave as *2*: 122 | 123 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/todo-deployment.yaml[todo-deployment.yaml,window='_blank'] 124 | [source,yaml,subs="+macros,attributes+"] 125 | ---- 126 | include::ROOT:example$todo-yaml/todo-deployment.yaml[] 127 | ---- 128 | 129 | The *TODO network*: 130 | 131 | [tabs, subs="attributes+,+macros"] 132 | ==== 133 | Minikube:: 134 | + 135 | -- 136 | The *TODO Service* with syncwave as *2*: 137 | 138 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/minikube/apps/todo/todo-service.yaml[todo-service.yaml,window='_blank'] 139 | [source,yaml,subs="+macros,attributes+"] 140 | ---- 141 | include::ROOT:example$minikube/todo-yaml/todo-service.yaml[] 142 | ---- 143 | 144 | The *TODO Ingress* configuration with syncwave as *3*: 145 | 146 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/minikube/apps/todo/todo-ingress.yaml[todo-ingress.yaml,window='_blank'] 147 | [source,yaml,subs="+macros,attributes+"] 148 | ---- 149 | include::ROOT:example$minikube/todo-yaml/todo-ingress.yaml[] 150 | ---- 151 | 152 | Add Minikube IP (`minikube ip`) and the Ingress hostname `todo.devnation` to your Host file, like `/etc/hosts`. 153 | 154 | Example: 155 | [source,bash,subs="attributes+,+macros"] 156 | ---- 157 | 192.168.39.242 bgd.devnation bgdx.devnation todo.devnation 158 | ---- 159 | 160 | -- 161 | OpenShift:: 162 | + 163 | -- 164 | The *TODO Service* with syncwave as *2*: 165 | 166 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/todo-service.yaml[todo-service.yaml,window='_blank'] 167 | [source,yaml,subs="+macros,attributes+"] 168 | ---- 169 | include::ROOT:example$todo-yaml/todo-service.yaml[] 170 | ---- 171 | 172 | The *TODO Route* configuration with syncwave as *3*: 173 | 174 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/todo-route.yaml[todo-route.yaml,window='_blank'] 175 | [source,yaml,subs="+macros,attributes+"] 176 | ---- 177 | include::ROOT:example$todo-yaml/todo-route.yaml[] 178 | ---- 179 | -- 180 | ==== 181 | 182 | Argo CD will apply the Namespace first (since it's the lowest value), and make sure it returns a "healthy" status before moving on. 183 | 184 | Next, the PostgreSQL Deployment will be applied. After that reports healthy will continue with the rest of resources. 185 | 186 | NOTE: Argo CD won't apply the next manifest until the previous reports "healthy". 187 | 188 | [#exploring_resource_hooks] 189 | == Exploring Resource Hooks 190 | 191 | Now that you're familiar with syncwaves, we can begin exploring applying 192 | manifests in phases using `resource hooks`. 193 | 194 | Controlling your sync operation can be further redefined by using 195 | hooks. These hooks can run before, during, and after a sync 196 | operation. These hooks are: 197 | 198 | * **PreSync** - Runs before the sync operation. This can be something like a database backup before a schema change 199 | * **Sync** - Runs after `PreSync` has successfully ran. This will run alongside your normal manifests. 200 | * **PostSync** - Runs after `Sync` has ran successfully. This can be something like a Slack message or an email notification. 201 | * **SyncFail** - Runs if the `Sync` operation as failed. This is also used to send notifications or do other evasive actions. 202 | 203 | To enable a sync, annotate the specific object manifest with 204 | `argocd.argoproj.io/hook` with the type of sync you want to use for that 205 | resource. For example, if I wanted to use the `PreSync` hook: 206 | 207 | [.console-input] 208 | [source,yaml,subs="attributes+,+macros"] 209 | ---- 210 | metadata: 211 | annotations: 212 | argocd.argoproj.io/hook: PreSync 213 | ---- 214 | 215 | You can also have the hooks be deleted after a successful/unsuccessful run. 216 | 217 | * **HookSucceeded** - The resource will be deleted after it has succeeded. 218 | * **HookFailed** - The resource will be deleted if it has failed. 219 | * **BeforeHookCreation** - The resource will be deleted before a new one is created (when a new sync is triggered). 220 | 221 | You can apply these with the `argocd.argoproj.io/hook-delete-policy` 222 | annotation. For example 223 | 224 | [.console-input] 225 | [source,yaml,subs="attributes+,+macros"] 226 | ---- 227 | metadata: 228 | annotations: 229 | argocd.argoproj.io/hook: PostSync 230 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 231 | ---- 232 | 233 | IMPORTANT: Since a sync can fail in any phase, you can come to a situation where the application never reports healthy! 234 | 235 | Although hooks can be any resource, they are usually Pods and/or Jobs. 236 | 237 | To read more about resource hooks, consult the https://argoproj.github.io/argo-cd/user-guide/resource_hooks[official documentation] 238 | 239 | [#exploring_the_manifests_hooks] 240 | === Exploring Manifests 241 | 242 | Take a look at this `PostSync` manifest which sends an HTTP request to insert a new TODO item: 243 | 244 | .link:https://github.com/redhat-developer-demos/openshift-gitops-examples/blob/main/apps/todo/todo-insert-data.yaml[todo-insert-data.yaml,window='_blank'] 245 | [source,yaml,subs="+macros,attributes+"] 246 | ---- 247 | include::ROOT:example$todo-yaml/todo-insert-data.yaml[] 248 | ---- 249 | <1> This means that this Job will run in the `PostSync` phase, after the application of the manifests in the `Sync` phase. 250 | 251 | IMPORTANT: Since I don't have a deletion policy, this job will "stick around" after completion. 252 | 253 | The execution order can be seen in the following diagram: 254 | 255 | image::presyncpost.png[] 256 | 257 | [#deploying_the_application_hooks] 258 | === Deploying The Application 259 | 260 | You can see all deployment files by https://github.com/redhat-developer-demos/openshift-gitops-examples/tree/main/apps/todo[visiting the repo,window='_blank']. 261 | 262 | Taking a look at this manifest file: `todo-application.yaml`: 263 | 264 | [tabs, subs="attributes+,+macros"] 265 | ==== 266 | Minikube:: 267 | + 268 | -- 269 | .link:https://github.com/redhat-scholars/argocd-tutorial/blob/master/documentation/modules/ROOT/examples/minikube/todo-yaml/todo-application.yaml[todo-application.yaml,window='_blank'] 270 | [source,yaml,subs="+macros,attributes+"] 271 | ---- 272 | include::ROOT:example$minikube/todo-yaml/todo-application.yaml[] 273 | ---- 274 | 275 | It will show that this will deploy the application in the `todo` 276 | namespace. 277 | 278 | Create this application: 279 | 280 | [.console-input] 281 | [source,bash,subs="attributes+,+macros"] 282 | ---- 283 | kubectl apply -f documentation/modules/ROOT/examples/minikube/todo-yaml/todo-application.yaml 284 | ---- 285 | 286 | -- 287 | OpenShift:: 288 | + 289 | -- 290 | .link:https://github.com/redhat-scholars/argocd-tutorial/blob/master/documentation/modules/ROOT/examples/todo-yaml/todo-application.yaml[todo-application.yaml,window='_blank'] 291 | [source,yaml,subs="+macros,attributes+"] 292 | ---- 293 | include::ROOT:example$todo-yaml/todo-application.yaml[] 294 | ---- 295 | 296 | It will show that this will deploy the application in the `todo` 297 | namespace. 298 | 299 | Create this application: 300 | 301 | [.console-input] 302 | [source,bash,subs="attributes+,+macros"] 303 | ---- 304 | kubectl apply -f documentation/modules/ROOT/examples/todo-yaml/todo-application.yaml 305 | ---- 306 | -- 307 | ==== 308 | 309 | [.console-output] 310 | [source,bash,subs="attributes+,+macros"] 311 | ---- 312 | application.argoproj.io/todo-app created 313 | ---- 314 | 315 | On the Argo CD WebUI, you should see another application appear. 316 | 317 | image::todo-card.png[TODO Card] 318 | 319 | Clicking on this "card" should take you over to the tree view. 320 | 321 | image::todo-argocd.png[TODO Tree] 322 | 323 | Observe the sync process. You will see the order that the resource has been applied, first the namespace creation and last the creation of Route to access the application. 324 | 325 | Once the application is fully synced. Take a look at the pods and jobs in 326 | the namespace: 327 | 328 | [.console-input] 329 | [source,bash,subs="attributes+,+macros"] 330 | ---- 331 | kubectl get pods -n todo 332 | ---- 333 | 334 | You should see that the Job is finished, but still there. 335 | 336 | [.console-output] 337 | [source,bash,subs="attributes+,+macros"] 338 | ---- 339 | NAME READY STATUS RESTARTS AGE 340 | postgresql-599467fd86-cgj9v 1/1 Running 0 32s 341 | todo-gitops-679d88f6f4-v4djp 1/1 Running 0 19s 342 | todo-table-xhddk 0/1 Completed 0 27s 343 | ---- 344 | 345 | Your application should look like this. 346 | 347 | image::todo-app-screenshot.png[TODO] 348 | 349 | The `todo-insert` Job is not shown as it was configured to be deleted if succeeded: 350 | 351 | [source, yaml] 352 | ---- 353 | argocd.argoproj.io/hook-delete-policy: HookSucceeded 354 | ---- -------------------------------------------------------------------------------- /documentation/modules/ROOT/pages/_attributes.adoc: -------------------------------------------------------------------------------- 1 | :experimental: 2 | :source-highlighter: highlightjs 3 | :branch: master 4 | :github-repo: https://github.com/redhat-scholars/argocd-tutorial/blob/{branch} 5 | :profile: gitops 6 | :minikube-version: v1.20.0 7 | :kubernetes-version: v1.20.2 8 | :argocd-version: v2.0.0 9 | :kustomize-version: v4.1.2 -------------------------------------------------------------------------------- /documentation/modules/ROOT/pages/index.adoc: -------------------------------------------------------------------------------- 1 | = Welcome to the Argo CD Tutorial 2 | :page-layout: home 3 | :!sectids: 4 | 5 | [.text-center.strong] 6 | == Argo CD 7 | 8 | https://argoproj.github.io/argo-cd/[Argo CD,window='_blank'] is a declarative, GitOps continuous delivery tool for Kubernetes. 9 | 10 | It follows the **GitOps** pattern of using Git repositories as the source of truth for defining the desired application state. 11 | 12 | It automates the deployment of the desired application states in the specified target environments. Application deployments can track updates to branches, tags, or be pinned to a specific version of manifests at a Git commit. 13 | 14 | image::argocd-sync-flow.png[Argo CD Sync Flow, 700] 15 | 16 | 17 | == GitOps 18 | 19 | https://www.openshift.com/learn/topics/gitops/[GitOps,window='_blank'] is a set of practices that leverages Git workflows to manage infrastructure and application configurations. 20 | By using Git repositories as the source of truth, it allows the DevOps team to store the entire state of the cluster configuration in Git so that the trail of changes are visible and auditable. 21 | 22 | **GitOps** simplifies the propagation of infrastructure and application 23 | configuration changes across multiple clusters by defining your infrastructure and applications definitions as “code”. 24 | 25 | * Ensure that the clusters have similar states for configuration, monitoring, or storage. 26 | * Recover or recreate clusters from a known state. 27 | * Create clusters with a known state. 28 | * Apply or revert configuration changes to multiple clusters. 29 | * Associate templated configuration with different environments. 30 | -------------------------------------------------------------------------------- /documentation/modules/ROOT/partials/exec_pod.adoc: -------------------------------------------------------------------------------- 1 | Check that the pod is up and running: 2 | 3 | [.lines_space] 4 | [.console-input] 5 | [source,bash, subs="+macros,+attributes"] 6 | ---- 7 | kubectl get pods 8 | ---- 9 | 10 | [.console-output] 11 | [source,bash,subs="+macros,+attributes"] 12 | ---- 13 | NAME READY STATUS RESTARTS AGE 14 | {podname} 1/1 Running 0 5s 15 | ---- 16 | 17 | Then let's go into the running pod to execute some commands: 18 | 19 | [.console-input] 20 | [source,bash, subs="+macros,+attributes"] 21 | ---- 22 | kubectl exec -ti {podname} /bin/bash 23 | ---- 24 | 25 | NOTE: Change the pod name with your pod name. -------------------------------------------------------------------------------- /gulpfile.babel.js: -------------------------------------------------------------------------------- 1 | /*jshint esversion: 6 */ 2 | 3 | import { series, watch } from "gulp"; 4 | import { remove } from "fs-extra"; 5 | import { readFileSync } from "fs"; 6 | import {load as yamlLoad} from "yaml-js"; 7 | import generator from "@antora/site-generator-default"; 8 | import browserSync from "browser-sync"; 9 | 10 | const filename = "dev-site.yml"; 11 | const server = browserSync.create(); 12 | const args = ["--playbook", filename]; 13 | 14 | //Watch Paths 15 | function watchGlobs() { 16 | let json_content = readFileSync(`${__dirname}/${filename}`, "UTF-8"); 17 | let yaml_content = yamlLoad(json_content); 18 | let dirs = yaml_content.content.sources.map(source => [ 19 | `${source.url}/**/**.yml`, 20 | `${source.url}/**/**.adoc`, 21 | `${source.url}/**/**.hbs` 22 | ]); 23 | dirs.push(["dev-site.yml"]); 24 | dirs = [].concat(...dirs); 25 | //console.log(dirs); 26 | return dirs; 27 | } 28 | 29 | const siteWatch = () => watch(watchGlobs(), series(build, reload)); 30 | 31 | const removeSite = done => remove("gh-pages", done); 32 | const removeCache = done => remove(".cache", done); 33 | 34 | function build(done) { 35 | generator(args, process.env) 36 | .then(() => { 37 | done(); 38 | }) 39 | .catch(err => { 40 | console.log(err); 41 | done(); 42 | }); 43 | } 44 | 45 | function workshopSite(done){ 46 | generator(["--pull", "--stacktrace","--playbook","workshop-site.yaml"], process.env) 47 | .then(() => { 48 | done(); 49 | }) 50 | .catch(err => { 51 | console.log(err); 52 | done(); 53 | }); 54 | } 55 | 56 | function reload(done) { 57 | server.reload(); 58 | done(); 59 | } 60 | 61 | function serve(done) { 62 | server.init({ 63 | server: { 64 | baseDir: "./gh-pages" 65 | } 66 | }); 67 | done(); 68 | } 69 | 70 | const _build = build; 71 | export { _build as build }; 72 | const _clean = series(removeSite, removeCache); 73 | export { _clean as clean }; 74 | const _default = series(_clean, build, serve, siteWatch); 75 | export { _default as default }; 76 | //build workshop docs 77 | const _wsite = series(_clean, workshopSite); 78 | export { _wsite as workshopSite }; -------------------------------------------------------------------------------- /lib/remote-include-processor.js: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | this.includeProcessor(function () { 3 | this.$option('position', '>>') 4 | this.handles((target) => target.startsWith('http')) 5 | this.process((doc, reader, target, attrs) => { 6 | const contents = require('child_process').execFileSync('curl', ['--silent', '-L', target], { encoding: 'utf8' }) 7 | reader.pushInclude(contents, target, target, 1, attrs) 8 | }) 9 | }) 10 | } 11 | -------------------------------------------------------------------------------- /lib/tab-block.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 OpenDevise, Inc. 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 | 7 | /** 8 | * Extends the AsciiDoc syntax to support a tabset. The tabset is created from 9 | * a dlist enclosed in an example block that is marked with the tabs style. 10 | * 11 | * Usage: 12 | * 13 | * [tabs] 14 | * ==== 15 | * Tab A:: 16 | * + 17 | * -- 18 | * Contents of tab A. 19 | * -- 20 | * Tab B:: 21 | * + 22 | * -- 23 | * Contents of tab B. 24 | * -- 25 | * ==== 26 | * 27 | * @author Dan Allen 28 | */ 29 | const IdSeparatorCh = "-"; 30 | const ExtraIdSeparatorsRx = /^-+|-+$|-(-)+/g; 31 | const InvalidIdCharsRx = /[^a-zA-Z0-9_]/g; 32 | const List = Opal.const_get_local(Opal.module(null, "Asciidoctor"), "List"); 33 | const ListItem = Opal.const_get_local( 34 | Opal.module(null, "Asciidoctor"), 35 | "ListItem" 36 | ); 37 | 38 | const generateId = (str, idx) => 39 | `tabset${idx}_${str 40 | .toLowerCase() 41 | .replace(InvalidIdCharsRx, IdSeparatorCh) 42 | .replace(ExtraIdSeparatorsRx, "$1")}`; 43 | 44 | function tabsBlock() { 45 | this.onContext("example"); 46 | this.process((parent, reader, attrs) => { 47 | const createHtmlFragment = html => this.createBlock(parent, "pass", html); 48 | const tabsetIdx = parent.getDocument().counter("idx-tabset"); 49 | const nodes = []; 50 | nodes.push(createHtmlFragment('
')); 51 | const container = this.parseContent( 52 | this.createBlock(parent, "open"), 53 | reader 54 | ); 55 | const sourceTabs = container.getBlocks()[0]; 56 | if ( 57 | !( 58 | sourceTabs && 59 | sourceTabs.getContext() === "dlist" && 60 | sourceTabs.getItems().length 61 | ) 62 | ) 63 | return; 64 | const tabs = List.$new(parent, "ulist"); 65 | tabs.addRole("tabs"); 66 | const panes = {}; 67 | sourceTabs.getItems().forEach(([[title], details]) => { 68 | const tab = ListItem.$new(tabs); 69 | tabs.$append(tab); 70 | const id = generateId(title.getText(), tabsetIdx); 71 | tab.text = `[[${id}]]${title.text}`; 72 | let blocks = details.getBlocks(); 73 | const numBlocks = blocks.length; 74 | if (numBlocks) { 75 | if (blocks[0].context === "open" && numBlocks === 1) 76 | blocks = blocks[0].getBlocks(); 77 | panes[id] = blocks.map(block => (block.parent = parent) && block); 78 | } 79 | }); 80 | nodes.push(tabs); 81 | nodes.push(createHtmlFragment('
')); 82 | Object.entries(panes).forEach(([id, blocks]) => { 83 | nodes.push( 84 | createHtmlFragment(`
`) 85 | ); 86 | nodes.push(...blocks); 87 | nodes.push(createHtmlFragment("
")); 88 | }); 89 | nodes.push(createHtmlFragment("
")); 90 | nodes.push(createHtmlFragment("
")); 91 | parent.blocks.push(...nodes); 92 | }); 93 | } 94 | 95 | function register(registry, context) { 96 | registry.block("tabs", tabsBlock); 97 | } 98 | 99 | module.exports.register = register; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rhs-openshift-admins-devops", 3 | "description": "OpenShift Admins Devops Course Documentation Site", 4 | "homepage": "https://redhat-scholars.github.io/openshift-admins-devops", 5 | "author": { 6 | "email": "kamesh.sampath@hotmail.com", 7 | "name": "Kamesh Sampath", 8 | "url": "https://twitter.com/@kamesh_sampath" 9 | }, 10 | "dependencies": { 11 | "@antora/cli": "^2.3.1", 12 | "@antora/site-generator-default": "^2.3.1", 13 | "@babel/cli": "^7.5.5", 14 | "@babel/core": "^7.5.5", 15 | "@babel/polyfill": "^7.4.4", 16 | "@babel/preset-env": "^7.5.5", 17 | "@babel/register": "^7.5.5", 18 | "browser-sync": "^2.26.7", 19 | "fs-extra": "^8.1.0", 20 | "gulp": "^4.0.0", 21 | "yaml-js": "^0.2.3" 22 | }, 23 | "devDependencies": {}, 24 | "scripts": { 25 | "dev": "gulp", 26 | "clean": "gulp clean", 27 | "workshop": "gulp workshopSite" 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/redhat-scholars/openshift-admins-devops.git" 32 | }, 33 | "license": "Apache-2.0", 34 | "babel": { 35 | "presets": [ 36 | "@babel/preset-env" 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /site.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | _CURR_DIR="$( cd "$(dirname "$0")" ; pwd -P )" 4 | rm -rf $_CURR_DIR/gh-pages $_CURR_DIR/.cache 5 | 6 | antora --pull --stacktrace site.yml -------------------------------------------------------------------------------- /site.yml: -------------------------------------------------------------------------------- 1 | runtime: 2 | cache_dir: ./.cache/antora 3 | 4 | site: 5 | title: ArgoCD Tutorial 6 | url: https://redhat-scholars.github.io/argocd-tutorial 7 | start_page: argocd-tutorial::index.adoc 8 | 9 | content: 10 | sources: 11 | - url: git@github.com:redhat-scholars/argocd-tutorial.git 12 | tags: [] 13 | branches: ["master"] 14 | start_path: documentation 15 | 16 | asciidoc: 17 | attributes: 18 | release-version: master 19 | page-pagination: true 20 | extensions: 21 | - ./lib/tab-block.js 22 | - ./lib/remote-include-processor.js 23 | 24 | ui: 25 | bundle: 26 | url: https://github.com/redhat-developer-demos/rhd-tutorial-ui/releases/download/v0.1.10/ui-bundle.zip 27 | snapshot: true 28 | supplemental_files: 29 | - path: ./supplemental-ui 30 | - path: .nojekyll 31 | - path: ui.yml 32 | contents: "static_files: [ .nojekyll ]" 33 | 34 | output: 35 | dir: ./gh-pages 36 | -------------------------------------------------------------------------------- /supplemental-ui/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/supplemental-ui/.nojekyll -------------------------------------------------------------------------------- /supplemental-ui/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redhat-scholars/argocd-tutorial/67b0019d236bf0d9ebb046b0fb5faaff8f5463d0/supplemental-ui/img/favicon.ico -------------------------------------------------------------------------------- /supplemental-ui/partials/footer-nav.hbs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /supplemental-ui/ui.yml: -------------------------------------------------------------------------------- 1 | static_files: 2 | - .nojekyll -------------------------------------------------------------------------------- /vscode-asciidoc-extra.json: -------------------------------------------------------------------------------- 1 | { 2 | "Add Tabs": { 3 | "prefix": "tabs", 4 | "body": [ 5 | "[tabs]", 6 | "====", 7 | "${1:tab1}::", 8 | "+", 9 | "--", 10 | "--", 11 | "${2:tab2}::", 12 | "+", 13 | "--", 14 | "--", 15 | "====" 16 | ], 17 | "description": "Add Tabs macro" 18 | }, 19 | "Add Navigation": { 20 | "prefix": "nav", 21 | "body": [ 22 | "${1|*,**,***|} xref:${2:page.adoc}[${3:Nav Title}]" 23 | ], 24 | "description": "Add new navigation" 25 | }, 26 | "Console Input": { 27 | "prefix": "input", 28 | "body": [ 29 | "[.console-input]", 30 | "[source,${1:bash}]", 31 | "----", 32 | "${2:echo \"Hello World\"}", 33 | "----" 34 | ], 35 | "description": "Adds Console Input source fragment" 36 | }, 37 | "Console Output": { 38 | "prefix": "output", 39 | "body": [ 40 | "[.console-output]", 41 | "[source,${1:bash}]", 42 | "----", 43 | "${2:\"Hello World\"}", 44 | "----" 45 | ], 46 | "description": "Adds Console Output source fragment" 47 | } 48 | } --------------------------------------------------------------------------------