├── .gitignore ├── apps └── bubbles-frontend │ ├── .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.legacy-jar │ │ ├── Dockerfile.native │ │ └── Dockerfile.native-distroless │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── BubbleResource.java │ ├── kubernetes │ │ ├── Deployment.yaml │ │ └── Service.yaml │ └── resources │ │ ├── META-INF │ │ └── resources │ │ │ ├── index.html │ │ │ ├── script.js │ │ │ └── style.css │ │ └── application.properties │ └── test │ └── resources │ └── virtual-service.json ├── ch07 ├── bgd │ ├── bgd-deployment.yaml │ ├── bgd-ns.yaml │ └── bgd-svc.yaml ├── bgdh │ ├── .helmignore │ ├── Chart.yaml │ ├── templates │ │ ├── NOTES.txt │ │ ├── _helpers.tpl │ │ ├── deployment.yaml │ │ ├── ns.yaml │ │ ├── service.yaml │ │ ├── serviceaccount.yaml │ │ └── tests │ │ │ └── test-connection.yaml │ └── values.yaml ├── bgdk │ ├── base │ │ ├── bgd-deployment.yaml │ │ ├── bgd-svc.yaml │ │ └── kustomization.yaml │ └── bgdk │ │ ├── bgdk-ns.yaml │ │ └── kustomization.yaml ├── bgdui │ ├── base │ │ ├── bgd-deployment.yaml │ │ ├── bgd-svc.yaml │ │ └── kustomization.yaml │ └── bgdk │ │ ├── .argocd-source-bgdk-app.yaml │ │ ├── bgdk-ns.yaml │ │ └── kustomization.yaml └── todo │ ├── postgres-create-table.yaml │ ├── postgres-deployment.yaml │ ├── postgres-service.yaml │ ├── todo-deployment.yaml │ ├── todo-insert-data.yaml │ ├── todo-namespace.yaml │ └── todo-service.yaml └── ch08 ├── bgd-gen ├── prod │ └── bgd-deployment.yaml └── staging │ └── bgd-deployment.yaml └── bgd-pr └── bgd-deployment.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .vscode/ 3 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* 5 | !target/quarkus-app/* -------------------------------------------------------------------------------- /apps/bubbles-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | #Maven 2 | target/ 3 | pom.xml.tag 4 | pom.xml.releaseBackup 5 | pom.xml.versionsBackup 6 | release.properties 7 | 8 | # Eclipse 9 | .project 10 | .classpath 11 | .settings/ 12 | bin/ 13 | 14 | # IntelliJ 15 | .idea 16 | *.ipr 17 | *.iml 18 | *.iws 19 | 20 | # NetBeans 21 | nb-configuration.xml 22 | 23 | # Visual Studio Code 24 | .vscode 25 | .factorypath 26 | 27 | # OSX 28 | .DS_Store 29 | 30 | # Vim 31 | *.swp 32 | *.swo 33 | 34 | # patch 35 | *.orig 36 | *.rej 37 | 38 | # Local environment 39 | .env 40 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/.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 | * https://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/bubbles-frontend/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gitops-cookbook/gitops-cookbook-sc/3e63da1e346378754db5c071be1604fcdb64c499/apps/bubbles-frontend/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /apps/bubbles-frontend/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-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/bubbles-frontend/README.md: -------------------------------------------------------------------------------- 1 | # bubbles-frontend 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 | > **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. 15 | 16 | ## Packaging and running the application 17 | 18 | The application can be packaged using: 19 | ```shell script 20 | ./mvnw package 21 | ``` 22 | It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. 23 | Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. 24 | 25 | The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. 26 | 27 | If you want to build an _über-jar_, execute the following command: 28 | ```shell script 29 | ./mvnw package -Dquarkus.package.type=uber-jar 30 | ``` 31 | 32 | The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. 33 | 34 | ## Creating a native executable 35 | 36 | You can create a native executable using: 37 | ```shell script 38 | ./mvnw package -Pnative 39 | ``` 40 | 41 | Or, if you don't have GraalVM installed, you can run the native executable build in a container using: 42 | ```shell script 43 | ./mvnw package -Pnative -Dquarkus.native.container-build=true 44 | ``` 45 | 46 | You can then execute your native executable with: `./target/bubbles-frontend-1.0.0-SNAPSHOT-runner` 47 | 48 | If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html. 49 | 50 | ## Provided Code 51 | 52 | ### RESTEasy JAX-RS 53 | 54 | Easily start your RESTful Web Services 55 | 56 | [Related guide section...](https://quarkus.io/guides/getting-started#the-jax-rs-resources) 57 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/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 | # https://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/bubbles-frontend/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 https://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/bubbles-frontend/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.acme 6 | bubbles-frontend 7 | 1.0.0-SNAPSHOT 8 | 9 | 3.8.1 10 | true 11 | 11 12 | 11 13 | UTF-8 14 | UTF-8 15 | quarkus-bom 16 | io.quarkus.platform 17 | 2.9.2.Final 18 | 3.0.0-M5 19 | 20 | 21 | 22 | 23 | ${quarkus.platform.group-id} 24 | ${quarkus.platform.artifact-id} 25 | ${quarkus.platform.version} 26 | pom 27 | import 28 | 29 | 30 | 31 | 32 | 33 | io.quarkus 34 | quarkus-kubernetes 35 | 36 | 37 | io.quarkus 38 | quarkus-container-image-jib 39 | 40 | 41 | io.quarkus 42 | quarkus-arc 43 | 44 | 45 | io.quarkus 46 | quarkus-resteasy 47 | 48 | 49 | 50 | io.quarkus 51 | quarkus-resteasy-jsonb 52 | 53 | 54 | 55 | io.quarkus 56 | quarkus-junit5 57 | test 58 | 59 | 60 | io.rest-assured 61 | rest-assured 62 | test 63 | 64 | 65 | 66 | 67 | 68 | ${quarkus.platform.group-id} 69 | quarkus-maven-plugin 70 | ${quarkus.platform.version} 71 | true 72 | 73 | 74 | 75 | build 76 | generate-code 77 | generate-code-tests 78 | 79 | 80 | 81 | 82 | 83 | maven-compiler-plugin 84 | ${compiler-plugin.version} 85 | 86 | ${maven.compiler.parameters} 87 | 88 | 89 | 90 | maven-surefire-plugin 91 | ${surefire-plugin.version} 92 | 93 | 94 | org.jboss.logmanager.LogManager 95 | ${maven.home} 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | istio 104 | 105 | 106 | istio 107 | 108 | 109 | 110 | 111 | 112 | com.coderplus.maven.plugins 113 | copy-rename-maven-plugin 114 | 1.0 115 | 116 | 117 | copy-and-rename-file 118 | compile 119 | 120 | rename 121 | 122 | 123 | ${project.build.outputDirectory}/META-INF/resources/script-istio.js 124 | ${project.build.outputDirectory}//META-INF/resources/script.js 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | v1.0-istio 133 | 134 | 135 | 136 | native 137 | 138 | 139 | native 140 | 141 | 142 | 143 | 144 | 145 | maven-failsafe-plugin 146 | ${surefire-plugin.version} 147 | 148 | 149 | 150 | integration-test 151 | verify 152 | 153 | 154 | 155 | ${project.build.directory}/${project.build.finalName}-runner 156 | org.jboss.logmanager.LogManager 157 | ${maven.home} 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | native 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/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 container image run: 5 | # 6 | # ./mvnw package 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.jvm -t quarkus/bubbles-frontend-jvm . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bubbles-frontend-jvm 15 | # 16 | # If you want to include the debug port into your docker image 17 | # you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 18 | # 19 | # Then run the container using : 20 | # 21 | # docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/bubbles-frontend-jvm 22 | # 23 | ### 24 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 25 | 26 | ARG JAVA_PACKAGE=java-11-openjdk-headless 27 | ARG RUN_JAVA_VERSION=1.3.8 28 | ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' 29 | # Install java and the run-java script 30 | # Also set up permissions for user `1001` 31 | RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ 32 | && microdnf update \ 33 | && microdnf clean all \ 34 | && mkdir /deployments \ 35 | && chown 1001 /deployments \ 36 | && chmod "g+rwX" /deployments \ 37 | && chown 1001:root /deployments \ 38 | && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ 39 | && chown 1001 /deployments/run-java.sh \ 40 | && chmod 540 /deployments/run-java.sh \ 41 | && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security 42 | 43 | # Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. 44 | ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" 45 | # We make four distinct layers so if there are application changes the library layers can be re-used 46 | COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ 47 | COPY --chown=1001 target/quarkus-app/*.jar /deployments/ 48 | COPY --chown=1001 target/quarkus-app/app/ /deployments/app/ 49 | COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/ 50 | 51 | EXPOSE 8080 52 | USER 1001 53 | 54 | ENTRYPOINT [ "/deployments/run-java.sh" ] 55 | 56 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/docker/Dockerfile.legacy-jar: -------------------------------------------------------------------------------- 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 container image run: 5 | # 6 | # ./mvnw package -Dquarkus.package.type=legacy-jar 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/bubbles-frontend-legacy-jar . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bubbles-frontend-legacy-jar 15 | # 16 | # If you want to include the debug port into your docker image 17 | # you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 18 | # 19 | # Then run the container using : 20 | # 21 | # docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/bubbles-frontend-legacy-jar 22 | # 23 | ### 24 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 25 | 26 | ARG JAVA_PACKAGE=java-11-openjdk-headless 27 | ARG RUN_JAVA_VERSION=1.3.8 28 | ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' 29 | # Install java and the run-java script 30 | # Also set up permissions for user `1001` 31 | RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ 32 | && microdnf update \ 33 | && microdnf clean all \ 34 | && mkdir /deployments \ 35 | && chown 1001 /deployments \ 36 | && chmod "g+rwX" /deployments \ 37 | && chown 1001:root /deployments \ 38 | && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ 39 | && chown 1001 /deployments/run-java.sh \ 40 | && chmod 540 /deployments/run-java.sh \ 41 | && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security 42 | 43 | # Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. 44 | ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" 45 | COPY target/lib/* /deployments/lib/ 46 | COPY target/*-runner.jar /deployments/app.jar 47 | 48 | EXPOSE 8080 49 | USER 1001 50 | 51 | ENTRYPOINT [ "/deployments/run-java.sh" ] 52 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/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 container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/bubbles-frontend . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bubbles-frontend 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/bubbles-frontend . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bubbles-frontend 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/java/org/acme/BubbleResource.java: -------------------------------------------------------------------------------- 1 | package org.acme; 2 | 3 | import javax.json.Json; 4 | import javax.json.JsonObject; 5 | import javax.json.JsonObjectBuilder; 6 | import javax.ws.rs.GET; 7 | import javax.ws.rs.Path; 8 | 9 | import org.eclipse.microprofile.config.inject.ConfigProperty; 10 | 11 | 12 | @Path("/bubble") 13 | public class BubbleResource { 14 | 15 | @ConfigProperty(name = "color", defaultValue = "blue") 16 | String color; 17 | 18 | @GET 19 | public JsonObject bubble() { 20 | JsonObjectBuilder color = Json 21 | .createObjectBuilder() 22 | .add("color", this.color); 23 | return color.build(); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/kubernetes/Deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: ServiceAccount 4 | metadata: 5 | name: bubblefrontend 6 | --- 7 | apiVersion: rbac.authorization.k8s.io/v1 8 | kind: RoleBinding 9 | metadata: 10 | name: bubblefrontend-view 11 | roleRef: 12 | kind: ClusterRole 13 | apiGroup: rbac.authorization.k8s.io 14 | name: view 15 | subjects: 16 | - kind: ServiceAccount 17 | name: bubblefrontend 18 | --- 19 | apiVersion: rbac.authorization.k8s.io/v1 20 | kind: Role 21 | metadata: 22 | name: view 23 | rules: 24 | - apiGroups: ["networking.istio.io"] 25 | resources: ["virtualservices"] 26 | verbs: ["list", "get"] 27 | --- 28 | apiVersion: apps/v1 29 | kind: Deployment 30 | metadata: 31 | labels: 32 | app: bubblefrontend 33 | version: v1 34 | name: bubblefrontend 35 | spec: 36 | replicas: 1 37 | selector: 38 | matchLabels: 39 | app: bubblefrontend 40 | version: v1 41 | template: 42 | metadata: 43 | labels: 44 | app: bubblefrontend 45 | version: v1 46 | annotations: 47 | sidecar.istio.io/inject: "true" 48 | spec: 49 | containers: 50 | - env: 51 | - name: JAVA_OPTIONS 52 | value: -Xms15m -Xmx15m -Xmn15m 53 | name: bubblefrontend 54 | image: quay.io/rhdevelopers/bubble-frontend:v1.0 55 | imagePullPolicy: Always 56 | ports: 57 | - containerPort: 8080 58 | name: http 59 | protocol: TCP 60 | - containerPort: 8778 61 | name: jolokia 62 | protocol: TCP 63 | - containerPort: 9779 64 | name: prometheus 65 | protocol: TCP 66 | securityContext: 67 | privileged: false 68 | serviceAccount: bubblefrontend -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/kubernetes/Service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: bubble-frontend 5 | labels: 6 | app: bubblefrontend 7 | spec: 8 | ports: 9 | - name: http 10 | port: 8080 11 | selector: 12 | app: bubblefrontend 13 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/resources/META-INF/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodePen - bubble animation 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/resources/META-INF/resources/script.js: -------------------------------------------------------------------------------- 1 | const root = document.querySelector("#app"); 2 | 3 | let { innerHeight, innerWidth } = window; 4 | console.log(innerHeight, innerWidth); 5 | if (innerHeight < 300) { 6 | innerHeight = 350; 7 | } 8 | if (innerWidth < 300) { 9 | innerWidth = 750; 10 | } 11 | 12 | class Bubble { 13 | constructor(color) { 14 | this.bubbleSpan = undefined; 15 | this.handleNewBubble(); 16 | this.color = color 17 | 18 | this.posY = this.randomNumber(innerHeight - 20, 20); 19 | this.posX = this.randomNumber(innerWidth - 20, 20); 20 | 21 | this.bubbleSpan.style.top = this.posY + "px"; 22 | this.bubbleSpan.style.left = this.posX + "px"; 23 | 24 | // setting height and width of the bubble 25 | this.height = this.randomNumber(60, 20); 26 | this.width = this.height; 27 | 28 | this.bubbleEnd.call(this.bubbleSpan, this.randomNumber(6000, 3000)); 29 | } 30 | 31 | // creates and appends a new bubble in the DOM 32 | handleNewBubble() { 33 | this.bubbleSpan = document.createElement("span"); 34 | this.bubbleSpan.classList.add("bubble"); 35 | root.append(this.bubbleSpan); 36 | this.handlePosition(); 37 | this.bubbleSpan.addEventListener("click", this.bubbleEnd); 38 | } 39 | 40 | handlePosition() { 41 | // positioning the bubble in different random X and Y 42 | const randomY = this.randomNumber(60, -60); 43 | const randomX = this.randomNumber(60, -60); 44 | 45 | this.bubbleSpan.style.backgroundColor = this.color; 46 | this.bubbleSpan.style.height = this.height + "px"; 47 | this.bubbleSpan.style.width = this.height + "px"; 48 | 49 | this.posY = this.randomNumber(innerHeight - 20, 20); 50 | this.posX = this.randomNumber(innerWidth - 20, 20); 51 | 52 | this.bubbleSpan.style.top = this.posY + "px"; 53 | this.bubbleSpan.style.left = this.posX + "px"; 54 | 55 | const randomSec = this.randomNumber(4000, 200); 56 | setTimeout(this.handlePosition.bind(this), randomSec); // calling for re-position of bubble 57 | } 58 | 59 | randomNumber(max, min) { 60 | return Math.floor(Math.random() * (max - min + 1) + min); 61 | } 62 | 63 | bubbleEnd(removingTime = 0) { 64 | setTimeout( 65 | () => { 66 | requestAnimationFrame(() => this.classList.add("bubble--bust")); 67 | }, 68 | removingTime = 5000 69 | ); 70 | 71 | setTimeout(() => { 72 | requestAnimationFrame(() => this.remove()); 73 | requestAnimationFrame(() => new Bubble()); 74 | }, removingTime); 75 | } 76 | } 77 | 78 | setInterval(function () { 79 | requestAnimationFrame(() => { 80 | fetch('/bubble') 81 | .then(response => response.json()) 82 | .then(data => new Bubble(data.color)) 83 | }); 84 | }, 400); -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/resources/META-INF/resources/style.css: -------------------------------------------------------------------------------- 1 | *, 2 | *:before, 3 | *:after { 4 | margin: 0; 5 | padding: 0; 6 | box-sizing: border-box; 7 | } 8 | 9 | body { 10 | background: black; 11 | overflow: hidden; 12 | } 13 | 14 | .bubble { 15 | position: absolute; 16 | top: 0; 17 | left: 0; 18 | border-radius: 50%; 19 | cursor: pointer; 20 | transition: linear 2s, transform 0.2s; 21 | } 22 | 23 | .bubble:hover { 24 | transform: scale(1.7); 25 | } 26 | 27 | .bubble--bust { 28 | transform: scale(1.8); 29 | } -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | %dev.quarkus.http.port=9090 2 | 3 | quarkus.container-image.group=rhdevelopers 4 | quarkus.container-image.registry=quay.io 5 | quarkus.container-image.tag=1.0.0 6 | quarkus.container-image.name=bgd -------------------------------------------------------------------------------- /apps/bubbles-frontend/src/test/resources/virtual-service.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "networking.istio.io/v1alpha3", 3 | "kind": "VirtualService", 4 | "metadata": { 5 | "name": "bubble-backend" 6 | }, 7 | "spec": { 8 | "hosts": [ 9 | "bubble-backend" 10 | ], 11 | "http": [ 12 | { 13 | "route": [ 14 | { 15 | "destination": { 16 | "host": "bubble-backend" 17 | }, 18 | "weight": 100 19 | }, 20 | { 21 | "destination": { 22 | "host": "bubble-backend-canary" 23 | }, 24 | "weight": 0 25 | } 26 | ], 27 | "name": "primary" 28 | } 29 | ] 30 | } 31 | } -------------------------------------------------------------------------------- /ch07/bgd/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 | creationTimestamp: null 18 | labels: 19 | app: bgd 20 | spec: 21 | containers: 22 | - image: quay.io/rhdevelopers/bgd:1.0.0 23 | name: bgd 24 | env: 25 | - name: COLOR 26 | value: "blue" 27 | resources: {} 28 | --- 29 | -------------------------------------------------------------------------------- /ch07/bgd/bgd-ns.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: bgd 5 | -------------------------------------------------------------------------------- /ch07/bgd/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 | ports: 11 | - port: 8080 12 | protocol: TCP 13 | targetPort: 8080 14 | selector: 15 | app: bgd 16 | --- 17 | -------------------------------------------------------------------------------- /ch07/bgdh/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /ch07/bgdh/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: bgdh 3 | description: Blue Green Deployment with Helm 4 | 5 | type: application 6 | version: 0.1.0 7 | appVersion: "1.16.0" 8 | -------------------------------------------------------------------------------- /ch07/bgdh/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get the application URL by running these commands: 2 | 3 | {{- if contains "ClusterIP" .Values.service.type }} 4 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "bgdh.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 5 | export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") 6 | echo "Visit http://127.0.0.1:8080 to use your application" 7 | kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT 8 | {{- end }} -------------------------------------------------------------------------------- /ch07/bgdh/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Expand the name of the chart. 3 | */}} 4 | {{- define "bgdh.name" -}} 5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} 6 | {{- end }} 7 | 8 | {{/* 9 | Create a default fully qualified app name. 10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 11 | If release name contains chart name it will be used as a full name. 12 | */}} 13 | {{- define "bgdh.fullname" -}} 14 | {{- if .Values.fullnameOverride }} 15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} 16 | {{- else }} 17 | {{- $name := default .Chart.Name .Values.nameOverride }} 18 | {{- if contains $name .Release.Name }} 19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} 20 | {{- else }} 21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} 22 | {{- end }} 23 | {{- end }} 24 | {{- end }} 25 | 26 | {{/* 27 | Create chart name and version as used by the chart label. 28 | */}} 29 | {{- define "bgdh.chart" -}} 30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} 31 | {{- end }} 32 | 33 | {{/* 34 | Common labels 35 | */}} 36 | {{- define "bgdh.labels" -}} 37 | helm.sh/chart: {{ include "bgdh.chart" . }} 38 | {{ include "bgdh.selectorLabels" . }} 39 | {{- if .Chart.AppVersion }} 40 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 41 | {{- end }} 42 | app.kubernetes.io/managed-by: {{ .Release.Service }} 43 | {{- end }} 44 | 45 | {{/* 46 | Selector labels 47 | */}} 48 | {{- define "bgdh.selectorLabels" -}} 49 | app.kubernetes.io/name: {{ include "bgdh.name" . }} 50 | app.kubernetes.io/instance: {{ .Release.Name }} 51 | {{- end }} 52 | 53 | {{/* 54 | Create the name of the service account to use 55 | */}} 56 | {{- define "bgdh.serviceAccountName" -}} 57 | {{- if .Values.serviceAccount.create }} 58 | {{- default (include "bgdh.fullname" .) .Values.serviceAccount.name }} 59 | {{- else }} 60 | {{- default "default" .Values.serviceAccount.name }} 61 | {{- end }} 62 | {{- end }} 63 | -------------------------------------------------------------------------------- /ch07/bgdh/templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: {{ include "bgdh.fullname" . }} 5 | labels: 6 | {{- include "bgdh.labels" . | nindent 4 }} 7 | spec: 8 | replicas: {{ .Values.replicaCount }} 9 | selector: 10 | matchLabels: 11 | {{- include "bgdh.selectorLabels" . | nindent 6 }} 12 | template: 13 | metadata: 14 | {{- with .Values.podAnnotations }} 15 | annotations: 16 | {{- toYaml . | nindent 8 }} 17 | {{- end }} 18 | labels: 19 | {{- include "bgdh.selectorLabels" . | nindent 8 }} 20 | spec: 21 | {{- with .Values.imagePullSecrets }} 22 | imagePullSecrets: 23 | {{- toYaml . | nindent 8 }} 24 | {{- end }} 25 | serviceAccountName: {{ include "bgdh.serviceAccountName" . }} 26 | securityContext: 27 | {{- toYaml .Values.podSecurityContext | nindent 8 }} 28 | containers: 29 | - name: {{ .Chart.Name }} 30 | securityContext: 31 | {{- toYaml .Values.securityContext | nindent 12 }} 32 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" 33 | imagePullPolicy: {{ .Values.image.pullPolicy }} 34 | ports: 35 | - name: http 36 | containerPort: 80 37 | protocol: TCP 38 | resources: 39 | {{- toYaml .Values.resources | nindent 12 }} 40 | {{- with .Values.nodeSelector }} 41 | nodeSelector: 42 | {{- toYaml . | nindent 8 }} 43 | {{- end }} 44 | {{- with .Values.affinity }} 45 | affinity: 46 | {{- toYaml . | nindent 8 }} 47 | {{- end }} 48 | {{- with .Values.tolerations }} 49 | tolerations: 50 | {{- toYaml . | nindent 8 }} 51 | {{- end }} 52 | -------------------------------------------------------------------------------- /ch07/bgdh/templates/ns.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: bgdh 5 | -------------------------------------------------------------------------------- /ch07/bgdh/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "bgdh.fullname" . }} 5 | labels: 6 | {{- include "bgdh.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.service.type }} 9 | ports: 10 | - port: {{ .Values.service.port }} 11 | targetPort: http 12 | protocol: TCP 13 | name: http 14 | selector: 15 | {{- include "bgdh.selectorLabels" . | nindent 4 }} 16 | -------------------------------------------------------------------------------- /ch07/bgdh/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccount.create -}} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: {{ include "bgdh.serviceAccountName" . }} 6 | labels: 7 | {{- include "bgdh.labels" . | nindent 4 }} 8 | {{- with .Values.serviceAccount.annotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /ch07/bgdh/templates/tests/test-connection.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: "{{ include "bgdh.fullname" . }}-test-connection" 5 | labels: 6 | {{- include "bgdh.labels" . | nindent 4 }} 7 | annotations: 8 | "helm.sh/hook": test 9 | spec: 10 | containers: 11 | - name: wget 12 | image: busybox 13 | command: ['wget'] 14 | args: ['{{ include "bgdh.fullname" . }}:{{ .Values.service.port }}'] 15 | restartPolicy: Never 16 | -------------------------------------------------------------------------------- /ch07/bgdh/values.yaml: -------------------------------------------------------------------------------- 1 | replicaCount: 1 2 | 3 | image: 4 | repository: quay.io/rhdevelopers/bgd 5 | pullPolicy: IfNotPresent 6 | tag: 1.0.0 7 | 8 | imagePullSecrets: [] 9 | nameOverride: "" 10 | fullnameOverride: "" 11 | 12 | serviceAccount: 13 | create: true 14 | annotations: {} 15 | name: "" 16 | 17 | podAnnotations: {} 18 | 19 | podSecurityContext: {} 20 | 21 | securityContext: {} 22 | 23 | service: 24 | type: ClusterIP 25 | port: 80 26 | 27 | resources: {} 28 | 29 | nodeSelector: {} 30 | tolerations: [] 31 | affinity: {} 32 | -------------------------------------------------------------------------------- /ch07/bgdk/base/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgdk 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: bgd 14 | strategy: {} 15 | template: 16 | metadata: 17 | creationTimestamp: null 18 | labels: 19 | app: bgd 20 | spec: 21 | containers: 22 | - image: quay.io/rhdevelopers/bgd:1.0.0 23 | name: bgd 24 | env: 25 | - name: COLOR 26 | value: "blue" 27 | resources: {} 28 | --- 29 | -------------------------------------------------------------------------------- /ch07/bgdk/base/bgd-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgdk 9 | spec: 10 | ports: 11 | - port: 8080 12 | protocol: TCP 13 | targetPort: 8080 14 | selector: 15 | app: bgd 16 | --- 17 | -------------------------------------------------------------------------------- /ch07/bgdk/base/kustomization.yaml: -------------------------------------------------------------------------------- 1 | namespace: bgdk 2 | resources: 3 | - bgd-svc.yaml 4 | - bgd-deployment.yaml 5 | -------------------------------------------------------------------------------- /ch07/bgdk/bgdk/bgdk-ns.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: bgdk 5 | -------------------------------------------------------------------------------- /ch07/bgdk/bgdk/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | namespace: bgdk 4 | resources: 5 | - ../base 6 | - bgdk-ns.yaml 7 | patchesJson6902: 8 | - target: 9 | version: v1 10 | group: apps 11 | kind: Deployment 12 | name: bgd 13 | namespace: bgdk 14 | patch: |- 15 | - op: replace 16 | path: /spec/template/spec/containers/0/env/0/value 17 | value: yellow 18 | -------------------------------------------------------------------------------- /ch07/bgdui/base/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgdk 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: bgd 14 | strategy: {} 15 | template: 16 | metadata: 17 | creationTimestamp: null 18 | labels: 19 | app: bgd 20 | spec: 21 | containers: 22 | - image: quay.io/rhdevelopers/bgd:1.0.0 23 | name: bgd 24 | env: 25 | - name: COLOR 26 | value: "blue" 27 | resources: {} 28 | --- 29 | -------------------------------------------------------------------------------- /ch07/bgdui/base/bgd-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | namespace: bgdk 9 | spec: 10 | ports: 11 | - port: 8080 12 | protocol: TCP 13 | targetPort: 8080 14 | selector: 15 | app: bgd 16 | --- 17 | -------------------------------------------------------------------------------- /ch07/bgdui/base/kustomization.yaml: -------------------------------------------------------------------------------- 1 | namespace: bgdk 2 | resources: 3 | - bgd-svc.yaml 4 | - bgd-deployment.yaml 5 | -------------------------------------------------------------------------------- /ch07/bgdui/bgdk/.argocd-source-bgdk-app.yaml: -------------------------------------------------------------------------------- 1 | kustomize: 2 | images: 3 | - quay.io/rhdevelopers/bgd:1.1.0 4 | -------------------------------------------------------------------------------- /ch07/bgdui/bgdk/bgdk-ns.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: bgdk 5 | -------------------------------------------------------------------------------- /ch07/bgdui/bgdk/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | namespace: bgdk 4 | resources: 5 | - ../base 6 | - bgdk-ns.yaml 7 | patchesJson6902: 8 | - target: 9 | version: v1 10 | group: apps 11 | kind: Deployment 12 | name: bgd 13 | namespace: bgdk 14 | patch: |- 15 | - op: replace 16 | path: /spec/template/spec/containers/0/env/0/value 17 | value: yellow 18 | -------------------------------------------------------------------------------- /ch07/todo/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 | template: 10 | spec: 11 | containers: 12 | - name: postgresql-client 13 | image: postgres:12 14 | imagePullPolicy: Always 15 | env: 16 | - name: PGPASSWORD 17 | value: admin 18 | command: ["psql"] 19 | args: 20 | [ 21 | "--host=postgresql", 22 | "--username=admin", 23 | "--no-password", 24 | "--dbname=todo", 25 | "--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;", 26 | ] 27 | restartPolicy: Never 28 | backoffLimit: 1 -------------------------------------------------------------------------------- /ch07/todo/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 | -------------------------------------------------------------------------------- /ch07/todo/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 -------------------------------------------------------------------------------- /ch07/todo/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" -------------------------------------------------------------------------------- /ch07/todo/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 -------------------------------------------------------------------------------- /ch07/todo/todo-namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: todo 5 | annotations: 6 | argocd.argoproj.io/sync-wave: "-1" -------------------------------------------------------------------------------- /ch07/todo/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" -------------------------------------------------------------------------------- /ch08/bgd-gen/prod/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | app: bgd 13 | strategy: {} 14 | template: 15 | metadata: 16 | creationTimestamp: null 17 | labels: 18 | app: bgd 19 | spec: 20 | containers: 21 | - image: quay.io/rhdevelopers/bgd:1.0.0 22 | name: bgd 23 | env: 24 | - name: COLOR 25 | value: "green" 26 | resources: {} 27 | --- -------------------------------------------------------------------------------- /ch08/bgd-gen/staging/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | app: bgd 13 | strategy: {} 14 | template: 15 | metadata: 16 | creationTimestamp: null 17 | labels: 18 | app: bgd 19 | spec: 20 | containers: 21 | - image: quay.io/rhdevelopers/bgd:1.0.0 22 | name: bgd 23 | env: 24 | - name: COLOR 25 | value: "blue" 26 | resources: {} 27 | --- -------------------------------------------------------------------------------- /ch08/bgd-pr/bgd-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: bgd 7 | name: bgd 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | app: bgd 13 | strategy: {} 14 | template: 15 | metadata: 16 | creationTimestamp: null 17 | labels: 18 | app: bgd 19 | spec: 20 | containers: 21 | - image: quay.io/rhdevelopers/bgd:1.0.0 22 | name: bgd 23 | env: 24 | - name: COLOR 25 | value: "blue" 26 | resources: {} 27 | --- --------------------------------------------------------------------------------