master 8e93b43aec6a cached
205 files
350.0 KB
103.2k tokens
63 symbols
1 requests
Download .txt
Showing preview only (401K chars total). Download the full file or copy to clipboard to get everything.
Repository: redhat-scholars/kubernetes-tutorial
Branch: master
Commit: 8e93b43aec6a
Files: 205
Total size: 350.0 KB

Directory structure:
gitextract_62qzlr9h/

├── .devcontainer/
│   ├── Dockerfile
│   ├── assets/
│   │   ├── .zshrc.example
│   │   ├── copy-kube-config.sh
│   │   ├── fedora.repo
│   │   └── post-start.sh
│   ├── devcontainer.json
│   └── workspace-setup/
│       ├── asciidoc.json.code-snippets
│       └── launch.json
├── .editorconfig
├── .github/
│   └── workflows/
│       ├── docs.yml
│       ├── helloworld-go.yml
│       ├── helloworld-quarkus.yml
│       └── helloworld-spring-boot.yml
├── .gitignore
├── LICENSE
├── README.adoc
├── apps/
│   ├── config/
│   │   ├── other.properties
│   │   └── some.properties
│   ├── helloworld/
│   │   ├── go/
│   │   │   ├── Dockerfile
│   │   │   ├── myrest
│   │   │   ├── myrest.go
│   │   │   └── readme.txt
│   │   ├── nodejs/
│   │   │   ├── .devcontainer/
│   │   │   │   ├── Dockerfile
│   │   │   │   └── devcontainer.json
│   │   │   ├── Dockerfile
│   │   │   ├── hello-http.js
│   │   │   └── readme.txt
│   │   ├── python/
│   │   │   ├── Dockerfile
│   │   │   ├── app.py
│   │   │   ├── readme.txt
│   │   │   └── requirements.txt
│   │   ├── quarkus/
│   │   │   ├── .dockerignore
│   │   │   ├── buildNativeLinux.sh
│   │   │   ├── buildNativeMac.sh
│   │   │   ├── build_push_docker.sh
│   │   │   ├── build_push_quay.sh
│   │   │   ├── dockerbuild.sh
│   │   │   ├── dockerbuild_openshift.sh
│   │   │   ├── dockerpush_docker.sh
│   │   │   ├── dockerpush_quay.sh
│   │   │   ├── kubefiles/
│   │   │   │   ├── Deployment.yml
│   │   │   │   ├── Deployment_quay.yml
│   │   │   │   ├── Dockerfile
│   │   │   │   ├── Dockerfile.openshift
│   │   │   │   └── Service.yml
│   │   │   ├── poller.sh
│   │   │   ├── pom.xml
│   │   │   ├── readme.txt
│   │   │   └── src/
│   │   │       └── main/
│   │   │           └── java/
│   │   │               └── com/
│   │   │                   └── redhat/
│   │   │                       └── developer/
│   │   │                           └── demo/
│   │   │                               └── GreetingEndpoint.java
│   │   └── springboot/
│   │       ├── .devcontainer/
│   │       │   ├── Dockerfile
│   │       │   └── devcontainer.json
│   │       ├── Dockerfile
│   │       ├── Dockerfile.openshift
│   │       ├── Dockerfile_Java11
│   │       ├── Dockerfile_Memory
│   │       ├── Dockerfile_Memory2
│   │       ├── build_push_docker.sh
│   │       ├── build_push_quay.sh
│   │       ├── pom.xml
│   │       ├── readme.txt
│   │       └── src/
│   │           └── main/
│   │               └── java/
│   │                   └── com/
│   │                       └── burrsutter/
│   │                           ├── HellobootApplication.java
│   │                           └── MyRESTController.java
│   ├── kubefiles/
│   │   ├── demo-dynamic-persistent.yaml
│   │   ├── demo-ingress-2.yaml
│   │   ├── demo-ingress.yaml
│   │   ├── demo-persistent-volume-hostpath.yaml
│   │   ├── demo-persistent-volume-local.yaml
│   │   ├── myboot-deployment-bad-image.yml
│   │   ├── myboot-deployment-configuration-secret.yml
│   │   ├── myboot-deployment-configuration.yml
│   │   ├── myboot-deployment-live-ready-aggressive.yml
│   │   ├── myboot-deployment-live-ready.yml
│   │   ├── myboot-deployment-resources-limits-v2.yml
│   │   ├── myboot-deployment-resources-limits.yml
│   │   ├── myboot-deployment-resources.yml
│   │   ├── myboot-deployment-startup-live-ready.yml
│   │   ├── myboot-deployment.yml
│   │   ├── myboot-node-affinity.yml
│   │   ├── myboot-persistent-volume-claim.yaml
│   │   ├── myboot-pod-affinity.yml
│   │   ├── myboot-pod-antiaffinity.yaml
│   │   ├── myboot-pod-volume-hostpath.yaml
│   │   ├── myboot-pod-volume-pvc.yaml
│   │   ├── myboot-pod-volume.yml
│   │   ├── myboot-pods-volume.yml
│   │   ├── myboot-service.yml
│   │   ├── myboot-toleration.yaml
│   │   ├── mykafka.yml
│   │   ├── quarkus-daemonset.yaml
│   │   ├── quarkus-statefulset-external-svc.yaml
│   │   ├── quarkus-statefulset.yaml
│   │   ├── whalesay-cronjob.yaml
│   │   └── whalesay-job.yaml
│   ├── pizza-operator/
│   │   ├── .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/
│   │       │   │   └── org/
│   │       │   │       └── acme/
│   │       │   │           ├── ExampleResource.java
│   │       │   │           ├── KubernetesClientProducer.java
│   │       │   │           ├── PizzaResource.java
│   │       │   │           ├── PizzaResourceDoneable.java
│   │       │   │           ├── PizzaResourceList.java
│   │       │   │           ├── PizzaResourceSpec.java
│   │       │   │           ├── PizzaResourceStatus.java
│   │       │   │           └── PizzaResourceWatcher.java
│   │       │   └── resources/
│   │       │       ├── META-INF/
│   │       │       │   └── resources/
│   │       │       │       └── index.html
│   │       │       └── application.properties
│   │       └── test/
│   │           └── java/
│   │               └── org/
│   │                   └── acme/
│   │                       ├── ExampleResourceTest.java
│   │                       └── NativeExampleResourceIT.java
│   └── pizzas/
│       ├── cheese-pizza.yaml
│       ├── meat-pizza.yaml
│       ├── pizza-crd.yaml
│       ├── pizza-deployment.yaml
│       └── veggie-lovers.yaml
├── bin/
│   └── build-site.sh
├── documentation/
│   ├── antora.yml
│   └── modules/
│       ├── ROOT/
│       │   ├── examples/
│       │   │   ├── PizzaResourceWatcher.java
│       │   │   ├── cheese-pizza.yaml
│       │   │   ├── meat-pizza.yaml
│       │   │   ├── myboot-deployment-configuration-secret.yml
│       │   │   ├── myboot-deployment-live-ready-aggressive.yml
│       │   │   ├── myboot-deployment-live-ready.yml
│       │   │   ├── myboot-deployment-startup-live-ready.yml
│       │   │   ├── myboot-pod-volume-hostpath.yaml
│       │   │   ├── myboot-pod-volume.yml
│       │   │   ├── myboot-pods-volume.yml
│       │   │   ├── pizza-crd.yaml
│       │   │   ├── quarkus-statefulset-external-svc.yaml
│       │   │   ├── whalesay-cronjob.yaml
│       │   │   └── whalesay-job.yaml
│       │   ├── nav.adoc
│       │   ├── pages/
│       │   │   ├── _attributes.adoc
│       │   │   ├── _partials/
│       │   │   │   ├── affinity_label.adoc
│       │   │   │   ├── find_node_for_pod.adoc
│       │   │   │   ├── invoke-service.adoc
│       │   │   │   ├── set-env-vars.adoc
│       │   │   │   ├── verify-setup.adoc
│       │   │   │   └── watching-logs.adoc
│       │   │   ├── blue-green.adoc
│       │   │   ├── building-images.adoc
│       │   │   ├── configmap.adoc
│       │   │   ├── crds.adoc
│       │   │   ├── daemonset.adoc
│       │   │   ├── exec.adoc
│       │   │   ├── index.adoc
│       │   │   ├── ingress.adoc
│       │   │   ├── installation.adoc
│       │   │   ├── jobs-cronjobs.adoc
│       │   │   ├── kubectl.adoc
│       │   │   ├── live-ready.adoc
│       │   │   ├── logs.adoc
│       │   │   ├── pod-rs-deployment.adoc
│       │   │   ├── resources.adoc
│       │   │   ├── rolling-updates.adoc
│       │   │   ├── secrets.adoc
│       │   │   ├── service-magic.adoc
│       │   │   ├── service.adoc
│       │   │   ├── statefulset.adoc
│       │   │   ├── taints-affinity.adoc
│       │   │   └── volumes-persistentvolumes.adoc
│       │   └── partials/
│       │       ├── create-greeting-file.adoc
│       │       ├── describe-deployment.adoc
│       │       ├── describe.adoc
│       │       ├── env-curl.adoc
│       │       ├── file-watch-command.adoc
│       │       ├── loop.adoc
│       │       ├── namespace-setup-tip.adoc
│       │       ├── open-terminal-in-editor-inset.adoc
│       │       ├── optional-requisites.adoc
│       │       ├── prerequisites-kubernetes.adoc
│       │       ├── set-context.adoc
│       │       ├── stern-watch.adoc
│       │       ├── taint-remove-taint.adoc
│       │       ├── terminal-cleanup.adoc
│       │       ├── tip_vscode_kube_editor.adoc
│       │       ├── tip_vscode_quick_open.adoc
│       │       ├── watch-node-directory.adoc
│       │       ├── watching-pods-with-nodes.adoc
│       │       ├── watching-pods.adoc
│       │       └── watching-services.adoc
│       └── _attributes.adoc
├── github-pages-stage.yml
├── github-pages.yml
├── gulpfile.babel.js
├── lib/
│   ├── copy-to-clipboard.js
│   ├── remote-include-processor.js
│   └── tab-block.js
├── package.json
├── scripts/
│   ├── create-kubeconfig.sh
│   ├── github-pages-publish.sh
│   ├── minikube-server-setup.sh
│   ├── pod-node-columns-template.txt
│   └── shell-setup.sh
├── supplemental-ui/
│   └── partials/
│       ├── header-content.hbs
│       ├── nav-explore.hbs
│       ├── nav-menu.hbs
│       └── nav.hbs
└── vscode-asciidoc-extra.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .devcontainer/Dockerfile
================================================
# syntax = docker/dockerfile:1.0-experimental

#
# This is the base dockerfile to be used with the BUILDKIT to build the 
# image that the .devcontainer docker image is based on
# 
FROM registry.access.redhat.com/ubi8/openjdk-11:latest

USER root

# add a reference to fedora repo to install packages not part of the
# ubi8 repos
COPY assets/fedora.repo /etc/yum.repos.d/fedora.repo

RUN microdnf install dnf \
# install a smattering of useful packages (some of which are used later in dockerfile such as wget, zsh, and git)
    && dnf install -y skopeo wget jq iputils vi procps git \
# Install packages from fedora (outside unsubscribed ubi8)
    && dnf -y install --enablerepo fedora zsh tree \
# Install necessary tools to run antora    
    && dnf -y install npm && npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 && npm rm --global npx && npm install --global npx && npm install --global gulp \
# Install yum so that docker can be installed in the container
    && dnf -y install yum && yum install -y yum-utils \
# install docker repo
    && yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo \
# install docker client
    && yum install -y docker-ce-cli  \
# make sure jboss user has rights to run docker
    && usermod -aG docker jboss  \
# cleanup packages and yum
    && yum remove -y yum-utils && yum clean all && dnf clean all && rm -r /var/cache/dnf

# install specific version of yq (2.4.1)
RUN wget https://github.com/mikefarah/yq/releases/download/2.4.1/yq_linux_amd64 -O /usr/bin/yq && \
    chmod +x /usr/bin/yq 

# install stern
RUN cd /usr/local/bin && \
    wget https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64 -O /usr/local/bin/stern && \
    chmod 755 /usr/local/bin/stern && \
# install hey
    wget https://mwh-demo-assets.s3-ap-southeast-2.amazonaws.com/hey_linux_amd64 -O /usr/local/bin/hey && \
    chmod 755 /usr/local/bin/hey

# overwrite existing oc with the absolute newest version of the openshift client
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz | \
    tar -xvzf - -C /usr/local/bin/ oc && chmod 755 /usr/local/bin/oc && ln -s /usr/local/bin/oc /usr/local/bin/kubectl

USER jboss

# install and configure ohmyzsh for jboss user
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

# needed for krew commands
ENV PATH="$HOME/.krew/bin:$PATH"

# install kube ctx and kube ns via krew
RUN ( set -x; cd "$(mktemp -d)" && \
  OS="$(uname | tr '[:upper:]' '[:lower:]')" && \
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && \
  curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" && \
  tar zxvf krew.tar.gz && \
  KREW=./krew-"${OS}_${ARCH}" && \
  "$KREW" install krew ) &&\
  kubectl krew install ctx && kubectl krew install ns

# Subdirectory where local-config files should reside (matched to gitignore to ensure no secrets are checked in)
ENV CONFIG_SUBDIR "local-config"
ENV DEMO_HOME "/workspaces/kubernetes-tutorial/"
# Use VSCode with kubectl edit commands
ENV KUBE_EDITOR="code -w"

# this is done in the base image already (to support the demo shell images too), but for those that make
# local changes to .zshrc they should not have to rebuild the base
COPY assets/.zshrc.example $HOME/.zshrc

================================================
FILE: .devcontainer/assets/.zshrc.example
================================================
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#

source $DEMO_HOME/scripts/shell-setup.sh
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"


================================================
FILE: .devcontainer/assets/copy-kube-config.sh
================================================
#!/bin/bash -i

# set -euo pipefail

# Copies localhost's ~/.kube/config file into the container and swap out localhost
# for host.docker.internal whenever a new shell starts to keep them in sync.
if [ "$SYNC_LOCALHOST_KUBECONFIG" = "true" ] && [ -d "/usr/local/share/kube-localhost" ]; then
    mkdir -p $HOME/.kube
    cp -r /usr/local/share/kube-localhost/config $HOME/.kube/config
    sed -i -e "s/localhost/host.docker.internal/g" $HOME/.kube/config
    sed -i -e "s/127.0.0.1/host.docker.internal/g" $HOME/.kube/config

    # If .minikube was mounted, set up client cert/key
    if [ -d "/usr/local/share/minikube-localhost" ]; then
        mkdir -p $HOME/.minikube
        cp -r /usr/local/share/minikube-localhost/ca.crt $HOME/.minikube
        # Location varies between versions of minikube
        if [ -f "/usr/local/share/minikube-localhost/client.crt" ]; then
            cp -r /usr/local/share/minikube-localhost/client.crt $HOME/.minikube
            cp -r /usr/local/share/minikube-localhost/client.key $HOME/.minikube
        elif [ -f "/usr/local/share/minikube-localhost/profiles/${SYNC_MINIKUBE_PROFILE}/client.crt" ]; then
            cp -r /usr/local/share/minikube-localhost/profiles/${SYNC_MINIKUBE_PROFILE}/client.crt $HOME/.minikube
            cp -r /usr/local/share/minikube-localhost/profiles/${SYNC_MINIKUBE_PROFILE}/client.key $HOME/.minikube
        fi

        # Point .kube/config to the correct locaiton of the certs
        sed -i -r "s|(\s*certificate-authority:\s).*|\\1$HOME\/.minikube\/ca.crt|g" $HOME/.kube/config
        sed -i -r "s|(\s*client-certificate:\s).*|\\1$HOME\/.minikube\/client.crt|g" $HOME/.kube/config
        sed -i -r "s|(\s*client-key:\s).*|\\1$HOME\/.minikube\/client.key|g" $HOME/.kube/config
    fi
fi

================================================
FILE: .devcontainer/assets/fedora.repo
================================================
[fedora]
name = Fedora
baseurl = https://mirror.aarnet.edu.au/pub/fedora/linux/releases/34/Everything/x86_64/os/
gpgcheck=0
enabled=0

================================================
FILE: .devcontainer/assets/post-start.sh
================================================
#!/bin/bash

WORKSPACE_FOLDER=$1

rsync -a ${WORKSPACE_FOLDER}/.devcontainer/workspace-setup/ ${WORKSPACE_FOLDER}/.vscode/ --ignore-existing

${WORKSPACE_FOLDER}/.devcontainer/assets/copy-kube-config.sh

================================================
FILE: .devcontainer/devcontainer.json
================================================
{
	"name": "DevNation Kubernetes Tutorial",
	"dockerFile": "Dockerfile",
	"runArgs": [
		"-v", "/var/run/docker.sock.raw:/var/run/docker.sock",
		"-v", "${env:HOME}/.vs-kubernetes:/home/jboss/.vs-kubernetes",

		// use local .oh-my-zsh configuration if it exists (overwriting one in container).
		// comment the following line out if you want to use local installation on container instead
		"-v", "${env:HOME}/.oh-my-zsh:/home/jboss/.oh-my-zsh",
		"-v", "${env:HOME}/.helm:/home/jboss/.helm",
		"-v", "${env:HOME}/.ssh:/home/jboss/.ssh",
		// mount the maven cache locally
		"-v", "${env:HOME}/.m2/:/home/jboss/.m2",
		// mount npm cache locally
		"-v", "${env:HOME}/.npm:/home/jboss/.npm",

		// This allows us to reach the minikube instance from within the docker container
		"--network", "host",
		
		// override dockerfile DEMO_HOME to whatever folder vscode considers the root folder in the container
		"-e", "DEMO_HOME=${containerWorkspaceFolder}",
	],
	"mounts":[
		"source=${env:HOME}${env:USERPROFILE}/.kube,target=/usr/local/share/kube-localhost,type=bind",
		"source=${env:HOME}${env:USERPROFILE}/.minikube,target=/usr/local/share/minikube-localhost,type=bind"
	],
	"remoteEnv": {
		"SYNC_LOCALHOST_KUBECONFIG": "true",
		"SYNC_MINIKUBE_PROFILE": "devnation",
		"HOST_USER": "${env:USER}"
	},
	"extensions": [
		"vscjava.vscode-java-pack",
		"redhat.vscode-xml",
		"redhat.vscode-quarkus",
		"ggrebert.quarkus-snippets",
		"humao.rest-client",
		"asciidoctor.asciidoctor-vscode",
		"madhavd1.javadoc-tools"
	],
	"postStartCommand": "${containerWorkspaceFolder}/.devcontainer/assets/post-start.sh ${containerWorkspaceFolder}",
	"settings":{
		"terminal.integrated.shell.linux": "/bin/zsh",
		"editor.tabCompletion": "on",
		"java.home": "/usr/lib/jvm/java-11-openjdk",
		"workbench.colorTheme": "Solarized Light",
		"http.proxyStrictSSL": false,
		"workbench.tips.enabled": false,
		"xml.format.enabled": true,
		// don't pull in the .m2 cache 
		"files.exclude": {
			"**/.classpath": true,
			"**/.project": true,
			"**/.settings": true,
			"**/.factorypath": true,
            "**/.m2": true,
        },
		// Don't import the example-operator project
		// these exclusions don't work entirely as advertised.  
		// See: https://github.com/redhat-developer/vscode-java/issues/1698
		"java.import.exclusions": [
			//"**/example-operator",
			//"example-operator/**",
			"**/.m2/**",        
			"**/node_modules/**",
			"**/.metadata/**",
			"**/archetype-resources/**",
			"**/META-INF/maven/**"
		]
	}
}


================================================
FILE: .devcontainer/workspace-setup/asciidoc.json.code-snippets
================================================
{
  "Add Tabs": {
    "prefix": "tabs",
    "body": [
      "[tabs]",
      "====",
      "${1:tab1}::",
      "+",
      "--",
      "--",
      "${2:tab2}::",
      "+",
      "--",
      "--",
      "===="
    ],
    "description": "Add Tabs macro"
  },
  "Add Navigation": {
    "prefix": "nav",
    "body": [
      "${1|*,**,***|} xref:${2:page.adoc}[${3:Nav Title}]"
    ],
    "description": "Add new navigation"
  },
  "Console Input": {
    "prefix": "input",
    "body": [
      "[.console-input]",
      "[source,${1:bash},subs=\"${2:+macros,+attributes}\"]",
      "----",
      "${3:echo \"Hello World\"}",
      "----"
    ],
    "description": "Adds Console Input source fragment"
  },
  "Console Output": {
    "prefix": "output",
    "body": [
      "[.console-output]",
      "[source,${1:bash},subs=\"${2:+macros,+attributes}\"]",
      "----",
      "${3:\"Hello World\"}",
      "----"
    ],
    "description": "Adds Console Output source fragment"
  },
  "Asciidoc Tag": {
    "prefix": "atag",
    "body": [
      "// tag::${1:tag_name}[]",
      "${2:body}",
      "// end::${1:tag_name}[]"
    ]
  },
  "Partial Tag Include": {
    "prefix": "tinclude",
    "body": [
      "include::partial$${1:include_name}.adoc[tags=**;!*;${2:tags_to_include}]"
    ],
    "description": "Include a partial with tags"
  },
  "Add Console Tab": {
    "prefix": "tconsole",
    "body": [
      "[tabs]",
      "====",
      "${1:tab1}::",
      "+",
      "--",
      "[.console-${2:input}]",
      "[source,${3:bash},subs=\"${4:+macros,+attributes}\"]",
      "----",
      "${5:echo \"Hello World\"}",
      "----",
      "--",
      "===="
    ],
    "description": "Add Tabs macro"
  },
}

================================================
FILE: .devcontainer/workspace-setup/launch.json
================================================
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005,
        }
    ]
}

================================================
FILE: .editorconfig
================================================
root = true

[*]
indent_style = space
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

[*.java]
indent_style = space
indent_size = 4

[*.xml]
indent_style = space
indent_size = 2

================================================
FILE: .github/workflows/docs.yml
================================================
name: docs

on:
  push:
    branches: 
    - v1.29
    - v1.34
    paths:
    - .github/workflows/docs.yml
    - github-pages.yml
    - 'documentation/**'

jobs:
  build-and-publish:
    runs-on: ubuntu-22.04 
    steps:
    - name: Checkout project
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Run antora
      uses: docker://antora/antora:2.3.1
      with:
        args: github-pages.yml
    - name: Deploy to GitHub Pages
      uses: JamesIves/github-pages-deploy-action@releases/v4
      with:
        token: "${{github.token}}"
        FOLDER: gh-pages
        BRANCH: gh-pages
        commit-message: "[docs] Publishing the docs for commit(s) ${{github.sha}}"


================================================
FILE: .github/workflows/helloworld-go.yml
================================================
name: helloworld-go

on:
  push:
    branches: 
    - master
    paths:
    - '.github/workflows/helloworld-go.yml'
    - 'apps/helloworld/go/**'

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout project
      uses: actions/checkout@v2
    - name: Setup Go
      uses: actions/setup-go@v2.0.3
      with:
        go-version: '1.14.2'
    - name: Build Go app
      working-directory: apps/helloworld/go
      run: go build myrest.go


================================================
FILE: .github/workflows/helloworld-quarkus.yml
================================================
name: helloworld-quarkus

on:
  push:
    branches: 
    - master
    paths:
    - '.github/workflows/helloworld-quarkus.yml'
    - 'apps/helloworld/quarkus/**'

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout project
      uses: actions/checkout@v2
    - name: Setup Java JDK
      uses: actions/setup-java@v2
      with:
        distribution: "temurin"
        java-version: 11
    - name: Maven build
      working-directory: apps/helloworld/quarkus
      run: mvn package


================================================
FILE: .github/workflows/helloworld-spring-boot.yml
================================================
name: helloworld-spring-boot

on:
  push:
    branches: 
    - master
    paths:
    - '.github/workflows/helloworld-spring-boot.yml'
    - 'apps/helloworld/springboot/**'

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout project
      uses: actions/checkout@v2
    - name: Setup Java JDK
      uses: actions/setup-java@v2
      with:
        distribution: "temurin"
        java-version: 11
    - name: Maven build
      working-directory: apps/helloworld/springboot
      run: mvn package


================================================
FILE: .gitignore
================================================
.DS_Store
target
*.iml
.idea
*.class
*.log
.cache
/gh-pages
/.cache
*.swp
node_modules
.classpath
.project
.settings
.kube
.minikube
.DS_Store
.vscode
firebase*
node_modules
.firebaserc
.firebase
.vscode/

# local kubernetes cluster info
local-config/

# once gulp is run, this file is generated.  Some debate whether this should be checked in or not
package-lock.json
yarn.lock


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "{}"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2020 Red Hat Inc.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.adoc
================================================
# Kubernetes Tutorial 

image:https://github.com/redhat-developer-demos/kubernetes-tutorial/workflows/docs/badge.svg[]
image:https://github.com/redhat-developer-demos/kubernetes-tutorial/workflows/helloworld-go/badge.svg[]
image:https://github.com/redhat-developer-demos/kubernetes-tutorial/workflows/helloworld-spring-boot/badge.svg[]
image:https://github.com/redhat-developer-demos/kubernetes-tutorial/workflows/helloworld-quarkus/badge.svg[]

You can access the HTML version of this tutorial here: https://redhat-scholars.github.io/kubernetes-tutorial/

## Visual Studio Code Remote Development

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 to be able to contribute or run through this tutorial.

Simply follow these instructions:

1. (Only if running with podman) Set the environment variable `DEVCONTAINER_TARGET_PREFIX=podman`
2. Open VS Code from the root of the `kubernetes-tutorial` repository and when prompted indicate that you want to "open the folder in a container".

Once the devcontainer is initialized, from the Visual Studio Code terminal you will be able to run all the commands outlined for creating documentation.

### Execute Tutorial with VSCode Remote

You can also run through the tutorial with VSCode Remote.  The only trick is that you will need to be able to access minikube from within your docker container.

## Building the HTML locally

In the root of your git repository, run:

```
bin/build-site.sh
```

And then open your `gh-pages/index.html` file:

```
open gh-pages/index.html
```

## Iterative local development

You can develop the tutorial docs locally using a rapid iterative cycle.

First, install the `yarn` dependencies:

[source,bash]
----
yarn install
----

And now start `gulp`. It will create the website and open your browser connected with `browser-sync`. Everytime it detects a change, it will automatically refresh your browser page.

[source,bash]
----
gulp
----

You can clean the local cache using:

[source,bash]
----
gulp clean
----


================================================
FILE: apps/config/other.properties
================================================
DBCONN=jdbc:sqlserver://123.123.123.123:1443;user=MyUserName;password=*****;
MSGBROKER=tcp://localhost:61616?jms.useAsyncSend=true

================================================
FILE: apps/config/some.properties
================================================
GREETING=jambo
LOVE=Amour

================================================
FILE: apps/helloworld/go/Dockerfile
================================================
FROM registry.access.redhat.com/ubi8/ubi-minimal
EXPOSE 8000
COPY myrest /usr/bin
CMD /bin/sh -c '/usr/bin/myrest'



================================================
FILE: apps/helloworld/go/myrest.go
================================================
package main

import (
	"fmt"
	"net/http"
	"os"
//	"time"
)

func main() {

	//api := mux.NewRouter()
	http.HandleFunc("/", HelloHandler)
	//http.Handle("/hello", api)
    
	fmt.Println("Listening on localhost:8000")
	http.ListenAndServe(":8000", nil)
}

func HelloHandler(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusOK)
	hostname, err := os.Hostname()
	if err != nil {
		fmt.Println("unable to get hostname")
	}
    
	// fmt.Fprintf(w, "Hello from Go! %s on %s\n", time.Now(), hostname)
	fmt.Fprintf(w, "Go Hello on %s\n", hostname)
}


================================================
FILE: apps/helloworld/go/readme.txt
================================================

Download and install go
https://golang.org/dl/

go build myrest.go

then run the compiled executable
./myrest

curl localhost:8000/hello

ctrl-c

Note: go compiles to native and if you have been using a Mac/Windows
you likely need to recompile the binary

env GOOS=linux GOARCH=amd64 go build myrest.go

docker build -t burr/mygo:v1 .

docker run -it -p 8000:8000 burr/mygo:v1

Thank you to Jesus R who figured this out for me!
https://github.com/jmrodri/go-demo




================================================
FILE: apps/helloworld/nodejs/.devcontainer/Dockerfile
================================================
FROM nodeshift/centos7-s2i-nodejs:10.x

LABEL maintainer="Burr Sutter \"burrsutter@gmail.com\""

EXPOSE 8000

WORKDIR /opt/app-root/src

CMD ["npm", "start"]


================================================
FILE: apps/helloworld/nodejs/.devcontainer/devcontainer.json
================================================
{
	"name": "Node Sample",
	"dockerFile": "Dockerfile",
	"appPort": "8000",
	 "extensions": [
		// "afractal.node-essentials",
		"visualstudioexptteam.vscodeintellicode",
		"ms-vscode.node-debug2"
	 ]
}


================================================
FILE: apps/helloworld/nodejs/Dockerfile
================================================
FROM nodeshift/centos7-s2i-nodejs:10.x

LABEL maintainer="Burr Sutter \"burrsutter@gmail.com\""

EXPOSE 8000

WORKDIR /opt/app-root/src

COPY hello-http.js .
COPY package.json .

CMD ["npm", "start"]


================================================
FILE: apps/helloworld/nodejs/hello-http.js
================================================
const os = require('os');
const http = require('http');
let cnt = 0;

http.createServer((req, res) =>
{
    // don't increment the counter if the favicon.ico is being requested
    if (req.url.toLowerCase() === '/favicon.ico') {
        res.writeHead(200, { 'Content-Type': 'image/x-icon' });
        res.end();
        console.log('favicon requested');
        return;
    }

    res.end(`Node Bonjour on ${os.hostname()} ${cnt++} \n`);
}
    
).listen(8000);

console.log(`Server running at http://localhost:8000/`);



================================================
FILE: apps/helloworld/nodejs/readme.txt
================================================
Test it plain
node -v
v8.11.3
npm -v
v8.11.3


npm start
curl localhost:8000

Test it in minishift or minikube's Docker
minishift docker-env
minikube docker-env


docker build -f Dockerfile -t dev.local/burrsutter/mynode:v1 .
or 
docker build -f Dockerfile.openshift -t dev.local/burrsutter/mynode:v1 .

docker login docker.io
docker images | grep mynode
docker tag $1 docker.io/burrsutter/mynode:v1
docker push docker.io/burrsutter/mynode:v1
or
docker login quay.io
docker images | grep mynode
docker tag $1 quay.io/burrsutter/mynode:v1
docker push quay.io/burrsutter/mynode:v1



to test via Docker:
docker run --rm -d -p 8000:8000 dev.local/burrsutter/mynode:v1

docker ps | grep mynode

docker stop 08efa083696b



================================================
FILE: apps/helloworld/python/Dockerfile
================================================
FROM python:2

WORKDIR /usr/src/app

COPY requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD [ "python", "./app.py" ]

================================================
FILE: apps/helloworld/python/app.py
================================================
import os

from flask import Flask
app = Flask(__name__)

@app.route("/")
def main():
    return "Python Hello on " + os.getenv('HOSTNAME', "unknown") + "\n"

if __name__ == "__main__":
    app.run(host='0.0.0.0',port='8000')



================================================
FILE: apps/helloworld/python/readme.txt
================================================
https://www.python.org/ftp/python/2.7.15/python-2.7.15-macosx10.9.pkg

python --version
Python 2.7.15

pip --version
pip 19.0.3

pip install --no-cache-dir -r requirements.txt

python app.py

curl localhost:8000
ctrl-c

docker build -t burrsutter/flask_web_app .

docker run -it -p 8000:8000 --rm  burrsutter/flask_web_app

curl localhost:8000

================================================
FILE: apps/helloworld/python/requirements.txt
================================================
Flask==1.0.2

================================================
FILE: apps/helloworld/quarkus/.dockerignore
================================================
*
!target/*-runner

================================================
FILE: apps/helloworld/quarkus/buildNativeLinux.sh
================================================
#!/bin/bash

export GRAALVM_HOME=~/tools/graalvm-ce-19.1.1/Contents/Home/

mvn package -Pnative -Dnative-image.docker-build=true -DskipTests

================================================
FILE: apps/helloworld/quarkus/buildNativeMac.sh
================================================
#!/bin/bash

export GRAALVM_HOME=~/tools/graalvm-ce-19.1.1/Contents/Home/

# Mac Native
mvn package -Pnative



================================================
FILE: apps/helloworld/quarkus/build_push_docker.sh
================================================
#!/bin/bash

IMAGE_VER=quarkus-demo:2.0.0

docker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .
docker login docker.io
docker tag dev.local/burrsutter/$IMAGE_VER docker.io/burrsutter/$IMAGE_VER
docker push docker.io/burrsutter/$IMAGE_VER


================================================
FILE: apps/helloworld/quarkus/build_push_quay.sh
================================================
#!/bin/bash

IMAGE_VER=quarkus-demo:2.0.0

docker build -f kubefiles/Dockerfile -t dev.local/burrsutter/$IMAGE_VER .
docker login quay.io
docker tag dev.local/burrsutter/$IMAGE_VER quay.io/burrsutter/$IMAGE_VER
docker push quay.io/burrsutter/$IMAGE_VER


================================================
FILE: apps/helloworld/quarkus/dockerbuild.sh
================================================
#!/bin/bash

docker build -f kubefiles/Dockerfile -t dev.local/rhdevelopers/quarkus-demo:v2 .

================================================
FILE: apps/helloworld/quarkus/dockerbuild_openshift.sh
================================================
#!/bin/bash

docker build -f kubefiles/Dockerfile.openshift -t dev.local/rhdevelopers/quarkus-demo:v2 .

================================================
FILE: apps/helloworld/quarkus/dockerpush_docker.sh
================================================
#!/bin/bash

# use docker images | grep quarkus to get the image ID for $1

docker login docker.io

docker tag $1 docker.io/burrsutter/quarkus-demo:2.0.0

docker push docker.io/burrsutter/quarkus-demo:2.0.0



================================================
FILE: apps/helloworld/quarkus/dockerpush_quay.sh
================================================
#!/bin/bash

# use docker images | grep quarkus to get the image ID for $1

docker login quay.io

docker tag $1 quay.io/rhdevelopers/quarkus-demo:v2

docker push quay.io/rhdevelopers/quarkus-demo:v2

echo 'quay.io marks repositories as private by default'
echo 'to update https://screencast.com/t/uAooYnghlW'

================================================
FILE: apps/helloworld/quarkus/kubefiles/Deployment.yml
================================================
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: myquarkus
  name: myquarkus
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myquarkus
  template:
    metadata:
      labels:
        app: myquarkus
    spec:
      containers:
      - name: myquarkus
        image: quay.io/rhdevelopers/quarkus-demo:v2
        ports:
          - containerPort: 8080
        resources:
          requests: 
            memory: "50Mi" 
            cpu: "250m" # 1/4 core
          limits:
            memory: "50Mi"
            cpu: "250m" 
        livenessProbe:
          httpGet:
              port: 8080
              path: /
          initialDelaySeconds: 1
          periodSeconds: 5
          timeoutSeconds: 2          
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 1
          periodSeconds: 3



================================================
FILE: apps/helloworld/quarkus/kubefiles/Deployment_quay.yml
================================================
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: myquarkus
  name: myquarkus
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myquarkus
  template:
    metadata:
      labels:
        app: myquarkus
    spec:
      containers:
      - name: myquarkus
        image: quay.io/rhdevelopers/quarkus-demo:v2
        ports:
          - containerPort: 8080
        resources:
          requests: 
            memory: "50Mi" 
            cpu: "250m" # 1/4 core
          limits:
            memory: "50Mi"
            cpu: "250m" 
        livenessProbe:
          httpGet:
              port: 8080
              path: /
          initialDelaySeconds: 1
          periodSeconds: 5
          timeoutSeconds: 2          
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 1
          periodSeconds: 3



================================================
FILE: apps/helloworld/quarkus/kubefiles/Dockerfile
================================================
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY target/*-runner /work/application
RUN chmod 775 /work
EXPOSE 8080
CMD ["./application", "-Xmx8m", "-Xmn8m", "-Xms8m"]

================================================
FILE: apps/helloworld/quarkus/kubefiles/Dockerfile.openshift
================================================
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
RUN chgrp -R 0 /work && \ 
    chmod -R g=u /work
COPY target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT [ "./application", "-Xmx8m", "-Xmn8m", "-Xms8m" ]


================================================
FILE: apps/helloworld/quarkus/kubefiles/Service.yml
================================================
apiVersion: v1
kind: Service
metadata:
  name: myquarkus
  labels:
    app: myquarkus    
spec:
  ports:
  - name: http
    port: 8080
  selector:
    app: myquarkus
  type: LoadBalancer

================================================
FILE: apps/helloworld/quarkus/poller.sh
================================================
#!/bin/bash

while true
do 
  curl $(minikube -p 9steps ip):$(kubectl get svc myapp -ojsonpath="{.spec.ports[?(@.port==8080)].nodePort}")
  sleep .2;
done



================================================
FILE: apps/helloworld/quarkus/pom.xml
================================================
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.redhat.developer.demo</groupId>
  <artifactId>quarkus-demo</artifactId>
  <version>2.0.0</version>
  <properties>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <surefire-plugin.version>2.22.0</surefire-plugin.version>
    <quarkus.version>1.3.2.Final</quarkus.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-bom</artifactId>
        <version>${quarkus.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemProperties>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-maven-plugin</artifactId>
            <version>${quarkus.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>native-image</goal>
                </goals>
                <configuration>
                  <enableHttpUrlHandler>true</enableHttpUrlHandler>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemProperties>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>


================================================
FILE: apps/helloworld/quarkus/readme.txt
================================================

mvn compile quarkus:dev
curl localhost:8080
ctrl-c 

mvn clean package

./buildNativeLinux.sh

./dockerbuild.sh


kubectl apply -f kubefiles/Deployment.yml
OR
kubectl apply -f kubefiles/Deployment_quay.yml

kubectl apply -f kubefiles/Service.yml

./poller.sh




================================================
FILE: apps/helloworld/quarkus/src/main/java/com/redhat/developer/demo/GreetingEndpoint.java
================================================
package com.redhat.developer.demo;


import javax.ws.rs.GET;
import javax.ws.rs.Path;

import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;


@Path("/") 
public class GreetingEndpoint {
    
    private String prefix = "Supersonic Subatomic Java with Quarkus";
    
    private String HOSTNAME =
       System.getenv().getOrDefault("HOSTNAME", "unknown");

    private int count = 0;

    @GET    
    @Produces(MediaType.TEXT_PLAIN)
    public String greet() {
        count++;
        return prefix + " " + HOSTNAME + ":" + count + "\n";
    }

    @GET
    @Path("/healthz")
    @Produces(MediaType.TEXT_PLAIN)
    public String health() {
        return "OK";
    }
    
    @GET
    @Path("/myresources") 
    public String getSystemResources() {
         long memory = Runtime.getRuntime().maxMemory();
         int cores = Runtime.getRuntime().availableProcessors();
         System.out.println("/myresources " + HOSTNAME);
         return 
             " Memory: " + (memory / 1024 / 1024) +
             " Cores: " + cores + "\n";
    }
    
    @GET
    @Path("/consume") 
    public String consumeSome() {
        System.out.println("/consume " + HOSTNAME);

        Runtime rt = Runtime.getRuntime();
        StringBuilder sb = new StringBuilder();
        long maxMemory = rt.maxMemory();
        long usedMemory = 0;
        // while usedMemory is less than 80% of Max
        while (((float) usedMemory / maxMemory) < 0.80) {
            sb.append(System.nanoTime() + sb.toString());
            usedMemory = rt.totalMemory();
        }
        String msg = "Allocated about 80% (" + humanReadableByteCount(usedMemory, false) + ") of the max allowed JVM memory size ("
            + humanReadableByteCount(maxMemory, false) + ")";
        System.out.println(msg);
        return msg + "\n";
    }

   public static String humanReadableByteCount(long bytes, boolean si) {
      int unit = si ? 1000 : 1024;
      if (bytes < unit)
        return bytes + " B";
      int exp = (int) (Math.log(bytes) / Math.log(unit));
      String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
      return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);  
   }

}

================================================
FILE: apps/helloworld/springboot/.devcontainer/Dockerfile
================================================
FROM openjdk:8u151
ENV JAVA_APP_JAR boot-demo-0.0.1.jar

## Ensure maven is installed
RUN apt-get update -y && apt-get install maven -y

WORKDIR /app/
EXPOSE 8080
CMD java -XX:+PrintFlagsFinal -XX:+PrintGCDetails $JAVA_OPTIONS -jar $JAVA_APP_JAR


================================================
FILE: apps/helloworld/springboot/.devcontainer/devcontainer.json
================================================
{
	"name": "Spring Boot Sample",
	"dockerFile": "Dockerfile",
	"appPort": "8080",
	 "extensions": [
	 	"vscjava.vscode-java-pack",
		 "redhat.vscode-xml",
	 ]
}


================================================
FILE: apps/helloworld/springboot/Dockerfile
================================================
FROM openjdk:17.0-slim
ENV JAVA_APP_JAR boot-demo-1.0.0.jar
WORKDIR /app/
COPY target/$JAVA_APP_JAR .
EXPOSE 8080
CMD java $JAVA_OPTIONS -jar $JAVA_APP_JAR

================================================
FILE: apps/helloworld/springboot/Dockerfile.openshift
================================================
FROM registry.access.redhat.com/ubi8/openjdk-8-runtime
WORKDIR /work/
ENV JAVA_APP_JAR boot-demo-1.0.0.jar
# the following is not needed on this Red Hat created image
# RUN chgrp -R 0 /work && \ 
#    chmod -R g=u /work
COPY target/$JAVA_APP_JAR .
EXPOSE 8080
USER 1001
CMD java $JAVA_OPTIONS -jar $JAVA_APP_JAR


================================================
FILE: apps/helloworld/springboot/Dockerfile_Java11
================================================
FROM openjdk:11-jre
ENV JAVA_APP_JAR boot-demo-1.0.0.jar
WORKDIR /app/
COPY target/$JAVA_APP_JAR .
EXPOSE 8080
CMD java -jar $JAVA_APP_JAR


================================================
FILE: apps/helloworld/springboot/Dockerfile_Memory
================================================
FROM openjdk:8u151-jre
ENV JAVA_APP_JAR boot-demo-1.0.0.jar
WORKDIR /app/
COPY target/$JAVA_APP_JAR .
EXPOSE 8080
CMD java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+PrintFlagsFinal -XX:+PrintGCDetails $JAVA_OPTIONS -jar $JAVA_APP_JAR


================================================
FILE: apps/helloworld/springboot/Dockerfile_Memory2
================================================
FROM openjdk:8u131-jre
ENV JAVA_APP_JAR boot-demo-1.0.0.jar
WORKDIR /app/
COPY target/$JAVA_APP_JAR .
EXPOSE 8080
CMD java -Xmx112M -XX:+PrintFlagsFinal -XX:+PrintGCDetails $JAVA_OPTIONS -jar $JAVA_APP_JAR


================================================
FILE: apps/helloworld/springboot/build_push_docker.sh
================================================
#!/bin/bash

IMAGE_VER=boot-demo:1.0.0

docker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .
docker login docker.io
docker tag dev.local/burrsutter/$IMAGE_VER docker.io/burrsutter/$IMAGE_VER
docker push docker.io/burrsutter/$IMAGE_VER


================================================
FILE: apps/helloworld/springboot/build_push_quay.sh
================================================
#!/bin/bash

IMAGE_VER=boot-demo:1.0.0

docker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .
docker login quay.io
docker tag dev.local/burrsutter/$IMAGE_VER quay.io/burrsutter/$IMAGE_VER
docker push quay.io/burrsutter/$IMAGE_VER


================================================
FILE: apps/helloworld/springboot/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.burrsutter</groupId>
	<artifactId>boot-demo</artifactId>
	<version>1.0.0</version>
	<packaging>jar</packaging>

	<name>helloboot</name>
	<description>Demo project for Spring Boot</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.3.4</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>17</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.3.0</version>
			</plugin>
		</plugins>
	</build>


</project>

================================================
FILE: apps/helloworld/springboot/readme.txt
================================================
Initial pom.xml created by start.spring.io

mvn clean compile package

java -jar target/boot-demo-1.0.0.jar
or
mvn spring-boot:run
curl http://localhost:8080/
ctrl-c

Manual Deployment

export IMAGE_VER=boot-demo:1.0.0

docker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .
docker login docker.io
docker tag dev.local/burrsutter/$IMAGE_VER docker.io/burrsutter/$IMAGE_VER
docker push docker.io/burrsutter/$IMAGE_VER

or

docker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .
docker login quay.io
docker tag dev.local/burrsutter/$IMAGE_VER quay.io/burrsutter/$IMAGE_VER
docker push quay.io/burrsutter/$IMAGE_VER

or 
docker build -f Dockerfile.openshift -t dev.local/burrsutter/$IMAGE_VER .


================================================
FILE: apps/helloworld/springboot/src/main/java/com/burrsutter/HellobootApplication.java
================================================
package com.burrsutter;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HellobootApplication {

	public static void main(String[] args) {
		SpringApplication.run(HellobootApplication.class, args);
	}
}


================================================
FILE: apps/helloworld/springboot/src/main/java/com/burrsutter/MyRESTController.java
================================================
package com.burrsutter;

import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class MyRESTController {
     @Autowired
     private Environment environment;

     final String hostname = System.getenv().getOrDefault("HOSTNAME", "unknown");
     String greeting;

     private int count = 0; // simple counter to see lifecycle
     boolean behave = true;
     boolean dead = false;

     RestTemplate restTemplate = new RestTemplate();

   @GetMapping("/appendgreetingfile")
   public ResponseEntity<String> appendGreetingToFile() throws IOException {
     
       try(final FileWriter fileWriter = new FileWriter("/tmp/demo/greeting.txt", true)) {
          fileWriter.append(environment.getProperty("GREETING","Jambo"));
          fileWriter.close();
       }
       return ResponseEntity.status(HttpStatus.CREATED).build();
   } 


   @GetMapping("/readgreetingfile")
   public String readGreetingFile() throws IOException {
        return new String(Files.readAllBytes(Paths.get("/tmp/demo/greeting.txt")));
   }

   @GetMapping("/")
   public String sayHello() {
       greeting = environment.getProperty("GREETING","Jambo");
       count++;
       System.out.println(greeting + " from " + hostname + " " + count);
       return greeting + " from Spring Boot! " + count + " on " + hostname + "\n";
   }

   @GetMapping("/sysresources")
   public String getSystemResources() {
        long memory = Runtime.getRuntime().maxMemory();
        int cores = Runtime.getRuntime().availableProcessors();
        System.out.println("/sysresources " + hostname);
        return 
            " Memory: " + (memory / 1024 / 1024) +
            " Cores: " + cores + "\n";
   }

   @GetMapping("/consume")
   public String consumeSome() {
        System.out.println("/consume " + hostname);

        Runtime rt = Runtime.getRuntime();
        StringBuilder sb = new StringBuilder();
        long maxMemory = rt.maxMemory();
        long usedMemory = 0;
        // while usedMemory is less than 80% of Max
        while (((float) usedMemory / maxMemory) < 0.80) {
            sb.append(System.nanoTime() + sb.toString());
            usedMemory = rt.totalMemory();
        }
        String msg = "Allocated about 80% (" + humanReadableByteCount(usedMemory, false) + ") of the max allowed JVM memory size ("
            + humanReadableByteCount(maxMemory, false) + ")";
        System.out.println(msg);
        return msg + "\n";
   }

   @GetMapping("/health")
   public ResponseEntity<String> health() {               
        if (behave) {
          return ResponseEntity.status(HttpStatus.OK)
          .body("I am fine, thank you\n");     
        } else {             
          return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body("Bad");          
        }
   }

   @GetMapping("/misbehave")
   public ResponseEntity<String> misbehave() {
        behave = false;
        return ResponseEntity.status(HttpStatus.OK).body("Misbehaving");
   }

   @GetMapping("/behave")
   public ResponseEntity<String> behave() {
        behave = true;
        return ResponseEntity.status(HttpStatus.OK).body("Ain't Misbehaving");
   }

   @GetMapping("/shot")
   public ResponseEntity<String> shot() {
        dead = true;
        return ResponseEntity.status(HttpStatus.OK).body("I have been shot in the head");
        // https://www.quora.com/Why-can-zombies-only-die-by-being-shot-in-the-head-Why-can-they-survive-all-the-blood-loss-and-still-live-If-zombies-were-real-anyway
   }

   @GetMapping("/reborn")
   public ResponseEntity<String> reborn() {
        dead = false;
        return ResponseEntity.status(HttpStatus.OK).body("I have been reborn");
        // https://www.quora.com/Why-can-zombies-only-die-by-being-shot-in-the-head-Why-can-they-survive-all-the-blood-loss-and-still-live-If-zombies-were-real-anyway
   }

   @GetMapping("/alive")
   public ResponseEntity<String> alive() {
    if (!dead) {
      return ResponseEntity.status(HttpStatus.OK)
      .body("It's Alive! (Frankenstein)\n");     
    } else {             
      return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body("All dead, not mostly dead (Princess Bride)");
    }
}



   @GetMapping("/configure")
   public String configure() {
        String databaseConn = environment.getProperty("DBCONN","Default");
        String msgBroker = environment.getProperty("MSGBROKER","Default");
        greeting = environment.getProperty("GREETING","Default");
        String love = environment.getProperty("LOVE","Default");
        return "Configuration for : " + hostname + "\n" 
            + "databaseConn=" + databaseConn + "\n"
            + "msgBroker=" + msgBroker + "\n"
            + "greeting=" + greeting + "\n"
            + "love=" + love + "\n";
   }

   @GetMapping("/callinganother")
   public String callinganother() {
        
        // <servicename>.<namespace>.svc.cluster.local
        String url = "http://mynode.yourspace.svc.cluster.local:8000/";

        ResponseEntity<String> response
        = restTemplate.getForEntity(url, String.class);
    
        String responseBody =  response.getBody();
        System.out.println(responseBody);

        return responseBody;
   }

   public static String humanReadableByteCount(long bytes, boolean si) {
        int unit = si ? 1000 : 1024;
        if (bytes < unit)
            return bytes + " B";
        int exp = (int) (Math.log(bytes) / Math.log(unit));
        String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
        return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
    }

}

================================================
FILE: apps/kubefiles/demo-dynamic-persistent.yaml
================================================
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: myboot-volumeclaim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Mi

================================================
FILE: apps/kubefiles/demo-ingress-2.yaml
================================================
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: kube-devnation.info
    http:
      paths:
      - path: /
        backend:
          serviceName: quarkus-demo-deployment
          servicePort: 8080
      - path: /v2
        backend:
          serviceName: mynode-deployment
          servicePort: 8000

================================================
FILE: apps/kubefiles/demo-ingress.yaml
================================================
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: kube-devnation.info
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service: 
            name: quarkus-demo-deployment
            port:
              number: 8080

================================================
FILE: apps/kubefiles/demo-persistent-volume-hostpath.yaml
================================================
kind: PersistentVolume
apiVersion: v1
metadata:
  name: my-persistent-volume
  labels:
    type: local
spec:
  storageClassName: pv-demo 
  capacity:
    storage: 100Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/persistent-volume"


================================================
FILE: apps/kubefiles/demo-persistent-volume-local.yaml
================================================
apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-persistent-volume
spec:
  capacity:
    storage: 10Mi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  storageClassName: pv-demo 
  local:
    path: "/tmp"
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - ip-10-0-138-222


================================================
FILE: apps/kubefiles/myboot-deployment-bad-image.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboo:v1
        ports:
          - containerPort: 8080

================================================
FILE: apps/kubefiles/myboot-deployment-configuration-secret.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080
        volumeMounts:          
          - name: mysecretvolume #<.>
            mountPath: /mystuff/secretstuff
            readOnly: true
        resources:
          requests: 
            memory: "300Mi" 
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
      volumes:
        - name: mysecretvolume #<.>
          secret:
            secretName: mysecret


================================================
FILE: apps/kubefiles/myboot-deployment-configuration.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1  
        ports:
          - containerPort: 8080
        envFrom:
        - configMapRef:
            name: my-config
        resources:
          requests: 
            memory: "300Mi" 
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core



================================================
FILE: apps/kubefiles/myboot-deployment-live-ready-aggressive.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
        env: dev
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "300Mi"
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
        livenessProbe:
          httpGet:
              port: 8080
              path: /alive
          periodSeconds: 2
          timeoutSeconds: 2
          failureThreshold: 2
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
          periodSeconds: 3

================================================
FILE: apps/kubefiles/myboot-deployment-live-ready.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
        env: dev
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "300Mi"
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
        livenessProbe:
          httpGet:
              port: 8080
              path: /alive
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 2
        readinessProbe:
          httpGet:  
            path: /health
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 3


================================================
FILE: apps/kubefiles/myboot-deployment-resources-limits-v2.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot-next
  name: myboot-next
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot-next
  template:
    metadata:
      labels:
        app: myboot-next
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v3
        ports:
          - containerPort: 8080
        resources:
          requests: 
            memory: "300Mi" 
            cpu: "250m" # 1/4 core
          limits:
            memory: "900Mi"
            cpu: "1000m" # 1 core



================================================
FILE: apps/kubefiles/myboot-deployment-resources-limits.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080
        resources:
          requests: 
            memory: "400Mi" 
            cpu: "250m" # 1/4 core
          # NOTE: These are the same limits we tested our Docker Container with earlier
          # -m matches limits.memory and --cpus matches limits.cpu
          limits:
            memory: "600Mi"
            cpu: "1000m" # 1 core



================================================
FILE: apps/kubefiles/myboot-deployment-resources.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080
        resources:
          requests: 
            memory: "300Mi" 
            cpu: "10000m" # 10 cores



================================================
FILE: apps/kubefiles/myboot-deployment-startup-live-ready.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
        env: dev
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "300Mi"
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
        livenessProbe:
          httpGet:
              port: 8080
              path: /alive
          periodSeconds: 2
          timeoutSeconds: 2
          failureThreshold: 2
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
          periodSeconds: 3
        startupProbe:
          httpGet:
            path: /alive
            port: 8080
          failureThreshold: 6
          periodSeconds: 5
          timeoutSeconds: 1

================================================
FILE: apps/kubefiles/myboot-deployment.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080


================================================
FILE: apps/kubefiles/myboot-node-affinity.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: color
                operator: In
                values:
                - blue
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080

================================================
FILE: apps/kubefiles/myboot-persistent-volume-claim.yaml
================================================
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: myboot-volumeclaim
spec:
  storageClassName: pv-demo 
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Mi


================================================
FILE: apps/kubefiles/myboot-pod-affinity.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot2
  name: myboot2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot2
  template:
    metadata:
      labels:
        app: myboot2
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - topologyKey: kubernetes.io/hostname
            labelSelector: 
              matchExpressions:
              - key: app
                operator: In
                values:
                - myboot
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080

================================================
FILE: apps/kubefiles/myboot-pod-antiaffinity.yaml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot3
  name: myboot3
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot3
  template:
    metadata:
      labels:
        app: myboot3
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - topologyKey: kubernetes.io/hostname
            labelSelector: 
              matchExpressions:
              - key: app
                operator: In
                values:
                - myboot
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080

================================================
FILE: apps/kubefiles/myboot-pod-volume-hostpath.yaml
================================================
apiVersion: v1
kind: Pod
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo
    image: quay.io/rhdevelopers/myboot:v4
    
    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  volumes:
  - name: demo-volume
    hostPath: #<.> 
      path: "/mnt/data" #<.>


================================================
FILE: apps/kubefiles/myboot-pod-volume-pvc.yaml
================================================
apiVersion: v1
kind: Pod
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo
    image: quay.io/rhdevelopers/myboot:v4
    
    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  volumes:
  - name: demo-volume
    persistentVolumeClaim:
      claimName: myboot-volumeclaim


================================================
FILE: apps/kubefiles/myboot-pod-volume.yml
================================================
apiVersion: v1
kind: Pod #<.>
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo
    image: quay.io/rhdevelopers/myboot:v4
    
    volumeMounts:
    - mountPath: /tmp/demo #<.>
      name: demo-volume #<.> 

  volumes:
  - name: demo-volume
    emptyDir: {}


================================================
FILE: apps/kubefiles/myboot-pods-volume.yml
================================================
apiVersion: v1
kind: Pod
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo-1 #<.>
    image: quay.io/rhdevelopers/myboot:v4
    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  - name: myboot-demo-2 #<.>
    image: quay.io/rhdevelopers/myboot:v4 #<.>

    env:
    - name: SERVER_PORT #<.>
      value: "8090"

    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  volumes:
  - name: demo-volume #<.>
    emptyDir: {}


================================================
FILE: apps/kubefiles/myboot-service.yml
================================================
apiVersion: v1
kind: Service
metadata:
  name: myboot
  labels:
    app: myboot    
spec:
  ports:
  - name: http
    port: 8080
  selector:
    app: myboot
  type: LoadBalancer

================================================
FILE: apps/kubefiles/myboot-toleration.yaml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      tolerations:
      - key: "color"
        operator: "Equal"
        value: "blue"
        effect: "NoSchedule"
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080



================================================
FILE: apps/kubefiles/mykafka.yml
================================================
apiVersion: kafka.strimzi.io/v1alpha1
kind: Kafka
metadata: 
  name: my-cluster
spec:
  kafka:
    replicas: 3
    listeners:
      external:
        type: nodeport
    storage:
      type: ephemeral
  zookeeper:
    replicas: 3
    storage:
      type: ephemeral
  entityOperator:
    topicOperator: {}

================================================
FILE: apps/kubefiles/quarkus-daemonset.yaml
================================================
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: quarkus-daemonset
  labels:
    app: quarkus-daemonset
spec:
  selector:
    matchLabels:
      app: quarkus-daemonset
  template:
    metadata:
      labels:
        app: quarkus-daemonset
    spec:
      containers:
      - name: quarkus-daemonset
        image: quay.io/rhdevelopers/quarkus-demo:v1

================================================
FILE: apps/kubefiles/quarkus-statefulset-external-svc.yaml
================================================
apiVersion: v1
kind: Service
metadata:
  name: quarkus-statefulset-2
spec:
  type: LoadBalancer #<.>
  externalTrafficPolicy: Local #<.>
  selector:
    statefulset.kubernetes.io/pod-name: quarkus-statefulset-2 #<.>
  ports:
  - port: 8080
    name: web

================================================
FILE: apps/kubefiles/quarkus-statefulset.yaml
================================================
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: quarkus-statefulset
  labels:
    app: quarkus-statefulset
spec:
  selector:
    matchLabels:
      app: quarkus-statefulset
  serviceName: "quarkus"
  replicas: 1
  template:
    metadata:
      labels:
        app: quarkus-statefulset
    spec:
      containers:
      - name: quarkus-statefulset
        image: quay.io/rhdevelopers/quarkus-demo:v1
        ports:
        - containerPort: 8080
          name: web
---
apiVersion: v1
kind: Service
metadata:
  name: quarkus
  labels:
    app: quarkus-statefulset
spec:
  ports:
  - port: 8080
    name: web
  clusterIP: None
  selector:
    app: quarkus-statefulset
---

================================================
FILE: apps/kubefiles/whalesay-cronjob.yaml
================================================
apiVersion: batch/v1
kind: CronJob
metadata:
  name: whale-say-cronjob
spec:
  schedule: "* * * * *" #<.>
  jobTemplate:                   
    spec:                        
      template:    
        metadata:
          labels:
            job-type: whale-say #<.>              
        spec:
          containers:
          - name: whale-say-container
            image: docker/whalesay
            command: ["cowsay","Hello DevNation"]
          restartPolicy: Never

================================================
FILE: apps/kubefiles/whalesay-job.yaml
================================================
apiVersion: batch/v1
kind: Job
metadata:
  name: whale-say-job #<.>
spec:
  template:
    spec:
      containers:
      - name: whale-say-container
        image: docker/whalesay
        command: ["cowsay","Hello DevNation"]
      restartPolicy: Never

================================================
FILE: apps/pizza-operator/.dockerignore
================================================
*
!target/*-runner
!target/*-runner.jar
!target/lib/*

================================================
FILE: apps/pizza-operator/.gitignore
================================================
# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties

================================================
FILE: apps/pizza-operator/.mvn/wrapper/MavenWrapperDownloader.java
================================================
/*
 * Copyright 2007-present the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

    private static final String WRAPPER_VERSION = "0.5.6";
    /**
     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
     */
    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
        + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

    /**
     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
     * use instead of the default one.
     */
    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
            ".mvn/wrapper/maven-wrapper.properties";

    /**
     * Path where the maven-wrapper.jar will be saved to.
     */
    private static final String MAVEN_WRAPPER_JAR_PATH =
            ".mvn/wrapper/maven-wrapper.jar";

    /**
     * Name of the property which should be used to override the default download url for the wrapper.
     */
    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

    public static void main(String args[]) {
        System.out.println("- Downloader started");
        File baseDirectory = new File(args[0]);
        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

        // If the maven-wrapper.properties exists, read it and check if it contains a custom
        // wrapperUrl parameter.
        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
        String url = DEFAULT_DOWNLOAD_URL;
        if(mavenWrapperPropertyFile.exists()) {
            FileInputStream mavenWrapperPropertyFileInputStream = null;
            try {
                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
                Properties mavenWrapperProperties = new Properties();
                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
            } catch (IOException e) {
                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
            } finally {
                try {
                    if(mavenWrapperPropertyFileInputStream != null) {
                        mavenWrapperPropertyFileInputStream.close();
                    }
                } catch (IOException e) {
                    // Ignore ...
                }
            }
        }
        System.out.println("- Downloading from: " + url);

        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
        if(!outputFile.getParentFile().exists()) {
            if(!outputFile.getParentFile().mkdirs()) {
                System.out.println(
                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
            }
        }
        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
        try {
            downloadFileFromURL(url, outputFile);
            System.out.println("Done");
            System.exit(0);
        } catch (Throwable e) {
            System.out.println("- Error downloading");
            e.printStackTrace();
            System.exit(1);
        }
    }

    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
            String username = System.getenv("MVNW_USERNAME");
            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password);
                }
            });
        }
        URL website = new URL(urlString);
        ReadableByteChannel rbc;
        rbc = Channels.newChannel(website.openStream());
        FileOutputStream fos = new FileOutputStream(destination);
        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
        fos.close();
        rbc.close();
    }

}


================================================
FILE: apps/pizza-operator/.mvn/wrapper/maven-wrapper.properties
================================================
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar


================================================
FILE: apps/pizza-operator/README.md
================================================
# pizza-operator project

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

## Running the application in dev mode

You can run your application in dev mode that enables live coding using:
```
./mvnw quarkus:dev
```

## Packaging and running the application

The application can be packaged using `./mvnw package`.
It produces the `pizza-operator-1.0.0-SNAPSHOT-runner.jar` file in the `/target` directory.
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory.

The application is now runnable using `java -jar target/pizza-operator-1.0.0-SNAPSHOT-runner.jar`.

## Creating a native executable

You can create a native executable using: `./mvnw package -Pnative`.

Or, if you don't have GraalVM installed, you can run the native executable build in a container using: `./mvnw package -Pnative -Dquarkus.native.container-build=true`.

You can then execute your native executable with: `./target/pizza-operator-1.0.0-SNAPSHOT-runner`

If you want to learn more about building native executables, please consult https://quarkus.io/guides/building-native-image.

================================================
FILE: apps/pizza-operator/mvnw
================================================
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

if [ -z "$MAVEN_SKIP_RC" ] ; then

  if [ -f /etc/mavenrc ] ; then
    . /etc/mavenrc
  fi

  if [ -f "$HOME/.mavenrc" ] ; then
    . "$HOME/.mavenrc"
  fi

fi

# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true
    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
    if [ -z "$JAVA_HOME" ]; then
      if [ -x "/usr/libexec/java_home" ]; then
        export JAVA_HOME="`/usr/libexec/java_home`"
      else
        export JAVA_HOME="/Library/Java/Home"
      fi
    fi
    ;;
esac

if [ -z "$JAVA_HOME" ] ; then
  if [ -r /etc/gentoo-release ] ; then
    JAVA_HOME=`java-config --jre-home`
  fi
fi

if [ -z "$M2_HOME" ] ; then
  ## resolve links - $0 may be a link to maven's home
  PRG="$0"

  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done

  saveddir=`pwd`

  M2_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  M2_HOME=`cd "$M2_HOME" && pwd`

  cd "$saveddir"
  # echo Using m2 at $M2_HOME
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --unix "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME="`(cd "$M2_HOME"; pwd)`"
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi

if [ -z "$JAVA_HOME" ]; then
  javaExecutable="`which javac`"
  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
    # readlink(1) is not available as standard on Solaris 10.
    readLink=`which readlink`
    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
      if $darwin ; then
        javaHome="`dirname \"$javaExecutable\"`"
        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
      else
        javaExecutable="`readlink -f \"$javaExecutable\"`"
      fi
      javaHome="`dirname \"$javaExecutable\"`"
      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
      JAVA_HOME="$javaHome"
      export JAVA_HOME
    fi
  fi
fi

if [ -z "$JAVACMD" ] ; then
  if [ -n "$JAVA_HOME"  ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD="`which java`"
  fi
fi

if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly." >&2
  echo "  We cannot execute $JAVACMD" >&2
  exit 1
fi

if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi

CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {

  if [ -z "$1" ]
  then
    echo "Path not specified to find_maven_basedir"
    return 1
  fi

  basedir="$1"
  wdir="$1"
  while [ "$wdir" != '/' ] ; do
    if [ -d "$wdir"/.mvn ] ; then
      basedir=$wdir
      break
    fi
    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
    if [ -d "${wdir}" ]; then
      wdir=`cd "$wdir/.."; pwd`
    fi
    # end of workaround
  done
  echo "${basedir}"
}

# concatenates all lines of a file
concat_lines() {
  if [ -f "$1" ]; then
    echo "$(tr -s '\n' ' ' < "$1")"
  fi
}

BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
  exit 1;
fi

##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Found .mvn/wrapper/maven-wrapper.jar"
    fi
else
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
    fi
    if [ -n "$MVNW_REPOURL" ]; then
      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
    else
      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
    fi
    while IFS="=" read key value; do
      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
      esac
    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Downloading from: $jarUrl"
    fi
    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
    if $cygwin; then
      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
    fi

    if command -v wget > /dev/null; then
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Found wget ... using wget"
        fi
        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
            wget "$jarUrl" -O "$wrapperJarPath"
        else
            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
        fi
    elif command -v curl > /dev/null; then
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Found curl ... using curl"
        fi
        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
            curl -o "$wrapperJarPath" "$jarUrl" -f
        else
            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
        fi

    else
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Falling back to using Java to download"
        fi
        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
        # For Cygwin, switch paths to Windows format before running javac
        if $cygwin; then
          javaClass=`cygpath --path --windows "$javaClass"`
        fi
        if [ -e "$javaClass" ]; then
            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                if [ "$MVNW_VERBOSE" = true ]; then
                  echo " - Compiling MavenWrapperDownloader.java ..."
                fi
                # Compiling the Java class
                ("$JAVA_HOME/bin/javac" "$javaClass")
            fi
            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                # Running the downloader
                if [ "$MVNW_VERBOSE" = true ]; then
                  echo " - Running MavenWrapperDownloader.java ..."
                fi
                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
            fi
        fi
    fi
fi
##########################################################################################
# End of extension
##########################################################################################

export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
  echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --path --windows "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS

WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

exec "$JAVACMD" \
  $MAVEN_OPTS \
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"


================================================
FILE: apps/pizza-operator/mvnw.cmd
================================================
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"

FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)

@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
    if "%MVNW_VERBOSE%" == "true" (
        echo Found %WRAPPER_JAR%
    )
) else (
    if not "%MVNW_REPOURL%" == "" (
        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
    )
    if "%MVNW_VERBOSE%" == "true" (
        echo Couldn't find %WRAPPER_JAR%, downloading it ...
        echo Downloading from: %DOWNLOAD_URL%
    )

    powershell -Command "&{"^
		"$webclient = new-object System.Net.WebClient;"^
		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
		"}"^
		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
		"}"
    if "%MVNW_VERBOSE%" == "true" (
        echo Finished downloading %WRAPPER_JAR%
    )
)
@REM End of extension

@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*

%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%


================================================
FILE: apps/pizza-operator/pom.xml
================================================
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.acme</groupId>
  <artifactId>pizza-operator</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <properties>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus-plugin.version>1.5.0.Final</quarkus-plugin.version>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
    <quarkus.platform.version>1.5.0.Final</quarkus.platform.version>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${quarkus.platform.group-id}</groupId>
        <artifactId>${quarkus.platform.artifact-id}</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-kubernetes-client</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>


================================================
FILE: apps/pizza-operator/src/main/docker/Dockerfile.jvm
================================================
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the docker image run:
#
# mvn package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/pizza-operator-jvm .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/pizza-operator-jvm
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005) like this :  EXPOSE 8080 5050
# 
# Then run the container using : 
#
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/pizza-operator-jvm
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1

ARG JAVA_PACKAGE=java-11-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
    && microdnf update \
    && microdnf clean all \
    && mkdir /deployments \
    && chown 1001 /deployments \
    && chmod "g+rwX" /deployments \
    && chown 1001:root /deployments \
    && 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 \
    && chown 1001 /deployments/run-java.sh \
    && chmod 540 /deployments/run-java.sh \
    && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security

# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar

EXPOSE 8080
USER 1001

ENTRYPOINT [ "/deployments/run-java.sh" ]

================================================
FILE: apps/pizza-operator/src/main/docker/Dockerfile.native
================================================
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
#
# Before building the docker image run:
#
# mvn package -Pnative -Dquarkus.native.container-build=true
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native -t quarkus/pizza-operator .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/pizza-operator
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
WORKDIR /work/
COPY --chown=1001:root target/*-runner /work/application

EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/ExampleResource.java
================================================
package org.acme;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class ExampleResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "hello";
    }
}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/KubernetesClientProducer.java
================================================
package org.acme;

import io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.internal.KubernetesDeserializer;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.enterprise.inject.Produces;
import javax.inject.Named;
import javax.inject.Singleton;

public class KubernetesClientProducer {

    @Produces
    @Singleton
    @Named("namespace")
    String findMyCurrentNamespace() throws IOException {
        return new
            String(Files.readAllBytes(Paths.get("/var/run/secrets/kubernetes.io/serviceaccount/namespace")));
    }

    @Produces
    @Singleton
    KubernetesClient makeDefaultClient(@Named("namespace") String namespace) {
        return new DefaultKubernetesClient().inNamespace(namespace);
    }

    @Produces
    @Singleton
    NonNamespaceOperation<PizzaResource, PizzaResourceList, PizzaResourceDoneable, Resource<PizzaResource, PizzaResourceDoneable>>
    makeCustomHelloResourceClient(KubernetesClient defaultClient, @Named("namespace") String namespace) {

        KubernetesDeserializer.registerCustomKind("mykubernetes.acme.org/v1beta2", "Pizza", PizzaResource.class);

        CustomResourceDefinition crd = defaultClient.customResourceDefinitions()
        .list()
        .getItems()
        .stream()
        .filter(d -> "pizzas.mykubernetes.acme.org".equals(d.getMetadata().getName()))
        .findAny()
            .orElseThrow(() -> new RuntimeException("Deployment error: Custom resource definition mykubernetes.acme.org/v1beta2 not found."));
            
        return defaultClient.customResources(crd, PizzaResource.class, PizzaResourceList.class, PizzaResourceDoneable.class).inNamespace(namespace);

    }

}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResource.java
================================================
package org.acme;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.client.CustomResource;

@JsonDeserialize
public class PizzaResource extends CustomResource {

    private PizzaResourceSpec spec;
    private PizzaResourceStatus status;
    // getters/setters

    public PizzaResourceSpec getSpec() {
        return spec;
    }

    public void setSpec(PizzaResourceSpec spec) {
        this.spec = spec;
    }

    public PizzaResourceStatus getStatus() {
        return status;
    }

    public void setStatus(PizzaResourceStatus status) {
        this.status = status;
    }

    @Override
    public String toString() {
        String name = getMetadata() != null ? getMetadata().getName() : "unknown";
        String version = getMetadata() != null ? getMetadata().getResourceVersion() : "unknown";
        return "name=" + name + " version=" + version + " value=" + spec;
    }
}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceDoneable.java
================================================
package org.acme;

import io.fabric8.kubernetes.api.builder.Function;
import io.fabric8.kubernetes.client.CustomResourceDoneable;

public class PizzaResourceDoneable extends CustomResourceDoneable<PizzaResource> {

    public PizzaResourceDoneable(PizzaResource resource, Function<PizzaResource, PizzaResource> function) {
        super(resource, function);
    }
}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceList.java
================================================
package org.acme;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.fabric8.kubernetes.client.CustomResourceList;

@JsonSerialize
public class PizzaResourceList extends CustomResourceList<PizzaResource> {

}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceSpec.java
================================================
package org.acme;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.ArrayList;
import java.util.List;

@JsonDeserialize
@RegisterForReflection
public class PizzaResourceSpec {

    @JsonProperty("toppings")
    private List<String> toppings = new ArrayList<>();
    @JsonProperty("sauce")
    private String sauce;
    // getters/setters

    public List<String> getToppings() {
        return toppings;
    }

    public void setToppings(List<String> toppings) {
        this.toppings = toppings;
    }

    public String getSauce() {
        return sauce;
    }

    public void setSauce(String sauce) {
        this.sauce = sauce;
    }
}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceStatus.java
================================================
package org.acme;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@JsonDeserialize
public class PizzaResourceStatus {

}

================================================
FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceWatcher.java
================================================
package org.acme;

import io.fabric8.kubernetes.api.model.ContainerBuilder;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodBuilder;
import io.fabric8.kubernetes.api.model.PodSpecBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.Watcher;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.quarkus.runtime.StartupEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

public class PizzaResourceWatcher {

    @Inject
    KubernetesClient defaultClient;

    @Inject
    NonNamespaceOperation<PizzaResource, PizzaResourceList, PizzaResourceDoneable, Resource<PizzaResource, PizzaResourceDoneable>> crClient;

    void onStartup(@Observes StartupEvent event) {
        System.out.println("Startup");
        crClient.watch(new Watcher<PizzaResource>() { //<.>
            @Override
            public void eventReceived(Action action, PizzaResource resource) {
                System.out.println("Event " + action.name());
                if (action == Action.ADDED) {
                    final String app = resource.getMetadata().getName();
                    final String sauce = resource.getSpec().getSauce();
                    final List<String> toppings = resource.getSpec().getToppings();
                    final Map<String, String> labels = new HashMap<>();
                    labels.put("app", app);
                    final ObjectMetaBuilder objectMetaBuilder = new ObjectMetaBuilder().withName(app + "-pod")
                            .withNamespace(resource.getMetadata().getNamespace()).withLabels(labels);
                    final ContainerBuilder containerBuilder = new ContainerBuilder().withName("pizza-maker")
                            .withImage("quay.io/lordofthejars/pizza-maker:1.0.0").withCommand("/work/application")
                            .withArgs("--sauce=" + sauce, "--toppings=" + String.join(",", toppings));
                    final PodSpecBuilder podSpecBuilder = new PodSpecBuilder().withContainers(containerBuilder.build())
                            .withRestartPolicy("Never");
                    final PodBuilder podBuilder = new PodBuilder().withMetadata(objectMetaBuilder.build())
                            .withSpec(podSpecBuilder.build());
                    final Pod pod = podBuilder.build();
                    defaultClient.resource(pod).createOrReplace();

                }
            }

            @Override
            public void onClose(KubernetesClientException e) {
            }
        });
    }

}

================================================
FILE: apps/pizza-operator/src/main/resources/META-INF/resources/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>pizza-operator - 1.0.0-SNAPSHOT</title>
    <style>
        h1, h2, h3, h4, h5, h6 {
            margin-bottom: 0.5rem;
            font-weight: 400;
            line-height: 1.5;
        }

        h1 {
            font-size: 2.5rem;
        }

        h2 {
            font-size: 2rem
        }

        h3 {
            font-size: 1.75rem
        }

        h4 {
            font-size: 1.5rem
        }

        h5 {
            font-size: 1.25rem
        }

        h6 {
            font-size: 1rem
        }

        .lead {
            font-weight: 300;
            font-size: 2rem;
        }

        .banner {
            font-size: 2.7rem;
            margin: 0;
            padding: 2rem 1rem;
            background-color: #00A1E2;
            color: white;
        }

        body {
            margin: 0;
            font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
        }

        code {
            font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 87.5%;
            color: #e83e8c;
            word-break: break-word;
        }

        .left-column {
            padding: .75rem;
            max-width: 75%;
            min-width: 55%;
        }

        .right-column {
            padding: .75rem;
            max-width: 25%;
        }

        .container {
            display: flex;
            width: 100%;
        }

        li {
            margin: 0.75rem;
        }

        .right-section {
            margin-left: 1rem;
            padding-left: 0.5rem;
        }

        .right-section h3 {
            padding-top: 0;
            font-weight: 200;
        }

        .right-section ul {
            border-left: 0.3rem solid #00A1E2;
            list-style-type: none;
            padding-left: 0;
        }

    </style>
</head>
<body>

<div class="banner lead">
    Your new Cloud-Native application is ready!
</div>

<div class="container">
    <div class="left-column">
        <p class="lead"> Congratulations, you have created a new Quarkus application.</p>

        <h2>Why do you see this?</h2>

        <p>This page is served by Quarkus. The source is in
            <code>src/main/resources/META-INF/resources/index.html</code>.</p>

        <h2>What can I do from here?</h2>

        <p>If not already done, run the application in <em>dev mode</em> using: <code>mvn compile quarkus:dev</code>.
        </p>
        <ul>
            <li>Add REST resources, Servlets, functions and other services in <code>src/main/java</code>.</li>
            <li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li>
            <li>Configure your application in <code>src/main/resources/application.properties</code>.
            </li>
        </ul>

        <h2>Do you like Quarkus?</h2>
        <p>Go give it a star on <a href="https://github.com/quarkusio/quarkus">GitHub</a>.</p>

        <h2>How do I get rid of this page?</h2>
        <p>Just delete the <code>src/main/resources/META-INF/resources/index.html</code> file.</p>
    </div>
    <div class="right-column">
        <div class="right-section">
            <h3>Application</h3>
            <ul>
                <li>GroupId: org.acme</li>
                <li>ArtifactId: pizza-operator</li>
                <li>Version: 1.0.0-SNAPSHOT</li>
                <li>Quarkus Version: 1.5.0.Final</li>
            </ul>
        </div>
        <div class="right-section">
            <h3>Next steps</h3>
            <ul>
                <li><a href="https://quarkus.io/guides/maven-tooling.html" target="_blank">Setup your IDE</a></li>
                <li><a href="https://quarkus.io/guides/getting-started.html" target="_blank">Getting started</a></li>
                <li><a href="https://quarkus.io" target="_blank">Quarkus Web Site</a></li>
            </ul>
        </div>
    </div>
</div>


</body>
</html>

================================================
FILE: apps/pizza-operator/src/main/resources/application.properties
================================================


================================================
FILE: apps/pizza-operator/src/test/java/org/acme/ExampleResourceTest.java
================================================
package org.acme;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

@QuarkusTest
public class ExampleResourceTest {

    @Test
    public void testHelloEndpoint() {
        given()
          .when().get("/hello")
          .then()
             .statusCode(200)
             .body(is("hello"));
    }

}

================================================
FILE: apps/pizza-operator/src/test/java/org/acme/NativeExampleResourceIT.java
================================================
package org.acme;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class NativeExampleResourceIT extends ExampleResourceTest {

    // Execute the same tests but in native mode.
}

================================================
FILE: apps/pizzas/cheese-pizza.yaml
================================================
apiVersion: mykubernetes.acme.org/v1
kind: Pizza
metadata:
  name: cheesep
spec:
  toppings:
  - mozzarella
  sauce: regular


================================================
FILE: apps/pizzas/meat-pizza.yaml
================================================
apiVersion: mykubernetes.acme.org/v1
kind: Pizza
metadata:
  name: meatsp
spec:
  toppings:
  - mozzarella
  - pepperoni
  - sausage
  - bacon
  sauce: extra

================================================
FILE: apps/pizzas/pizza-crd.yaml
================================================
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: pizzas.mykubernetes.acme.org
  labels:
    app: pizzamaker
    mylabel: stuff
spec:
  group: mykubernetes.acme.org
  scope: Namespaced
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        description: "A custom resource for making yummy pizzas" #<.>
        type: object
        properties:
          spec:
            type: object
            description: "Information about our pizza"
            properties:
              toppings: #<.>
                type: array
                items:
                  type: string
                description: "List of toppings for our pizza"
              sauce: #<.>
                type: string
                description: "The name of the sauce to use on our pizza"
  names:
    kind: Pizza #<.>
    listKind: PizzaList
    plural: pizzas
    singular: pizza
    shortNames:
    - pz

================================================
FILE: apps/pizzas/pizza-deployment.yaml
================================================
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: quarkus-operator-example
rules:
- apiGroups:
  - ''
  resources:
  - pods
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - delete
  - patch
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - list
- apiGroups:
  - mykubernetes.acme.org
  resources:
  - pizzas
  verbs:
  - list
  - watch
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: quarkus-operator-example
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: quarkus-operator-example
subjects:
- kind: ServiceAccount
  name: quarkus-operator-example
  namespace: pizzahat
roleRef:
  kind: ClusterRole
  name: quarkus-operator-example
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: quarkus-operator-example
spec:
  selector:
    matchLabels:
      app: quarkus-operator-example
  replicas: 1
  template:
    metadata:
      labels:
        app: quarkus-operator-example
    spec:
      serviceAccountName: quarkus-operator-example
      containers:
      - image: quay.io/rhdevelopers/pizza-operator:1.0.1
        name: quarkus-operator-example
        imagePullPolicy: IfNotPresent

================================================
FILE: apps/pizzas/veggie-lovers.yaml
================================================
apiVersion: mykubernetes.acme.org/v1
kind: Pizza
metadata:
  name: veggiep
spec:
  toppings:
  - mozzarella
  - black olives
  sauce: extra


================================================
FILE: bin/build-site.sh
================================================
#!/bin/sh
docker run -u $(id -u) -v $PWD:/antora:Z --rm -t antora/antora:2.3.1 --cache-dir=./.cache/antora github-pages.yml


================================================
FILE: documentation/antora.yml
================================================
name: kubernetes-tutorial
version: v1.34
display_version: v1.34
prerelease: false
nav:
  - modules/ROOT/nav.adoc
start_page: ROOT:index.adoc


================================================
FILE: documentation/modules/ROOT/examples/PizzaResourceWatcher.java
================================================
package org.acme;

import io.fabric8.kubernetes.api.model.ContainerBuilder;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodBuilder;
import io.fabric8.kubernetes.api.model.PodSpecBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.Watcher;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.quarkus.runtime.StartupEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

public class PizzaResourceWatcher {

    @Inject
    KubernetesClient defaultClient;

    @Inject
    NonNamespaceOperation<PizzaResource, PizzaResourceList, PizzaResourceDoneable, Resource<PizzaResource, PizzaResourceDoneable>> crClient;

    void onStartup(@Observes StartupEvent event) {
        System.out.println("Startup");
        crClient.watch(new Watcher<PizzaResource>() { //<.>
            @Override
            public void eventReceived(Action action, PizzaResource resource) {
                System.out.println("Event " + action.name());
                if (action == Action.ADDED) {
                    final String app = resource.getMetadata().getName();
                    final String sauce = resource.getSpec().getSauce();
                    final List<String> toppings = resource.getSpec().getToppings();
                    final Map<String, String> labels = new HashMap<>();
                    labels.put("app", app);
                    final ObjectMetaBuilder objectMetaBuilder = new ObjectMetaBuilder().withName(app + "-pod")
                            .withNamespace(resource.getMetadata().getNamespace()).withLabels(labels);
                    final ContainerBuilder containerBuilder = new ContainerBuilder().withName("pizza-maker")
                            .withImage("quay.io/lordofthejars/pizza-maker:1.0.0").withCommand("/work/application")
                            .withArgs("--sauce=" + sauce, "--toppings=" + String.join(",", toppings));
                    final PodSpecBuilder podSpecBuilder = new PodSpecBuilder().withContainers(containerBuilder.build())
                            .withRestartPolicy("Never");
                    final PodBuilder podBuilder = new PodBuilder().withMetadata(objectMetaBuilder.build())
                            .withSpec(podSpecBuilder.build());
                    final Pod pod = podBuilder.build();
                    defaultClient.resource(pod).createOrReplace();

                }
            }

            @Override
            public void onClose(KubernetesClientException e) {
            }
        });
    }

}

================================================
FILE: documentation/modules/ROOT/examples/cheese-pizza.yaml
================================================


================================================
FILE: documentation/modules/ROOT/examples/meat-pizza.yaml
================================================
apiVersion: mykubernetes.acme.org/v1
kind: Pizza
metadata:
  name: meatsp
spec:
  toppings:
  - mozzarella
  - pepperoni
  - sausage
  - bacon
  sauce: extra

================================================
FILE: documentation/modules/ROOT/examples/myboot-deployment-configuration-secret.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myboot
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        ports:
          - containerPort: 8080
        volumeMounts:          
          - name: mysecretvolume #<.>
            mountPath: /mystuff/secretstuff
            readOnly: true
        resources:
          requests: 
            memory: "300Mi" 
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
      volumes:
        - name: mysecretvolume #<.>
          secret:
            secretName: mysecret


================================================
FILE: documentation/modules/ROOT/examples/myboot-deployment-live-ready-aggressive.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
        env: dev
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "300Mi"
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
        livenessProbe:
          httpGet:
              port: 8080
              path: /alive
          periodSeconds: 2
          timeoutSeconds: 2
          failureThreshold: 2
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
          periodSeconds: 3

================================================
FILE: documentation/modules/ROOT/examples/myboot-deployment-live-ready.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
        env: dev
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "300Mi"
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
        livenessProbe:
          httpGet:
              port: 8080
              path: /alive
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 2
        readinessProbe:
          httpGet:  
            path: /health
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 3


================================================
FILE: documentation/modules/ROOT/examples/myboot-deployment-startup-live-ready.yml
================================================
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myboot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myboot
  template:
    metadata:
      labels:
        app: myboot
        env: dev
    spec:
      containers:
      - name: myboot
        image: quay.io/rhdevelopers/myboot:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "300Mi"
            cpu: "250m" # 1/4 core
          limits:
            memory: "400Mi"
            cpu: "1000m" # 1 core
        livenessProbe:
          httpGet:
              port: 8080
              path: /alive
          periodSeconds: 2
          timeoutSeconds: 2
          failureThreshold: 2
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
          periodSeconds: 3
        startupProbe:
          httpGet:
            path: /alive
            port: 8080
          failureThreshold: 6
          periodSeconds: 5
          timeoutSeconds: 1

================================================
FILE: documentation/modules/ROOT/examples/myboot-pod-volume-hostpath.yaml
================================================
apiVersion: v1
kind: Pod
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo
    image: quay.io/rhdevelopers/myboot:v4
    
    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  volumes:
  - name: demo-volume
    hostPath: #<.> 
      path: "/mnt/data" #<.>


================================================
FILE: documentation/modules/ROOT/examples/myboot-pod-volume.yml
================================================
apiVersion: v1
kind: Pod #<.>
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo
    image: quay.io/rhdevelopers/myboot:v4
    
    volumeMounts:
    - mountPath: /tmp/demo #<.>
      name: demo-volume #<.> 

  volumes:
  - name: demo-volume
    emptyDir: {}


================================================
FILE: documentation/modules/ROOT/examples/myboot-pods-volume.yml
================================================
apiVersion: v1
kind: Pod
metadata:
  name: myboot-demo
spec:
  containers:
  - name: myboot-demo-1 #<.>
    image: quay.io/rhdevelopers/myboot:v4
    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  - name: myboot-demo-2 #<.>
    image: quay.io/rhdevelopers/myboot:v4 #<.>

    env:
    - name: SERVER_PORT #<.>
      value: "8090"

    volumeMounts:
    - mountPath: /tmp/demo
      name: demo-volume

  volumes:
  - name: demo-volume #<.>
    emptyDir: {}


================================================
FILE: documentation/modules/ROOT/examples/pizza-crd.yaml
================================================
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: pizzas.mykubernetes.acme.org
  labels:
    app: pizzamaker
    mylabel: stuff
spec:
  group: mykubernetes.acme.org
  scope: Namespaced
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        description: "A custom resource for making yummy pizzas" #<.>
        type: object
        properties:
          spec:
            type: object
            description: "Information about our pizza"
            properties:
              toppings: #<.>
                type: array
                items:
                  type: string
                description: "List of toppings for our pizza"
              sauce: #<.>
                type: string
                description: "The name of the sauce to use on our pizza"
  names:
    kind: Pizza #<.>
    listKind: PizzaList
    plural: pizzas
    singular: pizza
    shortNames:
    - pz

================================================
FILE: documentation/modules/ROOT/examples/quarkus-statefulset-external-svc.yaml
================================================
apiVersion: v1
kind: Service
metadata:
  name: quarkus-statefulset-2
spec:
  type: LoadBalancer #<.>
  externalTrafficPolicy: Local #<.>
  selector:
    statefulset.kubernetes.io/pod-name: quarkus-statefulset-2 #<.>
  ports:
  - port: 8080
    name: web

================================================
FILE: documentation/modules/ROOT/examples/whalesay-cronjob.yaml
================================================
apiVersion: batch/v1
kind: CronJob
metadata:
  name: whale-say-cronjob
spec:
  schedule: "* * * * *" #<.>
  jobTemplate:                   
    spec:                        
      template:    
        metadata:
          labels:
            job-type: whale-say #<.>              
        spec:
          containers:
          - name: whale-say-container
            image: docker/whalesay
            command: ["cowsay","Hello DevNation"]
          restartPolicy: Never

================================================
FILE: documentation/modules/ROOT/examples/whalesay-job.yaml
================================================
apiVersion: batch/v1
kind: Job
metadata:
  name: whale-say-job #<.>
spec:
  template:
    spec:
      containers:
      - name: whale-say-container
        image: docker/whalesay
        command: ["cowsay","Hello DevNation"]
      restartPolicy: Never

================================================
FILE: documentation/modules/ROOT/nav.adoc
================================================
* 1. Requirements
** xref:installation.adoc[Installation]
*** xref:installation.adoc#tutorial-all-local[CLI]
*** xref:installation.adoc#install-minikube[Install Minikube]
*** xref:installation.adoc#start-kubernetes[Start Kubernetes]

* 2. Beginner
** xref:kubectl.adoc[kubectl]
** xref:pod-rs-deployment.adoc[Pod, ReplicaSet, Deployment]
** xref:service.adoc[Service]
** xref:logs.adoc[Logs]
** xref:service-magic.adoc[Service Magic]
** xref:blue-green.adoc[Blue/Green Deployments]

* 3. Elementary
** xref:building-images.adoc[Building Images]
** xref:resources.adoc[Resources and Limits]
** xref:rolling-updates.adoc[Rolling updates]
** xref:live-ready.adoc[Liveness, Readiness & Startup]
** xref:configmap.adoc[ConfigMap]

* 4. Intermediate
** xref:secrets.adoc[Secrets]
** xref:crds.adoc[Operators]
** xref:volumes-persistentvolumes.adoc[Volumes]
** xref:taints-affinity.adoc[Taints & Affinity]
** xref::jobs-cronjobs.adoc[Jobs & CronJobs]
** xref::daemonset.adoc[DaemonSet]
** xref::statefulset.adoc[StatefulSet]

* 5. Advanced
** xref:ingress.adoc[Ingress]-

================================================
FILE: documentation/modules/ROOT/pages/_attributes.adoc
================================================
:moduledir: ..
:branch: master
:github-repo: https://github.com/redhat-scholars/kubernetes-tutorial
:openshift-version: 4.3
:vm-driver: virtualbox
:profile: devnation
:curl-loop-sleep-time: .3

================================================
FILE: documentation/modules/ROOT/pages/_partials/affinity_label.adoc
================================================
// tag::openshift[]
:chosen-node: ip-10-0-175-64.eu-central-1.compute.internal
// end::openshift[]
// tag::minikube[]
:chosen-node: devnation-m02
// end::minikube[]

Get a list of nodes:

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get nodes
----

[.console-output]
[source,bash,subs="+attributes,+quotes"]
----
NAME                                            STATUS   ROLES    AGE   VERSION
# tag::openshift[]
ip-10-0-136-107.eu-central-1.compute.internal   Ready    master   26h   v1.16.2
ip-10-0-140-186.eu-central-1.compute.internal   Ready    worker   26h   v1.16.2
ip-10-0-141-128.eu-central-1.compute.internal   Ready    worker   25h   v1.16.2
ip-10-0-146-109.eu-central-1.compute.internal   Ready    worker   25h   v1.16.2
ip-10-0-150-226.eu-central-1.compute.internal   Ready    worker   26h   v1.16.2
ip-10-0-155-122.eu-central-1.compute.internal   Ready    master   26h   v1.16.2
ip-10-0-162-206.eu-central-1.compute.internal   Ready    worker   26h   v1.16.2
ip-10-0-168-102.eu-central-1.compute.internal   Ready    master   26h   v1.16.2
#{chosen-node}#    Ready    worker   25h   v1.16.2
# end::openshift[]
# tag::minikube[]
devnation       Ready    control-plane,master   3d    v1.21.2
#{chosen-node}#   Ready    <none>                 42h   v1.21.2
# end::minikube[]
----

Then pick a node in the list to label (such as the one highlighted)

[.console-input]
[source,bash,subs="+macros,+attributes,+quotes"]
----
kubectl label nodes {chosen-node} #color=blue# #<.>
----
<.> Notice that this matches the affinity in the pod

[.console-output]
[source,bash,subs="+attributes"]
----
node/{chosen-node} labeled
----


================================================
FILE: documentation/modules/ROOT/pages/_partials/find_node_for_pod.adoc
================================================
[.console-input]
[source,bash,subs="+macros"]
----
NODE=$(kubectl get pod -o jsonpath='{.items[0].spec.nodeName}') #<.>
echo ${NODE}

----
<.> the `.items[0]` is because we're asking for all pods, but we know our list will contain only one element

================================================
FILE: documentation/modules/ROOT/pages/_partials/invoke-service.adoc
================================================
[k8s-env='']
[k8s-cli='']
[doc-sec='']



================================================
FILE: documentation/modules/ROOT/pages/_partials/set-env-vars.adoc
================================================
.Environment Variables

[cols="4*^,4*."]
|===
|**Variable** |**Description** |**Default Value** | **e.g.**

|REGISTRY_USERNAME
|The Container Registry User Id that will be used to authenticate against the container registry `$REGISTRY_URL`
|
|demo

|REGISTRY_PASSWORD
|The Container Registry User Password that will be used to authenticate against the container registry `$REGISTRY_URL`
|
|demopassword

|REGISTRY_URL
|The Container Registry URL, defaults to https://index.docker.io
|https://index.docker.io
|https://quay.io/v2

|DESTINATION_IMAGE_NAME
|The fully qualified image name that will be built
|
| quay.io/foo/bar:v1.0
|===

================================================
FILE: documentation/modules/ROOT/pages/_partials/verify-setup.adoc
================================================

The following checks ensure that each chapter exercises are done with the right environment settings.

[#minikube-config-view]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
minikube config view
----

The command should return an output as shown:

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
- profile: devnation
- vm-driver: virtualbox
- cpus: 2
- kubernetes-version: {kubernetes-version}
- memory: 6144
----

[#k8s-cluster-info]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl cluster-info
----

The command should return an output as shown:

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
Kubernetes master is running at https://192.168.99.100:8443
KubeDNS is running at https://192.168.99.100:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
----

[NOTE]
====
To further debug and diagnose cluster problems, use `kubectl cluster-info dump`.
====

* Set your local docker to use the minikube docker daemon

[#minikube-set-env]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
eval $(minikube docker-env)
----

* Kubernetes should be {kubernetes-version}

[#kubectl-version]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl version
----
--



================================================
FILE: documentation/modules/ROOT/pages/_partials/watching-logs.adoc
================================================
[kube-ns='kubernetestutorial']
[kube-svc='']

Since a Cron job source is used in this section of the tutorial, it would emit events every minute. We can watch the logs of the service to see the messages delivered.

The logs could be watched using the command:
[tabs]
====
kubectl::
+
--
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl logs -n {kube-ns} -f <pod-name> -c user-container
----
--
oc::
+
--

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
oc logs -n {kube-ns} -f <pod-name> -c user-container
----
--
====

[TIP]
====
* Using stern with the command `stern  -n {kube-ns} {kube-svc}`, to filter the logs further add `-c user-container` to the stern command.

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
stern -n {kube-ns} -c user-container {kube-svc} 
----
====


================================================
FILE: documentation/modules/ROOT/pages/blue-green.adoc
================================================
= Blue/Green

https://martinfowler.com/bliki/BlueGreenDeployment.html[Here] you can find a description and history of Blue/Green Deployment.

Make sure you are in the correct namespace

:section-k8s: bluegreen
:set-namespace: myspace

include::partial$set-context.adoc[]

Make sure nothing else is deployed:

[#no-resources-blue-green]
[.console-input]
[source, bash]
----
kubectl get all
----

[.console-output]
[source,bash]
----
No resources found in myspace namespace.
----

Deploy V1 of `myboot`:

[#deploy-v1-blue-green]
[.console-input]
[source, bash]
----
kubectl apply -f apps/kubefiles/myboot-deployment-resources-limits.yml
----

Scale to 2 replicas:

[#scale-v1-blue-green]
[.console-input]
[source, bash]
----
kubectl scale deployment/myboot --replicas=2
----

Watch and `show-labels`:

[#labels-v1-blue-green]
[.console-input]
[source, bash]
----
kubectl get pods -w --show-labels
----

Deploy the service:

[#deploy-service-blue-green]
[.console-input]
[source, bash]
----
kubectl apply -f apps/kubefiles/myboot-service.yml
----

:section-k8s: bluegreen
:service-exposed: myboot
include::partial$env-curl.adoc[]

And run loop script:

include::partial$loop.adoc[]

Deploy V2 of `myboot`:

[#deploy-v2-blue-green]
[.console-input]
[source, bash]
----
kubectl apply -f apps/kubefiles/myboot-deployment-resources-limits-v2.yml
----

Verify that the new pod/deployment carries the new code:

[#exec-v2-blue-green]
[.console-input]
[source, bash]
----
PODNAME=$(kubectl get pod -l app=myboot-next -o name)
kubectl exec -it $PODNAME -- curl localhost:8080
----

[.console-output]
[source,bash]
----
Jambo from Spring Boot! 1 on myboot-next-66b68c6659-ftcjr
----

Now update the single Service to point to the new pod and go GREEN:

[#patch-service-green]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl patch svc/myboot -p '{"spec":{"selector":{"app":"myboot-next"}}}'
----

[.console-output]
[source,bash]
----
Aloha from Spring Boot! 240 on myboot-d78fb6d58-929wn
Jambo from Spring Boot! 2 on myboot-next-66b68c6659-ftcjr
Jambo from Spring Boot! 3 on myboot-next-66b68c6659-ftcjr
Jambo from Spring Boot! 4 on myboot-next-66b68c6659-ftcjr
----

Determine that you prefer Hawaiian (blue) to French (green) and fallback:

Now update the single Service to point to the new pod and go BLUE:

[#patch-service-blue]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl patch svc/myboot -p '{"spec":{"selector":{"app":"myboot"}}}'
----

[.console-output]
[source,bash]
----
Jambo from Spring Boot! 17 on myboot-next-66b68c6659-ftcjr
Aloha from Spring Boot! 257 on myboot-d78fb6d58-vqvlb
Aloha from Spring Boot! 258 on myboot-d78fb6d58-vqvlb
----

== Clean Up

[#clean]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete service myboot
kubectl delete deployment myboot
kubectl delete deployment myboot-next
----


================================================
FILE: documentation/modules/ROOT/pages/building-images.adoc
================================================
= Building Images

// See antora yaml (such as github-pages.yml) to change what attribute docker-host is set to

== Prerequisite

In this section, we are assuming you are running Docker in your local machine (either using Docker Tools or native Docker).

IMPORTANT: To make it work correctly, you need to run this section in a new terminal window to avoid using the Kubernetes (`minikube`) environment used in previous sections.

== Build your application artifact

First let's take a quick look at the application we're looking to build

:quick-open-file: MyRESTController.java
include::partial$tip_vscode_quick_open.adoc[]

.MyRESTController.java
image::hello-world-app.png[]

Compile, build and test the Spring Boot Java project:

[#build-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
cd apps/helloworld/springboot
mvn clean package
java -jar target/boot-demo-1.0.0.jar
----

Then `curl` it in a separate terminal:

[.console-input]
[source, bash]
----
curl localhost:8080
----

[.console-output]
[source,bash]
----
Aloha from Spring Boot! 1 on unknown
----

`unknown` because the environment variable is not currently set, it will be inside of a Docker container and inside of Kubernetes.

== Build container image

NOTE: Change `quay.io` for your registry (e.g. `docker.io`) and `{myrepo}` to your organization.  This next step does assume you have a working installation of Docker for Mac/Windows/Linux.

[#build-container--building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
docker build -t quay.io/{myrepo}/myapp:v1 .
----

Results:

[.console-output]
[source,bash, subs="+attributes"]
----
Sending build context to Docker daemon  14.47MB
Step 1/6 : FROM openjdk:8u151
 ---> a30a1e547e6d
Step 2/6 : ENV JAVA_APP_JAR boot-demo-1.0.0.jar
 ---> Using cache
 ---> 62b714308856
Step 3/6 : WORKDIR /app/
 ---> Using cache
 ---> aefc5bf44b15
Step 4/6 : COPY target/$JAVA_APP_JAR .
 ---> f881c5f5815b
Step 5/6 : EXPOSE 8080
 ---> Running in 4e9adc135345
Removing intermediate container 4e9adc135345
 ---> 2909459c83f6
Step 6/6 : CMD java $JAVA_OPTIONS -jar $JAVA_APP_JAR
 ---> Running in 46bcab555de7
Removing intermediate container 46bcab555de7
 ---> 85b78b9b70b1
Successfully built 85b78b9b70b1
Successfully tagged quay.io/{myrepo}/myapp:v1
----

== Run the container image

Run and Test your newly created Docker container:

[#run-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
docker run --rm -it -p 8080:8080 --name myapp quay.io/{myrepo}/myapp:v1
----

[#curl-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080
----

[.console-output]
[source,bash]
----
Aloha from Spring Boot! 1 on 76851270a3e7
----

[#curl-sys-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080/sysresources
----

[.console-output]
[source,bash]
----
Memory: 1268 Cores: 3
----

These numbers are based on the memory and CPUs allocated to the Docker daemon as seen in the image below:

.Docker settings
image::docker-settings.png[Docker Settings]

[#curl-consume-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080/consume
----

[.console-output]
[source,bash]
----
Allocated about 80% (1.2 GiB) of the max allowed JVM memory size (1.2 GiB)
----

Stop & remove the Docker container:

----
control-c
----

== Run your container with constrained resources

Now, constrain the resources associated with this Linux container

[#run-container-constrained-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
docker run --rm -it -p 8080:8080 -m 400m --cpus="1" --name myapp quay.io/{myrepo}/myapp:v1
----

Ask for the container's resources:

[#curl-sys-constrained-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080/sysresources
----

[.console-output]
[source,bash]
----
Memory: 1268 Cores: 3
----

Crash it:

[#curl-consume-crash-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080/consume
----

== Fix memory problems

To correct this behavior use a different Dockerfile:

[#build-mem-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
docker build -t quay.io/{myrepo}/myapp:v1 -f Dockerfile_Memory .
----

Now docker run it:

[#run-sys-constrained-fix-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
docker run --rm -it -p 8080:8080 -m 400m --cpus="1" --name myapp quay.io/{myrepo}/myapp:v1
----

And `curl` it:

[#curl-sys-constrained-fix-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080/sysresources
----

[.console-output]
[source,bash]
----
Memory: 112 Cores: 3
----

And try to crash it:

[#curl-consume-fix-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
curl {docker-host}:8080/consume
----

[.console-output]
[source,bash]
----
Allocated about 80% (98.0 MiB) of the max allowed JVM memory size (112.0 MiB)
----

Once you are happy with your container image, push it up to your favorite registry:

[#push-container-building-images]
[.console-input]
[source, bash, subs="+attributes"]
----
docker login quay.io
docker push quay.io/{myrepo}/myapp:v1
----

[.console-output]
[source,bash]
----
.
.
.
20c527f217db: Pushed
61c06e07759a: Pushed
bcbe43405751: Pushed
e1df5dc88d2c: Pushed
v1: digest: sha256:d22d4af6e297a024b061dbaae05be76c771fdb1db51643dc2dd8b8e047f79647 size: 2630
----


================================================
FILE: documentation/modules/ROOT/pages/configmap.adoc
================================================
= ConfigMap

ConfigMap is the Kubernetes resource that allows you to externalize your application's configuration.

*_An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc)._*

https://12factor.net/config[12 Factor Apps]

== Environment Variables

MyRESTController.java includes a small chunk of code that looks to the environment

[source,java]
----
   @RequestMapping("/configure")
   public String configure() {
        String databaseConn = environment.getProperty("DBCONN","Default");
        String msgBroker = environment.getProperty("MSGBROKER","Default");
        String hello = environment.getProperty("GREETING","Default");
        String love = environment.getProperty("LOVE","Default");
        return "Configuration: \n"
            + "databaseConn=" + databaseConn + "\n"
            + "msgBroker=" + msgBroker + "\n"
            + "hello=" + hello + "\n"
            + "love=" + love + "\n";
   }
----

Environment variables can be manipulated at the Deployment level. 
Changes cause Pod redeployment.

Deploy `myboot`:

[#deploy-myboot-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/kubefiles/myboot-deployment.yml
----

Deploy `myboot` Service:

[#deploy-myboot-service-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/kubefiles/myboot-service.yml
----

And watch the pods status:

:section-k8s: configmap
include::partial$watching-pods.adoc[]

Ask the application for its configuration:

:section-k8s: configmaps
:service-exposed: myboot
include::partial$env-curl.adoc[]

[#get-config-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
curl $IP:$PORT/configure
----

[.console-output]
[source,bash]
----
Configuration for : myboot-66d7d57687-jsbz7
databaseConn=Default
msgBroker=Default
greeting=Default
love=Default
----

== Set Environment Variables

[#set-env-vars]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl set env deployment/myboot GREETING="namaste" \
  LOVE="Aloha" \
  DBCONN="jdbc:sqlserver://45.91.12.123:1443;user=MyUserName;password=*****;"
----

Watch the pods being reborn:

[.console-output]
[source,bash]
----
NAME                      READY   STATUS        RESTARTS   AGE
myboot-66d7d57687-jsbz7   1/1     Terminating   0          5m
myboot-785ff6bddc-ghwpc   1/1     Running       0          13s
----

[#get-config2-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
curl $IP:$PORT/configure
----

[.console-output]
[source,bash]
----
Configuration for : myboot-5fd9dd9c59-58xbh
databaseConn=jdbc:sqlserver://45.91.12.123:1443;user=MyUserName;password=*****;
msgBroker=Default
greeting=namaste
love=Aloha
----

Describe the deployment:

:section-k8s: configmaps
:describe-deployment-name: myboot

include::partial$describe-deployment.adoc[]

[.console-output]
[source,bash]
----
...
  Containers:
   myboot:
    Image:      quay.io/burrsutter/myboot:v1
    Port:       8080/TCP
    Host Port:  0/TCP
    Environment:
      GREETING:  namaste
      LOVE:      Aloha
      DBCONN:    jdbc:sqlserver://45.91.12.123:1443;user=MyUserName;password=*****;
    Mounts:      <none>
  Volumes:       <none>
...  
----

Remove environment variables:

[#remove-env-vars-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl set env deployment/myboot GREETING- \
  LOVE- \
  DBCONN-
----

And verify that they have been removed:

[#get-config3-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
curl $IP:$PORT/configure
----

[.console-output]
[source,bash]
----
Configuration for : myboot-66d7d57687-xkgw6
databaseConn=Default
msgBroker=Default
greeting=Default
love=Default
----

==  Create a ConfigMap

[#create-configmap-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl create cm my-config --from-env-file=apps/config/some.properties
----

[#get-configmap-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get cm
kubectl get cm my-config
kubectl get cm my-config -o json
----

[.console-output]
[source,bash]
----
...
    "data": {
        "GREETING": "jambo",
        "LOVE": "Amour"
    },
    "kind": "ConfigMap",
...    
----

Or you can describe the `ConfigMap` object:

[#describe-configmap-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl describe cm my-config
----

[.console-output]
[source,bash]
----
Name:         my-config
Namespace:    myspace
Labels:       <none>
Annotations:  <none>

Data
====
GREETING:
====
jambo
LOVE:
====
Amour
Events:  <none>
----

.Using `kubectl edit` to view resources
****
For large files you might find using `kubectl edit` is more convenient for viewing resources on the cluster.  In our case, we can view the config map by running the following (and aborting any changes!):

include::partial$tip_vscode_kube_editor.adoc[]

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl edit cm my-config
----
****

Now deploy the app with its request for the `ConfigMap`:

[#deploy-myboot-configmap-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/kubefiles/myboot-deployment-configuration.yml
----

And get its configure endpoint:

[#get-config4-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
curl $IP:$PORT/configure
----

[.console-output]
[source,bash]
----
Configuration for : myboot-84bfcff474-x6xnt
databaseConn=Default
msgBroker=Default
greeting=jambo
love=Amour
----

And switch to the other properties file by recreating the `ConfigMap`:

[#delete-pod-configmap-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete cm my-config
kubectl create cm my-config --from-env-file=apps/config/other.properties
kubectl delete pod -l app=myboot --wait=false
----

[#get-config5-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
curl $IP:$PORT/configure
----

[.console-output]
[source,bash]
----
Configuration for : myboot-694954fc6d-nzdvx
databaseConn=jdbc:sqlserver://123.123.123.123:1443;user=MyUserName;password=*****;
msgBroker=tcp://localhost:61616?jms.useAsyncSend=true
hello=Default
love=Default
----

There are a lot more ways to have fun with ConfigMaps. The core documentation has you manipulate a Pod specification instead of a Deployment, but the results are basically the same:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap


== Clean Up

[#clean-configmaps]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete deployment myboot
kubectl delete cm my-config
kubectl delete service myboot
----


================================================
FILE: documentation/modules/ROOT/pages/crds.adoc
================================================
= Operators
include::_attributes.adoc[]
:watch-terminal: Terminal 2
:log-terminal: Terminal 3
:section-namespace: pizzahat

Operators are a way of extending the functionality of our Kubernetes cluster by installing automated controllers to manage extensions we provide to the underlying Kubernetes API.  

In this section we'll take a deeper look at how operators interact with the Kubernetes API to do this

.Operators in the Real World
****
When demonstrating this tutorial in a master class, it can be good to show the Kafka Operator in Openshift (as roughly outlined <<Kafka for OpenShift,here>>).  Key Points when showing on an OpenShift cluster: 

. Use OperatorHub to show how many different Operators there are.  
. Install the `AMQStreams` or `Strimzi` Operator to add Kafka support (i.e. CRDs as we'll see) to the cluster 
. Once the operator is installed, pick a namespace to install a `Kafka` CR in
. Show in the Developer Perspective the Kafka being created by the operator

In this section of the tutorial we'll be demonstrating these aspects of operators with a home grown toy "Pizza Operator"
****

== Preparation

=== Namespace

We'll need a namespace where we're house our operator deployment and our `CustomResources` upon which the operator will operate

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl create namespace {section-namespace}
kubectl config set-context --current --namespace={section-namespace}
----

=== Watch

If it's not open already, you'll want to have a terminal open (call it *{watch-terminal}*) to watch what's going on with the pods in our current namespace

:section-k8s: crd
include::partial$watching-pods-with-nodes.adoc[]

=== Logs

We'll want to open a third terminal (call it *{log-terminal}*) where we'll use a tool called `stern` to watch the output of certain pods

include::partial$open-terminal-in-editor-inset.adoc[]

:stern-namespace: {section-namespace}
:stern-pattern: p-pod
:section-k8s: crd

include::partial$stern-watch.adoc[]


== CRDs

Custom Resources extend the API

Custom Controllers provide the functionality - continually maintains the desired state -  to monitor its state and reconcile the resource to match with the configuration

https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/

Custom Resource Definitions (CRDs) in version 1.7

CRDs extend the Kubernetes API.  We can see these api resources readily: 

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl api-resources
----

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
NAME                              SHORTNAMES   APIVERSION                             NAMESPACED   KIND
bindings                                       v1                                     true         Binding
componentstatuses                 cs           v1                                     false        ComponentStatus
configmaps                        cm           v1                                     true         ConfigMap
endpoints                         ep           v1                                     true         Endpoint
... #<.>
----
<.> This list is truncated

In the list you will find some of the resources we've already learned about, like `Deployments`

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl api-resources | grep Deployment
----

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
deployments                       deploy       apps/v1                                true         Deployment
----

`CustomResourceDefinition` s are a sub-set of the Kubernetes `api-resources`.  Let's see if there are any CRDs already installed in our cluster

[#get-crds]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get crds --all-namespaces
----

[tabs]
====
Minikube::
+
--
If you are using something like minikube, you will find that there are no CRDs installed yet

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
No resources found
----
--
OpenShift::
+
--

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
NAME                                                              CREATED AT
alertmanagerconfigs.monitoring.coreos.com                         2021-07-12T01:37:49Z
alertmanagers.monitoring.coreos.com                               2021-07-12T01:37:53Z
apiservers.config.openshift.io                                    2021-07-12T01:37:06Z
authentications.config.openshift.io                               2021-07-12T01:37:06Z
authentications.operator.openshift.io                             2021-07-12T01:37:53Z
baremetalhosts.metal3.io                                          2021-07-12T01:38:25Z
builds.config.openshift.io                                        2021-07-12T01:37:06Z
catalogsources.operators.coreos.com                               2021-07-12T01:37:49Z
cloudcredentials.operator.openshift.io                            2021-07-12T01:37:10Z
... #<.>
----
<.> This list has been truncated


OpenShift is at its heart Kubernetes.  One of the main ways OpenShift extends Kubernetes is via CRDs, which explains why you find so many of them installed even on the back of a fresh installation.

--
====


=== Example CRD

:quick-open-file: pizza-crd.yaml

Let's go ahead and create our own Custom Resource Definition.  Later on, this Custom Resources created from this definition will be something that our operator will operate upon.  Take a look at `{quick-open-file}` to see what the CRD we'll be creating looks like

include::partial$tip_vscode_quick_open.adoc[]

[source, yaml]
.{quick-open-file}
----
include::example$pizza-crd.yaml[]
----
<1> This is a description that will be shown when somebody attempts to describe the CRD
<2> This describes one of the values our `CustomResource` will have, namely, the (`array`) list of (`string`) toppings
<3> This describes the second field our `CustomResource` can define in its spec, the (`string`) name of the sauce to use
<4> This is the name that our CustomResources will have.  Sort of like `Deployment` or `Pod`

[IMPORTANT]
====
Many CRDs include metadata about the fields that are exposed so that the CR can be validated by the Kubernetes API.  Prior to API version `v1` this was not enforced, after Kubernetes v1.22 all `CustomResources` will need to be `v1` and thus will need to define their object schema
====

Now let's go ahead ad add this CRD to our cluster so that we can create `Pizza` Custom Resources.

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/pizzas/pizza-crd.yaml
----

We should now be able to see that our CRD is part of our API

[#get-pizzas-crds]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get crds | grep pizza
----

Results:

[.console-output]
[source,bash]
----
NAME                           CREATED AT
pizzas.mykubernetes.acme.org   2020-07-01T08:12:00Z
----

And since CRDs are a subset of all `api-resources`, we should now see `pizzas` as extending our cluster's api-resources: 

[#get-api-pizzas-crds]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl api-resources | grep pizzas
----

Yields:

[.console-output]
[source,bash]
----
pizzas                            pz           mykubernetes.acme.org          true         Pizza
----

Finally, since we defined the schema for our `CustomResourceDefinition` we've made it easier for people to consume our api.  CRDs hook into the `kubectl describe` functionality

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl explain pizza
----

Gives us this helpful output

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
KIND:     Pizza
VERSION:  mykubernetes.acme.org/v1

DESCRIPTION:
     A custom resource for making yummy pizzas #<.>

FIELDS:
   apiVersion   <string>
     APIVersion defines the versioned schema of this representation of an
     object. Servers should convert recognized schemas to the latest internal
     value, and may reject unrecognized values. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

   kind <string>
     Kind is a string value representing the REST resource this object
     represents. Servers may infer this from the endpoint the client submits
     requests to. Cannot be updated. In CamelCase. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

   metadata     <Object>
     Standard object's metadata. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

   sauce        <string> #<.>
     The name of the sauce to use on our pizza

   toppings     <[]string> #<.>
     List of toppings for our pizza'
----
<.> Notice that this matches our overall description of the pizza
<.> This is from the Schema section of the CRD for sauce.  It says that it's a string.  The description comes from the description field
<.> This is from the Schema section of the CRD for toppings.  It says that it's an array of strings.  The description comes from the description field

=== Deploying the Operator

Our CRD is not limited to a particular namespace, but we do need a namespace to put our operator that is going to operate on our `pizza` CRs.  

At its heart, an operator is just an application, like the `myboot` application that we deployed previously.  The difference is that the operator knows to to interact with the Kubernetes API and watch for resources that it cares about.

:quick-open-file: PizzaResourceWatcher.java

The Pizza operator that we're about to deploy was written in link:https://quarkus.io/[Quarkus^] using the link:https://github.com/java-operator-sdk/java-operator-sdk[java operator sdk^].  The code for this operator is present in this repo.  See the `{quick-open-file}` which is one of the key classes in the operator controller:

include::partial$tip_vscode_quick_open.adoc[]

[.console-output]
[source,java,subs="+macros,+attributes"]
.{quick-open-file}
----
package org.acme;

import io.fabric8.kubernetes.api.model.ContainerBuilder;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodBuilder;
import io.fabric8.kubernetes.api.model.PodSpecBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.Watcher;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.quarkus.runtime.StartupEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

public class PizzaResourceWatcher {

    @Inject
    KubernetesClient defaultClient;

    @Inject
    NonNamespaceOperation<PizzaResource, PizzaResourceList, PizzaResourceDoneable, Resource<PizzaResource, PizzaResourceDoneable>> crClient;

    void onStartup(@Observes StartupEvent event) {
        System.out.println("Startup");
        crClient.watch(new Watcher<PizzaResource>() { //<.>
            @Override
            public void eventReceived(Action action, PizzaResource resource) {
                System.out.println("Event " + action.name());
                if (action == Action.ADDED) {
                    final String app = resource.getMetadata().getName();
                    final String sauce = resource.getSpec().getSauce();
                    final List<String> toppings = resource.getSpec().getToppings();
                    final Map<String, String> labels = new HashMap<>();
                    labels.put("app", app);
                    final ObjectMetaBuilder objectMetaBuilder = new ObjectMetaBuilder().withName(app + "-pod")
                            .withNamespace(resource.getMetadata().getNamespace()).withLabels(labels);
                    final ContainerBuilder containerBuilder = new ContainerBuilder().withName("pizza-maker")
                            .withImage("quay.io/lordofthejars/pizza-maker:1.0.0").withCommand("/work/application")
                            .withArgs("--sauce=" + sauce, "--toppings=" + String.join(",", toppings));
                    final PodSpecBuilder podSpecBuilder = new PodSpecBuilder().withContainers(containerBuilder.build())
                            .withRestartPolicy("Never");
                    final PodBuilder podBuilder = new PodBuilder().withMetadata(objectMetaBuilder.build())
                            .withSpec(podSpecBuilder.build());
                    final Pod pod = podBuilder.build();
                    defaultClient.resource(pod).createOrReplace();

                }
            }

            @Override
            public void onClose(KubernetesClientException e) {
            }
        });
    }

}
----
<.> Notice that it's watching for our custom resource of `Pizza`

[TIP]
====
The creation of an operator controller is outside the scope of this tutorial.  If you'd like to learn more about creating operators with Quarkus, watch link:https://bit.ly/3kwJmcd[this 20 minute tutorial^]
====

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/pizzas/pizza-deployment.yaml
----

Soon in your watch window (*{watch-terminal}*) you should see something like this

[tabs]
====
{watch-terminal}::
+
--
[.console-output]
[source,bash,subs="+macros,+attributes"]
----
NAME                                        READY   STATUS    RESTARTS   AGE
quarkus-operator-example-5f5bf777bc-glfg9   1/1     Running   0          58s
----
--
====

[IMPORTANT]
====
Wait until the deployment `STATUS` of the operator is `Running` before moving on to the next section
====

=== Make some Pizzas

Once our operator is running, it will be on the lookout for information in our `Pizza` Custom Resources and use it to (pretend to) make some pizzas by spinning up a pod configurated with information from the Custom Resource instance.

For example, consider this instance of the Pizza `CustomResourceDefinition`:

[.console-output]
[source,yaml,subs="+macros,+attributes"]
----
include::example$cheese-pizza.yaml[]
----

Pay special attention to:

* *Sauce*: `regular`
* *Toppings*: `mozzarella`

Now let's create this `CustomResource`:

[#create-pizzas-crds]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/pizzas/cheese-pizza.yaml
kubectl get pizzas
----

[.console-output]
[source,bash]
----
NAME      AGE
cheesep   4s
----

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl describe pizza cheesep
----

[.console-output]
[source,bash,subs="+attributes"]
----
Name:         cheesep
Namespace:    {section-namespace}
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"mykubernetes.acme.org/v1beta2","kind":"Pizza","metadata":{"annotations":{},"name":"cheesep","namespace":"{section-namespace}"},"spec":...
API Version:  mykubernetes.acme.org/v1beta2
Kind:         Pizza
...
----

And in our *{watch-terminal}* we should see how the Operator responds...

[tabs]
====
{watch-terminal}::
+
--
[.console-output]
[source,bash,subs="+macros,+attributes"]
----
NAME                                        READY   STATUS      RESTARTS   AGE
cheesep-pod                                 0/1     Completed   0          3s
quarkus-operator-example-5f5bf777bc-glfg9   1/1     Running     0          44m
----

--
====

And once the `cheesep-pod` completes we should see the following in *{log-terminal}*

[tabs]
====
{log-terminal}::
+
--
[.console-output]
[source,bash,subs="+quotes,+macros"]
----
+ cheesep-pod › pizza-maker
pass:[cheesep-pod pizza-maker __  ____  __  _____   ___  __ ____  ______ ]
pass:[cheesep-pod pizza-maker  --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ ]
pass:[cheesep-pod pizza-maker  -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   ]
pass:[cheesep-pod pizza-maker --\___\_\____/_/ |_/_/|_/_/|_|\____/___/   ]
cheesep-pod pizza-maker 2021-07-19 08:16:26,113 INFO  [io.quarkus] (main) pizza-maker 1.0-SNAPSHOT (powered by Quarkus 1.4.0.CR1) started in 1.063s. 
cheesep-pod pizza-maker 2021-07-19 08:16:26,114 INFO  [io.quarkus] (main) Profile prod activated. 
cheesep-pod pizza-maker 2021-07-19 08:16:26,114 INFO  [io.quarkus] (main) Installed features: [cdi]
cheesep-pod pizza-maker Doing The Base
cheesep-pod pizza-maker Adding Sauce #regular#
cheesep-pod pizza-maker Adding Toppings #[mozzarella]#
cheesep-pod pizza-maker Baking
cheesep-pod pizza-maker Baked
cheesep-pod pizza-maker Ready For Delivery
cheesep-pod pizza-maker 2021-07-19 08:16:26,615 INFO  [io.quarkus] (main) pizza-maker stopped in 0.000s
----
--
====

Notice that *Sauce* and *Toppings* matches what was specified in the `pizza` CustomResource

=== Make more Pizzas

:quick-open-file: meat-pizza.yaml

Take a look at `{quick-open-file}` and `veggie-lovers.yaml` to show the sauce and toppings options there

include::partial$tip_vscode_quick_open.adoc[]

[.console-output]
[source,yaml,subs="+macros,+attributes"]
.{quick-open-file}
----
include::example$meat-pizza.yaml[]
----

Now make the pizzas

[#create-more-pizzas-crds]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/pizzas/meat-pizza.yaml
kubectl apply -f apps/pizzas/veggie-lovers.yaml
kubectl get pizzas --all-namespaces
----

Pod watch in the *{watch-terminal}* should show

[tabs]
====
{watch-terminal}::
+
--
[.console-output]
[source,bash,subs="+macros,+attributes"]
----
NAME                                      READY  STATUS             AGE    NODE
cheesep-pod                               0/1    Completed          8m46s  devnation
meatsp-pod                                0/1    ContainerCreating  8s     devnation
quarkus-operator-example-fdb76c946-cwmnq  1/1    Running            14m    devnation
veggiep-pod                               0/1    ContainerCreating  6s     devnation
----
--
====

And this notice in our log terminal *{log-terminal}*

[tabs]
====
{log-terminal}::
+
--
[.console-output]
[source,bash,subs="+macros,+attributes,+quotes"]
----
+ meatsp-pod › pizza-maker
pass:[meatsp-pod pizza-maker __  ____  __  _____   ___  __ ____  ______ ]
pass:[meatsp-pod pizza-maker  --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ ]
pass:[meatsp-pod pizza-maker  -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   ]
pass:[meatsp-pod pizza-maker --\___\_\____/_/ |_/_/|_/_/|_|\____/___/   ]
meatsp-pod pizza-maker 2021-07-19 08:24:48,015 INFO  [io.quarkus] (main) pizza-maker 1.0-SNAPSHOT (powered by Quarkus 1.4.0.CR1) started in 0.817s. 
meatsp-pod pizza-maker 2021-07-19 08:24:48,016 INFO  [io.quarkus] (main) Profile prod activated. 
meatsp-pod pizza-maker 2021-07-19 08:24:48,016 INFO  [io.quarkus] (main) Installed features: [cdi]
meatsp-pod pizza-maker Doing The Base
meatsp-pod pizza-maker Adding Sauce #extra# #<.>
meatsp-pod pizza-maker Adding Toppings #[mozzarella,pepperoni,sausage,bacon]#
meatsp-pod pizza-maker Baking
meatsp-pod pizza-maker Baked
meatsp-pod pizza-maker Ready For Delivery
meatsp-pod pizza-maker 2021-07-19 08:24:48,517 INFO  [io.quarkus] (main) pizza-maker stopped in 0.000s
+ veggiep-pod › pizza-maker
pass:[veggiep-pod pizza-maker __  ____  __  _____   ___  __ ____  ______ ]
pass:[veggiep-pod pizza-maker  --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ ]
pass:[veggiep-pod pizza-maker  -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   ]
pass:[veggiep-pod pizza-maker --\___\_\____/_/ |_/_/|_/_/|_|\____/___/   ]
veggiep-pod pizza-maker 2021-07-19 08:24:55,289 INFO  [io.quarkus] (main) pizza-maker 1.0-SNAPSHOT (powered by Quarkus 1.4.0.CR1) started in 0.869s. 
veggiep-pod pizza-maker 2021-07-19 08:24:55,289 INFO  [io.quarkus] (main) Profile prod activated. 
veggiep-pod pizza-maker 2021-07-19 08:24:55,289 INFO  [io.quarkus] (main) Installed features: [cdi]
veggiep-pod pizza-maker Doing The Base
veggiep-pod pizza-maker Adding Sauce #extra# #<.>
veggiep-pod pizza-maker Adding Toppings #[mozzarella,black olives]#
veggiep-pod pizza-maker Baking
veggiep-pod pizza-maker Baked
veggiep-pod pizza-maker Ready For Delivery
veggiep-pod pizza-maker 2021-07-19 08:24:55,790 INFO  [io.quarkus] (main) pizza-maker stopped in 0.000s
----
<.> Matches `sauce` and `toppings` on the meat-pizza CR
<.> Matches `sauce` and `toppings` on the veggie-lovers CR
--
====

=== Cleanup

Let's cleanup everything in our namespace

[#delete-pizzas-crds]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete all --all #<.>
kubectl delete ns {section-namespace}
----
<.> Whilst namespaces do tend to automatically cleanup the resources within them, it's usually good practice to empty them out first to ensure you don't have any `finalizer` issues

[.console-output]
[source,bash]
----
pizza.mykubernetes.acme.org "cheesep" deleted
pizza.mykubernetes.acme.org "meatsp" deleted
pizza.mykubernetes.acme.org "veggiep" deleted
pod "cheesep-pod" deleted
pod "meatsp-pod" deleted
pod "quarkus-operator-example-fdb76c946-cwmnq" deleted
pod "veggiep-pod" deleted
deployment.apps "quarkus-operator-example" deleted
namespace "pizzahat" deleted
----

And finally, let's remove our CRD (which was not bound to a specific namespace like `section-namespace`)

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete crd pizzas.mykubernetes.acme.org #<.>
----
<.> When deleting a crd we need to refer to it by its fully qualified name

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
customresourcedefinition.apiextensions.k8s.io "pizzas.mykubernetes.acme.org" deleted
----

== Create some Kafka

https://github.com/strimzi/strimzi-kafka-operator/blob/master/install/cluster-operator/040-Crd-kafka.yaml[Example CRD]

=== Kafka for Minikube

Create a new namespace for this experiment:

[#create-namespace-franz]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl create namespace franz
kubectl config set-context --current --namespace=franz
----

For minikube, the instructions for installation can be found here:

https://operatorhub.io/operator/strimzi-kafka-operator[Click Install]

What follows were the instructions from a moment in time:

[#minikube-install]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/0.14.1/install.sh | bash -s 0.14.1
kubectl create -f https://operatorhub.io/install/strimzi-kafka-operator.yaml
----

=== Kafka for OpenShift

image:operator-hub-openshift.png[OperatorHub in OpenShift]

=== Verify Install

[#verify-install]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get csv -n operators
kubectl get crds | grep kafka
----

Start a watch in another terminal:

[#watch-pods]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get pods -w
----

Then deploy the resource requesting a Kafka cluster:

[#deploy-cluster]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/kubefiles/mykafka.yml
----

[.console-output]
[source,bash]
----
NAME                                          READY   STATUS    RESTARTS   AGE
my-cluster-entity-operator-66676cb9fb-fzckz   2/2     Running   0          29s
my-cluster-kafka-0                            2/2     Running   0          60s
my-cluster-kafka-1                            2/2     Running   0          60s
my-cluster-kafka-2                            2/2     Running   0          60s
my-cluster-zookeeper-0                        2/2     Running   0          92s
my-cluster-zookeeper-1                        2/2     Running   0          92s
my-cluster-zookeeper-2                        2/2     Running   0          92s
----

And you can get all information from Kafka:

[#get-kafkas-crd]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl get kafkas
----

[.console-output]
[source,bash]
----
NAME         DESIRED KAFKA REPLICAS   DESIRED ZK REPLICAS
my-cluster   3                        3
----

=== Clean up

[#clean-up]
[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete namespace {section-namespace}
kubectl delete -f apps/pizzas/pizza-crd.yaml
kubectl delete kafka my-cluster
kubectl delete namespace franz
----


================================================
FILE: documentation/modules/ROOT/pages/daemonset.adoc
================================================
= DaemonSets
include::_attributes.adoc[]

A DaemonSet ensures that all nodes run a copy of a Pod. 
As nodes are added to the cluster, Pods are added to them automatically.
When the nodes are deleted, they are not rescheduled but deleted.

So DaemonSet allows you to deploy a Pod across all nodes.

== Preparation

include::https://raw.githubusercontent.com/redhat-developer-demos/rhd-tutorial-common/master/minikube-multinode.adoc[]

== DaemonSet

DaemonSet is created using the Kubernetes `DaemonSet` resource:

[source, yaml]
----
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: quarkus-daemonset
  labels:
    app: quarkus-daemonset
spec:
  selector:
    matchLabels:
      app: quarkus-daemonset
  template:
    metadata:
      labels:
        app: quarkus-daemonset
    spec:
      containers:
      - name: quarkus-daemonset
        image: quay.io/rhdevelopers/quarkus-demo:v1
----

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl apply -f apps/kubefiles/quarkus-daemonset.yaml

kubectl get pods -o wide
----

[.console-output]
[source,bash]
----
NAME                      READY   STATUS    RESTARTS   AGE   IP           NODE            NOMINATED NODE   READINESS GATES
quarkus-daemonset-jl2t5   1/1     Running   0          23s   10.244.0.2   multinode       <none>           <none>
quarkus-daemonset-r64ql   1/1     Running   0          23s   10.244.1.2   multinode-m02   <none>           <none>
----

Notice that an instance of the Quarkus Pod is deployed to every node.

=== Clean Up

[.console-input]
[source,bash,subs="+macros,+attributes"]
----
kubectl delete -f apps/kubefiles/quarkus-daemonset.yaml
----

================================================
FILE: documentation/modules/ROOT/pages/exec.adoc
================================================
= Kubectl exec

The exec command allows you to "shell into" your pod and execute commands inside of that tiny linux machine that is running your application. 

You can execute it this way:

[.console-input]
[source,bash]
----
kubectl exec -it {podname} -- /bin/bash
----

Or this way:

[.console-input]
[source,bash]
----
kubectl exec {podname} -- /somecommand
----

In this section, we will be debugging an OOMKilled that is often seen when running Java inside of a container, inside of Kubernetes.

Make sure the Spring Boot pod from the Resources chapter is still running:

[#get-pods-exec]
[.console-input]
[source, bash]
----
kubectl get pods
----

[.console-output]
[source,bash]
----
NAME                     READY   STATUS    RESTARTS   AGE
myboot-d78fb6d58-69kl7   1/1     Running   2          32m
----

Then let's move inside the container by running `exec` into that running Pod:

[#exec-pod-exec]
[.console-input]
[source, bash]
----
PODNAME=$(kubectl get pod  -l app=myboot -o name)
kubectl exec -it $PODNAME -- /bin/bash
----

Run `ps` command to see the current running processes:

[#exec-ps-exec]
[.console-input]
[source, bash]
----
ps -ef
----

[.console-output]
[source,bash]
----
UID          PID    PPID  C STIME TTY          TIME CMD
1000610+       1       0  0 19:20 ?        00:00:00 /bin/sh -c java -XX:+PrintFlagsFinal -XX:+PrintGCDetails $JAVA
1000610+       7       1  2 19:20 ?        00:00:14 java -XX:+PrintFlagsFinal -XX:+PrintGCDetails -jar boot-demo-0
1000610+      43       0  0 19:27 pts/0    00:00:00 /bin/bash
1000610+      49      43  0 19:29 pts/0    00:00:00 ps -ef
----

Execute a `top` to get an overview of the memory:

[#exec-top-exec]
[.console-input]
[source, bash]
----
top
----

// The .no-query-replace tells the course ui to not attempt to replace tokens between % %
[.no-query-replace]
[.console-output]
[source,bash]
----
top - 19:29:34 up 2 days,  7:02,  0 users,  load average: 0.16, 0.13, 0.14
Tasks:   4 total,   1 running,   3 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.8 us,  3.4 sy,  0.0 ni, 93.1 id,  0.1 wa,  0.3 hi,  0.3 si,  0.0 st
KiB Mem : 15389256 total,  6438576 free,  2289352 used,  6661328 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 13142476 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
      1 1000610+  20   0    4292    708    632 S   0.0  0.0   0:00.02 sh
      7 1000610+  20   0 7511676 328704  16988 S   0.0  2.1   0:14.02 java
     43 1000610+  20   0   19960   3644   3080 S   0.0  0.0   0:00.00 bash
     50 1000610+  20   0   42672   3516   3080 R   0.0  0.0   0:00.00 top
----

Get the distro:

[#exec-cat-release-exec]
[.console-input]
[source, bash]
----
cat /etc/os-release
----

[.console-output]
[source,bash]
----
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
----

Check the free memory:

[#exec-free-exec]
[.console-input]
[source, bash]
----
free -h
----

[.console-output]
[source,bash]
----
              total        used        free      shared  buff/cache   available
Mem:            14G        2.2G        6.1G         17M        6.4G         12G
Swap:            0B          0B          0B
----

And now you might see part of the problem. "free" is not `cgroups` aware, it thinks it has access to the whole VMs memory.

No wonder the JVM reports a larger than accurate Max memory:

[#curl-sysresources-exec]
[.console-input]
[source, bash]
----
curl localhost:8080/sysresources
----

[.console-output]
[source,bash]
----
Memory: 1324 Cores: 4
----

[NOTE]
==== 
If using Minikube, the cores are the core count provided by

`minikube --profile devnation config set cpus 4`

and the memory is a subset of the memory provided by

`minikube --profile devnation config set memory 6144`
====

Check your Java version:

[#java-version-181-exec]
[.console-input]
[source, bash]
----
java -version
----

[.console-output]
[source,bash]
----
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
----

Ask the JVM about its resource availability:

[#java-version-181-settings-exec]
[.console-input]
[source, bash]
----
java -XshowSettings:vm -version
----

[.console-output]
[source,bash]
----
VM settings:
    Max. Heap Size (Estimated): 3.26G
    Ergonomics Machine Class: server
    Using VM: OpenJDK 64-Bit Server VM

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
----

Now check the actual `cgroups` settings:

[#cat-cgroup-exec]
[.console-input]
[source, bash]
----
cd /sys/fs/cgroup/memory/
cat memory.limit_in_bytes
----

[.console-output]
[source,bash]
----
419430400
----

And if you divide that 419430400 by 1024 and 1024, you end up with the 400 that was specified in the deployment YAML.

If you have a JVM of 1.8.0_131 or higher then you can try the experimental options

[#java-version-131-settings-exec]
[.console-input]
[source, bash]
----
java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XshowSettings:vm -version
----

[.console-output]
[source,bash]
----
VM settings:
    Max. Heap Size (Estimated): 112.00M
    Ergonomics Machine Class: server
    Using VM: OpenJDK 64-Bit Server VM

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, m
Download .txt
gitextract_62qzlr9h/

├── .devcontainer/
│   ├── Dockerfile
│   ├── assets/
│   │   ├── .zshrc.example
│   │   ├── copy-kube-config.sh
│   │   ├── fedora.repo
│   │   └── post-start.sh
│   ├── devcontainer.json
│   └── workspace-setup/
│       ├── asciidoc.json.code-snippets
│       └── launch.json
├── .editorconfig
├── .github/
│   └── workflows/
│       ├── docs.yml
│       ├── helloworld-go.yml
│       ├── helloworld-quarkus.yml
│       └── helloworld-spring-boot.yml
├── .gitignore
├── LICENSE
├── README.adoc
├── apps/
│   ├── config/
│   │   ├── other.properties
│   │   └── some.properties
│   ├── helloworld/
│   │   ├── go/
│   │   │   ├── Dockerfile
│   │   │   ├── myrest
│   │   │   ├── myrest.go
│   │   │   └── readme.txt
│   │   ├── nodejs/
│   │   │   ├── .devcontainer/
│   │   │   │   ├── Dockerfile
│   │   │   │   └── devcontainer.json
│   │   │   ├── Dockerfile
│   │   │   ├── hello-http.js
│   │   │   └── readme.txt
│   │   ├── python/
│   │   │   ├── Dockerfile
│   │   │   ├── app.py
│   │   │   ├── readme.txt
│   │   │   └── requirements.txt
│   │   ├── quarkus/
│   │   │   ├── .dockerignore
│   │   │   ├── buildNativeLinux.sh
│   │   │   ├── buildNativeMac.sh
│   │   │   ├── build_push_docker.sh
│   │   │   ├── build_push_quay.sh
│   │   │   ├── dockerbuild.sh
│   │   │   ├── dockerbuild_openshift.sh
│   │   │   ├── dockerpush_docker.sh
│   │   │   ├── dockerpush_quay.sh
│   │   │   ├── kubefiles/
│   │   │   │   ├── Deployment.yml
│   │   │   │   ├── Deployment_quay.yml
│   │   │   │   ├── Dockerfile
│   │   │   │   ├── Dockerfile.openshift
│   │   │   │   └── Service.yml
│   │   │   ├── poller.sh
│   │   │   ├── pom.xml
│   │   │   ├── readme.txt
│   │   │   └── src/
│   │   │       └── main/
│   │   │           └── java/
│   │   │               └── com/
│   │   │                   └── redhat/
│   │   │                       └── developer/
│   │   │                           └── demo/
│   │   │                               └── GreetingEndpoint.java
│   │   └── springboot/
│   │       ├── .devcontainer/
│   │       │   ├── Dockerfile
│   │       │   └── devcontainer.json
│   │       ├── Dockerfile
│   │       ├── Dockerfile.openshift
│   │       ├── Dockerfile_Java11
│   │       ├── Dockerfile_Memory
│   │       ├── Dockerfile_Memory2
│   │       ├── build_push_docker.sh
│   │       ├── build_push_quay.sh
│   │       ├── pom.xml
│   │       ├── readme.txt
│   │       └── src/
│   │           └── main/
│   │               └── java/
│   │                   └── com/
│   │                       └── burrsutter/
│   │                           ├── HellobootApplication.java
│   │                           └── MyRESTController.java
│   ├── kubefiles/
│   │   ├── demo-dynamic-persistent.yaml
│   │   ├── demo-ingress-2.yaml
│   │   ├── demo-ingress.yaml
│   │   ├── demo-persistent-volume-hostpath.yaml
│   │   ├── demo-persistent-volume-local.yaml
│   │   ├── myboot-deployment-bad-image.yml
│   │   ├── myboot-deployment-configuration-secret.yml
│   │   ├── myboot-deployment-configuration.yml
│   │   ├── myboot-deployment-live-ready-aggressive.yml
│   │   ├── myboot-deployment-live-ready.yml
│   │   ├── myboot-deployment-resources-limits-v2.yml
│   │   ├── myboot-deployment-resources-limits.yml
│   │   ├── myboot-deployment-resources.yml
│   │   ├── myboot-deployment-startup-live-ready.yml
│   │   ├── myboot-deployment.yml
│   │   ├── myboot-node-affinity.yml
│   │   ├── myboot-persistent-volume-claim.yaml
│   │   ├── myboot-pod-affinity.yml
│   │   ├── myboot-pod-antiaffinity.yaml
│   │   ├── myboot-pod-volume-hostpath.yaml
│   │   ├── myboot-pod-volume-pvc.yaml
│   │   ├── myboot-pod-volume.yml
│   │   ├── myboot-pods-volume.yml
│   │   ├── myboot-service.yml
│   │   ├── myboot-toleration.yaml
│   │   ├── mykafka.yml
│   │   ├── quarkus-daemonset.yaml
│   │   ├── quarkus-statefulset-external-svc.yaml
│   │   ├── quarkus-statefulset.yaml
│   │   ├── whalesay-cronjob.yaml
│   │   └── whalesay-job.yaml
│   ├── pizza-operator/
│   │   ├── .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/
│   │       │   │   └── org/
│   │       │   │       └── acme/
│   │       │   │           ├── ExampleResource.java
│   │       │   │           ├── KubernetesClientProducer.java
│   │       │   │           ├── PizzaResource.java
│   │       │   │           ├── PizzaResourceDoneable.java
│   │       │   │           ├── PizzaResourceList.java
│   │       │   │           ├── PizzaResourceSpec.java
│   │       │   │           ├── PizzaResourceStatus.java
│   │       │   │           └── PizzaResourceWatcher.java
│   │       │   └── resources/
│   │       │       ├── META-INF/
│   │       │       │   └── resources/
│   │       │       │       └── index.html
│   │       │       └── application.properties
│   │       └── test/
│   │           └── java/
│   │               └── org/
│   │                   └── acme/
│   │                       ├── ExampleResourceTest.java
│   │                       └── NativeExampleResourceIT.java
│   └── pizzas/
│       ├── cheese-pizza.yaml
│       ├── meat-pizza.yaml
│       ├── pizza-crd.yaml
│       ├── pizza-deployment.yaml
│       └── veggie-lovers.yaml
├── bin/
│   └── build-site.sh
├── documentation/
│   ├── antora.yml
│   └── modules/
│       ├── ROOT/
│       │   ├── examples/
│       │   │   ├── PizzaResourceWatcher.java
│       │   │   ├── cheese-pizza.yaml
│       │   │   ├── meat-pizza.yaml
│       │   │   ├── myboot-deployment-configuration-secret.yml
│       │   │   ├── myboot-deployment-live-ready-aggressive.yml
│       │   │   ├── myboot-deployment-live-ready.yml
│       │   │   ├── myboot-deployment-startup-live-ready.yml
│       │   │   ├── myboot-pod-volume-hostpath.yaml
│       │   │   ├── myboot-pod-volume.yml
│       │   │   ├── myboot-pods-volume.yml
│       │   │   ├── pizza-crd.yaml
│       │   │   ├── quarkus-statefulset-external-svc.yaml
│       │   │   ├── whalesay-cronjob.yaml
│       │   │   └── whalesay-job.yaml
│       │   ├── nav.adoc
│       │   ├── pages/
│       │   │   ├── _attributes.adoc
│       │   │   ├── _partials/
│       │   │   │   ├── affinity_label.adoc
│       │   │   │   ├── find_node_for_pod.adoc
│       │   │   │   ├── invoke-service.adoc
│       │   │   │   ├── set-env-vars.adoc
│       │   │   │   ├── verify-setup.adoc
│       │   │   │   └── watching-logs.adoc
│       │   │   ├── blue-green.adoc
│       │   │   ├── building-images.adoc
│       │   │   ├── configmap.adoc
│       │   │   ├── crds.adoc
│       │   │   ├── daemonset.adoc
│       │   │   ├── exec.adoc
│       │   │   ├── index.adoc
│       │   │   ├── ingress.adoc
│       │   │   ├── installation.adoc
│       │   │   ├── jobs-cronjobs.adoc
│       │   │   ├── kubectl.adoc
│       │   │   ├── live-ready.adoc
│       │   │   ├── logs.adoc
│       │   │   ├── pod-rs-deployment.adoc
│       │   │   ├── resources.adoc
│       │   │   ├── rolling-updates.adoc
│       │   │   ├── secrets.adoc
│       │   │   ├── service-magic.adoc
│       │   │   ├── service.adoc
│       │   │   ├── statefulset.adoc
│       │   │   ├── taints-affinity.adoc
│       │   │   └── volumes-persistentvolumes.adoc
│       │   └── partials/
│       │       ├── create-greeting-file.adoc
│       │       ├── describe-deployment.adoc
│       │       ├── describe.adoc
│       │       ├── env-curl.adoc
│       │       ├── file-watch-command.adoc
│       │       ├── loop.adoc
│       │       ├── namespace-setup-tip.adoc
│       │       ├── open-terminal-in-editor-inset.adoc
│       │       ├── optional-requisites.adoc
│       │       ├── prerequisites-kubernetes.adoc
│       │       ├── set-context.adoc
│       │       ├── stern-watch.adoc
│       │       ├── taint-remove-taint.adoc
│       │       ├── terminal-cleanup.adoc
│       │       ├── tip_vscode_kube_editor.adoc
│       │       ├── tip_vscode_quick_open.adoc
│       │       ├── watch-node-directory.adoc
│       │       ├── watching-pods-with-nodes.adoc
│       │       ├── watching-pods.adoc
│       │       └── watching-services.adoc
│       └── _attributes.adoc
├── github-pages-stage.yml
├── github-pages.yml
├── gulpfile.babel.js
├── lib/
│   ├── copy-to-clipboard.js
│   ├── remote-include-processor.js
│   └── tab-block.js
├── package.json
├── scripts/
│   ├── create-kubeconfig.sh
│   ├── github-pages-publish.sh
│   ├── minikube-server-setup.sh
│   ├── pod-node-columns-template.txt
│   └── shell-setup.sh
├── supplemental-ui/
│   └── partials/
│       ├── header-content.hbs
│       ├── nav-explore.hbs
│       ├── nav-menu.hbs
│       └── nav.hbs
└── vscode-asciidoc-extra.json
Download .txt
SYMBOL INDEX (63 symbols across 19 files)

FILE: apps/helloworld/go/myrest.go
  function main (line 10) | func main() {
  function HelloHandler (line 20) | func HelloHandler(w http.ResponseWriter, r *http.Request) {

FILE: apps/helloworld/python/app.py
  function main (line 7) | def main():

FILE: apps/helloworld/quarkus/src/main/java/com/redhat/developer/demo/GreetingEndpoint.java
  class GreetingEndpoint (line 11) | @Path("/")
    method greet (line 21) | @GET
    method health (line 28) | @GET
    method getSystemResources (line 35) | @GET
    method consumeSome (line 46) | @GET
    method humanReadableByteCount (line 66) | public static String humanReadableByteCount(long bytes, boolean si) {

FILE: apps/helloworld/springboot/src/main/java/com/burrsutter/HellobootApplication.java
  class HellobootApplication (line 6) | @SpringBootApplication
    method main (line 9) | public static void main(String[] args) {

FILE: apps/helloworld/springboot/src/main/java/com/burrsutter/MyRESTController.java
  class MyRESTController (line 16) | @RestController
    method appendGreetingToFile (line 30) | @GetMapping("/appendgreetingfile")
    method readGreetingFile (line 41) | @GetMapping("/readgreetingfile")
    method sayHello (line 46) | @GetMapping("/")
    method getSystemResources (line 54) | @GetMapping("/sysresources")
    method consumeSome (line 64) | @GetMapping("/consume")
    method health (line 83) | @GetMapping("/health")
    method misbehave (line 93) | @GetMapping("/misbehave")
    method behave (line 99) | @GetMapping("/behave")
    method shot (line 105) | @GetMapping("/shot")
    method reborn (line 112) | @GetMapping("/reborn")
    method alive (line 119) | @GetMapping("/alive")
    method configure (line 131) | @GetMapping("/configure")
    method callinganother (line 144) | @GetMapping("/callinganother")
    method humanReadableByteCount (line 159) | public static String humanReadableByteCount(long bytes, boolean si) {

FILE: apps/pizza-operator/.mvn/wrapper/MavenWrapperDownloader.java
  class MavenWrapperDownloader (line 21) | public class MavenWrapperDownloader {
    method main (line 48) | public static void main(String args[]) {
    method downloadFileFromURL (line 97) | private static void downloadFileFromURL(String urlString, File destina...

FILE: apps/pizza-operator/src/main/java/org/acme/ExampleResource.java
  class ExampleResource (line 8) | @Path("/hello")
    method hello (line 11) | @GET

FILE: apps/pizza-operator/src/main/java/org/acme/KubernetesClientProducer.java
  class KubernetesClientProducer (line 16) | public class KubernetesClientProducer {
    method findMyCurrentNamespace (line 18) | @Produces
    method makeDefaultClient (line 26) | @Produces
    method makeCustomHelloResourceClient (line 32) | @Produces

FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResource.java
  class PizzaResource (line 6) | @JsonDeserialize
    method getSpec (line 13) | public PizzaResourceSpec getSpec() {
    method setSpec (line 17) | public void setSpec(PizzaResourceSpec spec) {
    method getStatus (line 21) | public PizzaResourceStatus getStatus() {
    method setStatus (line 25) | public void setStatus(PizzaResourceStatus status) {
    method toString (line 29) | @Override

FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceDoneable.java
  class PizzaResourceDoneable (line 6) | public class PizzaResourceDoneable extends CustomResourceDoneable<PizzaR...
    method PizzaResourceDoneable (line 8) | public PizzaResourceDoneable(PizzaResource resource, Function<PizzaRes...

FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceList.java
  class PizzaResourceList (line 6) | @JsonSerialize

FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceSpec.java
  class PizzaResourceSpec (line 9) | @JsonDeserialize
    method getToppings (line 19) | public List<String> getToppings() {
    method setToppings (line 23) | public void setToppings(List<String> toppings) {
    method getSauce (line 27) | public String getSauce() {
    method setSauce (line 31) | public void setSauce(String sauce) {

FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceStatus.java
  class PizzaResourceStatus (line 5) | @JsonDeserialize

FILE: apps/pizza-operator/src/main/java/org/acme/PizzaResourceWatcher.java
  class PizzaResourceWatcher (line 20) | public class PizzaResourceWatcher {
    method onStartup (line 28) | void onStartup(@Observes StartupEvent event) {

FILE: apps/pizza-operator/src/test/java/org/acme/ExampleResourceTest.java
  class ExampleResourceTest (line 9) | @QuarkusTest
    method testHelloEndpoint (line 12) | @Test

FILE: apps/pizza-operator/src/test/java/org/acme/NativeExampleResourceIT.java
  class NativeExampleResourceIT (line 5) | @NativeImageTest

FILE: documentation/modules/ROOT/examples/PizzaResourceWatcher.java
  class PizzaResourceWatcher (line 20) | public class PizzaResourceWatcher {
    method onStartup (line 28) | void onStartup(@Observes StartupEvent event) {

FILE: gulpfile.babel.js
  function watchGlobs (line 15) | function watchGlobs() {
  function build (line 34) | function build(done) {
  function workshopSite (line 45) | function workshopSite(done){
  function reload (line 56) | function reload(done) {
  function serve (line 61) | function serve(done) {

FILE: lib/tab-block.js
  function tabsBlock (line 36) | function tabsBlock () {
Condensed preview — 205 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (390K chars).
[
  {
    "path": ".devcontainer/Dockerfile",
    "chars": 3408,
    "preview": "# syntax = docker/dockerfile:1.0-experimental\n\n#\n# This is the base dockerfile to be used with the BUILDKIT to build the"
  },
  {
    "path": ".devcontainer/assets/.zshrc.example",
    "chars": 3647,
    "preview": "# If you come from bash you might have to change your $PATH.\n# export PATH=$HOME/bin:/usr/local/bin:$PATH\n\n# Path to you"
  },
  {
    "path": ".devcontainer/assets/copy-kube-config.sh",
    "chars": 1764,
    "preview": "#!/bin/bash -i\n\n# set -euo pipefail\n\n# Copies localhost's ~/.kube/config file into the container and swap out localhost\n"
  },
  {
    "path": ".devcontainer/assets/fedora.repo",
    "chars": 133,
    "preview": "[fedora]\nname = Fedora\nbaseurl = https://mirror.aarnet.edu.au/pub/fedora/linux/releases/34/Everything/x86_64/os/\ngpgchec"
  },
  {
    "path": ".devcontainer/assets/post-start.sh",
    "chars": 202,
    "preview": "#!/bin/bash\n\nWORKSPACE_FOLDER=$1\n\nrsync -a ${WORKSPACE_FOLDER}/.devcontainer/workspace-setup/ ${WORKSPACE_FOLDER}/.vscod"
  },
  {
    "path": ".devcontainer/devcontainer.json",
    "chars": 2519,
    "preview": "{\n\t\"name\": \"DevNation Kubernetes Tutorial\",\n\t\"dockerFile\": \"Dockerfile\",\n\t\"runArgs\": [\n\t\t\"-v\", \"/var/run/docker.sock.raw"
  },
  {
    "path": ".devcontainer/workspace-setup/asciidoc.json.code-snippets",
    "chars": 1703,
    "preview": "{\n  \"Add Tabs\": {\n    \"prefix\": \"tabs\",\n    \"body\": [\n      \"[tabs]\",\n      \"====\",\n      \"${1:tab1}::\",\n      \"+\",\n    "
  },
  {
    "path": ".devcontainer/workspace-setup/launch.json",
    "chars": 440,
    "preview": "{\n    // Use IntelliSense to learn about possible attributes.\n    // Hover to view descriptions of existing attributes.\n"
  },
  {
    "path": ".editorconfig",
    "chars": 208,
    "preview": "root = true\n\n[*]\nindent_style = space\ncharset = utf-8\ntrim_trailing_whitespace = false\ninsert_final_newline = false\n\n[*."
  },
  {
    "path": ".github/workflows/docs.yml",
    "chars": 700,
    "preview": "name: docs\n\non:\n  push:\n    branches: \n    - v1.29\n    - v1.34\n    paths:\n    - .github/workflows/docs.yml\n    - github-"
  },
  {
    "path": ".github/workflows/helloworld-go.yml",
    "chars": 457,
    "preview": "name: helloworld-go\n\non:\n  push:\n    branches: \n    - master\n    paths:\n    - '.github/workflows/helloworld-go.yml'\n    "
  },
  {
    "path": ".github/workflows/helloworld-quarkus.yml",
    "chars": 501,
    "preview": "name: helloworld-quarkus\n\non:\n  push:\n    branches: \n    - master\n    paths:\n    - '.github/workflows/helloworld-quarkus"
  },
  {
    "path": ".github/workflows/helloworld-spring-boot.yml",
    "chars": 515,
    "preview": "name: helloworld-spring-boot\n\non:\n  push:\n    branches: \n    - master\n    paths:\n    - '.github/workflows/helloworld-spr"
  },
  {
    "path": ".gitignore",
    "chars": 379,
    "preview": ".DS_Store\ntarget\n*.iml\n.idea\n*.class\n*.log\n.cache\n/gh-pages\n/.cache\n*.swp\nnode_modules\n.classpath\n.project\n.settings\n.ku"
  },
  {
    "path": "LICENSE",
    "chars": 11342,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.adoc",
    "chars": 2193,
    "preview": "# Kubernetes Tutorial \n\nimage:https://github.com/redhat-developer-demos/kubernetes-tutorial/workflows/docs/badge.svg[]\ni"
  },
  {
    "path": "apps/config/other.properties",
    "chars": 130,
    "preview": "DBCONN=jdbc:sqlserver://123.123.123.123:1443;user=MyUserName;password=*****;\nMSGBROKER=tcp://localhost:61616?jms.useAsyn"
  },
  {
    "path": "apps/config/some.properties",
    "chars": 25,
    "preview": "GREETING=jambo\nLOVE=Amour"
  },
  {
    "path": "apps/helloworld/go/Dockerfile",
    "chars": 116,
    "preview": "FROM registry.access.redhat.com/ubi8/ubi-minimal\nEXPOSE 8000\nCOPY myrest /usr/bin\nCMD /bin/sh -c '/usr/bin/myrest'\n\n"
  },
  {
    "path": "apps/helloworld/go/myrest.go",
    "chars": 560,
    "preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n//\t\"time\"\n)\n\nfunc main() {\n\n\t//api := mux.NewRouter()\n\thttp.HandleFunc(\""
  },
  {
    "path": "apps/helloworld/go/readme.txt",
    "chars": 466,
    "preview": "\nDownload and install go\nhttps://golang.org/dl/\n\ngo build myrest.go\n\nthen run the compiled executable\n./myrest\n\ncurl loc"
  },
  {
    "path": "apps/helloworld/nodejs/.devcontainer/Dockerfile",
    "chars": 158,
    "preview": "FROM nodeshift/centos7-s2i-nodejs:10.x\n\nLABEL maintainer=\"Burr Sutter \\\"burrsutter@gmail.com\\\"\"\n\nEXPOSE 8000\n\nWORKDIR /o"
  },
  {
    "path": "apps/helloworld/nodejs/.devcontainer/devcontainer.json",
    "chars": 202,
    "preview": "{\n\t\"name\": \"Node Sample\",\n\t\"dockerFile\": \"Dockerfile\",\n\t\"appPort\": \"8000\",\n\t \"extensions\": [\n\t\t// \"afractal.node-essenti"
  },
  {
    "path": "apps/helloworld/nodejs/Dockerfile",
    "chars": 200,
    "preview": "FROM nodeshift/centos7-s2i-nodejs:10.x\n\nLABEL maintainer=\"Burr Sutter \\\"burrsutter@gmail.com\\\"\"\n\nEXPOSE 8000\n\nWORKDIR /o"
  },
  {
    "path": "apps/helloworld/nodejs/hello-http.js",
    "chars": 520,
    "preview": "const os = require('os');\nconst http = require('http');\nlet cnt = 0;\n\nhttp.createServer((req, res) =>\n{\n    // don't inc"
  },
  {
    "path": "apps/helloworld/nodejs/readme.txt",
    "chars": 717,
    "preview": "Test it plain\nnode -v\nv8.11.3\nnpm -v\nv8.11.3\n\n\nnpm start\ncurl localhost:8000\n\nTest it in minishift or minikube's Docker\n"
  },
  {
    "path": "apps/helloworld/python/Dockerfile",
    "chars": 166,
    "preview": "FROM python:2\n\nWORKDIR /usr/src/app\n\nCOPY requirements.txt ./\n\nRUN pip install --no-cache-dir -r requirements.txt\n\nCOPY "
  },
  {
    "path": "apps/helloworld/python/app.py",
    "chars": 227,
    "preview": "import os\n\nfrom flask import Flask\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef main():\n    return \"Python Hello on \" + os"
  },
  {
    "path": "apps/helloworld/python/readme.txt",
    "chars": 343,
    "preview": "https://www.python.org/ftp/python/2.7.15/python-2.7.15-macosx10.9.pkg\n\npython --version\nPython 2.7.15\n\npip --version\npip"
  },
  {
    "path": "apps/helloworld/python/requirements.txt",
    "chars": 12,
    "preview": "Flask==1.0.2"
  },
  {
    "path": "apps/helloworld/quarkus/.dockerignore",
    "chars": 18,
    "preview": "*\n!target/*-runner"
  },
  {
    "path": "apps/helloworld/quarkus/buildNativeLinux.sh",
    "chars": 140,
    "preview": "#!/bin/bash\n\nexport GRAALVM_HOME=~/tools/graalvm-ce-19.1.1/Contents/Home/\n\nmvn package -Pnative -Dnative-image.docker-bu"
  },
  {
    "path": "apps/helloworld/quarkus/buildNativeMac.sh",
    "chars": 110,
    "preview": "#!/bin/bash\n\nexport GRAALVM_HOME=~/tools/graalvm-ce-19.1.1/Contents/Home/\n\n# Mac Native\nmvn package -Pnative\n\n"
  },
  {
    "path": "apps/helloworld/quarkus/build_push_docker.sh",
    "chars": 249,
    "preview": "#!/bin/bash\n\nIMAGE_VER=quarkus-demo:2.0.0\n\ndocker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .\ndocker login "
  },
  {
    "path": "apps/helloworld/quarkus/build_push_quay.sh",
    "chars": 253,
    "preview": "#!/bin/bash\n\nIMAGE_VER=quarkus-demo:2.0.0\n\ndocker build -f kubefiles/Dockerfile -t dev.local/burrsutter/$IMAGE_VER .\ndoc"
  },
  {
    "path": "apps/helloworld/quarkus/dockerbuild.sh",
    "chars": 93,
    "preview": "#!/bin/bash\n\ndocker build -f kubefiles/Dockerfile -t dev.local/rhdevelopers/quarkus-demo:v2 ."
  },
  {
    "path": "apps/helloworld/quarkus/dockerbuild_openshift.sh",
    "chars": 103,
    "preview": "#!/bin/bash\n\ndocker build -f kubefiles/Dockerfile.openshift -t dev.local/rhdevelopers/quarkus-demo:v2 ."
  },
  {
    "path": "apps/helloworld/quarkus/dockerpush_docker.sh",
    "chars": 208,
    "preview": "#!/bin/bash\n\n# use docker images | grep quarkus to get the image ID for $1\n\ndocker login docker.io\n\ndocker tag $1 docker"
  },
  {
    "path": "apps/helloworld/quarkus/dockerpush_quay.sh",
    "chars": 308,
    "preview": "#!/bin/bash\n\n# use docker images | grep quarkus to get the image ID for $1\n\ndocker login quay.io\n\ndocker tag $1 quay.io/"
  },
  {
    "path": "apps/helloworld/quarkus/kubefiles/Deployment.yml",
    "chars": 903,
    "preview": "apiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\n  labels:\n    app: myquarkus\n  name: myquarkus\nspec:\n  replica"
  },
  {
    "path": "apps/helloworld/quarkus/kubefiles/Deployment_quay.yml",
    "chars": 903,
    "preview": "apiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\n  labels:\n    app: myquarkus\n  name: myquarkus\nspec:\n  replica"
  },
  {
    "path": "apps/helloworld/quarkus/kubefiles/Dockerfile",
    "chars": 186,
    "preview": "FROM registry.access.redhat.com/ubi8/ubi-minimal\nWORKDIR /work/\nCOPY target/*-runner /work/application\nRUN chmod 775 /wo"
  },
  {
    "path": "apps/helloworld/quarkus/kubefiles/Dockerfile.openshift",
    "chars": 236,
    "preview": "FROM registry.access.redhat.com/ubi8/ubi-minimal\nWORKDIR /work/\nRUN chgrp -R 0 /work && \\ \n    chmod -R g=u /work\nCOPY t"
  },
  {
    "path": "apps/helloworld/quarkus/kubefiles/Service.yml",
    "chars": 186,
    "preview": "apiVersion: v1\nkind: Service\nmetadata:\n  name: myquarkus\n  labels:\n    app: myquarkus    \nspec:\n  ports:\n  - name: http\n"
  },
  {
    "path": "apps/helloworld/quarkus/poller.sh",
    "chars": 156,
    "preview": "#!/bin/bash\n\nwhile true\ndo \n  curl $(minikube -p 9steps ip):$(kubectl get svc myapp -ojsonpath=\"{.spec.ports[?(@.port==8"
  },
  {
    "path": "apps/helloworld/quarkus/pom.xml",
    "chars": 3707,
    "preview": "<?xml version=\"1.0\"?>\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4"
  },
  {
    "path": "apps/helloworld/quarkus/readme.txt",
    "chars": 262,
    "preview": "\nmvn compile quarkus:dev\ncurl localhost:8080\nctrl-c \n\nmvn clean package\n\n./buildNativeLinux.sh\n\n./dockerbuild.sh\n\n\nkubec"
  },
  {
    "path": "apps/helloworld/quarkus/src/main/java/com/redhat/developer/demo/GreetingEndpoint.java",
    "chars": 2207,
    "preview": "package com.redhat.developer.demo;\n\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\n\nimport javax.ws.rs.Produces;\nimpo"
  },
  {
    "path": "apps/helloworld/springboot/.devcontainer/Dockerfile",
    "chars": 246,
    "preview": "FROM openjdk:8u151\nENV JAVA_APP_JAR boot-demo-0.0.1.jar\n\n## Ensure maven is installed\nRUN apt-get update -y && apt-get i"
  },
  {
    "path": "apps/helloworld/springboot/.devcontainer/devcontainer.json",
    "chars": 161,
    "preview": "{\n\t\"name\": \"Spring Boot Sample\",\n\t\"dockerFile\": \"Dockerfile\",\n\t\"appPort\": \"8080\",\n\t \"extensions\": [\n\t \t\"vscjava.vscode-j"
  },
  {
    "path": "apps/helloworld/springboot/Dockerfile",
    "chars": 155,
    "preview": "FROM openjdk:17.0-slim\nENV JAVA_APP_JAR boot-demo-1.0.0.jar\nWORKDIR /app/\nCOPY target/$JAVA_APP_JAR .\nEXPOSE 8080\nCMD ja"
  },
  {
    "path": "apps/helloworld/springboot/Dockerfile.openshift",
    "chars": 312,
    "preview": "FROM registry.access.redhat.com/ubi8/openjdk-8-runtime\nWORKDIR /work/\nENV JAVA_APP_JAR boot-demo-1.0.0.jar\n# the followi"
  },
  {
    "path": "apps/helloworld/springboot/Dockerfile_Java11",
    "chars": 139,
    "preview": "FROM openjdk:11-jre\nENV JAVA_APP_JAR boot-demo-1.0.0.jar\nWORKDIR /app/\nCOPY target/$JAVA_APP_JAR .\nEXPOSE 8080\nCMD java "
  },
  {
    "path": "apps/helloworld/springboot/Dockerfile_Memory",
    "chars": 263,
    "preview": "FROM openjdk:8u151-jre\nENV JAVA_APP_JAR boot-demo-1.0.0.jar\nWORKDIR /app/\nCOPY target/$JAVA_APP_JAR .\nEXPOSE 8080\nCMD ja"
  },
  {
    "path": "apps/helloworld/springboot/Dockerfile_Memory2",
    "chars": 206,
    "preview": "FROM openjdk:8u131-jre\nENV JAVA_APP_JAR boot-demo-1.0.0.jar\nWORKDIR /app/\nCOPY target/$JAVA_APP_JAR .\nEXPOSE 8080\nCMD ja"
  },
  {
    "path": "apps/helloworld/springboot/build_push_docker.sh",
    "chars": 246,
    "preview": "#!/bin/bash\n\nIMAGE_VER=boot-demo:1.0.0\n\ndocker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .\ndocker login doc"
  },
  {
    "path": "apps/helloworld/springboot/build_push_quay.sh",
    "chars": 240,
    "preview": "#!/bin/bash\n\nIMAGE_VER=boot-demo:1.0.0\n\ndocker build -f Dockerfile -t dev.local/burrsutter/$IMAGE_VER .\ndocker login qua"
  },
  {
    "path": "apps/helloworld/springboot/pom.xml",
    "chars": 1762,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http"
  },
  {
    "path": "apps/helloworld/springboot/readme.txt",
    "chars": 710,
    "preview": "Initial pom.xml created by start.spring.io\n\nmvn clean compile package\n\njava -jar target/boot-demo-1.0.0.jar\nor\nmvn sprin"
  },
  {
    "path": "apps/helloworld/springboot/src/main/java/com/burrsutter/HellobootApplication.java",
    "chars": 312,
    "preview": "package com.burrsutter;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigur"
  },
  {
    "path": "apps/helloworld/springboot/src/main/java/com/burrsutter/MyRESTController.java",
    "chars": 6043,
    "preview": "package com.burrsutter;\n\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java."
  },
  {
    "path": "apps/kubefiles/demo-dynamic-persistent.yaml",
    "chars": 167,
    "preview": "kind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: myboot-volumeclaim\nspec:\n  accessModes:\n    - ReadWriteOnce"
  },
  {
    "path": "apps/kubefiles/demo-ingress-2.yaml",
    "chars": 432,
    "preview": "apiVersion: networking.k8s.io/v1beta1\nkind: Ingress\nmetadata:\n  name: example-ingress\n  annotations:\n    nginx.ingress.k"
  },
  {
    "path": "apps/kubefiles/demo-ingress.yaml",
    "chars": 380,
    "preview": "apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\n  annotations:\n    nginx.ingress.kubern"
  },
  {
    "path": "apps/kubefiles/demo-persistent-volume-hostpath.yaml",
    "chars": 251,
    "preview": "kind: PersistentVolume\napiVersion: v1\nmetadata:\n  name: my-persistent-volume\n  labels:\n    type: local\nspec:\n  storageCl"
  },
  {
    "path": "apps/kubefiles/demo-persistent-volume-local.yaml",
    "chars": 414,
    "preview": "apiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: my-persistent-volume\nspec:\n  capacity:\n    storage: 10Mi\n  volum"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-bad-image.yml",
    "chars": 355,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-configuration-secret.yml",
    "chars": 784,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-configuration.yml",
    "chars": 613,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-live-ready-aggressive.yml",
    "chars": 857,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-live-ready.yml",
    "chars": 898,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-resources-limits-v2.yml",
    "chars": 562,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot-next\n  name: myboot-next\nspec:\n  replicas: 1\n  "
  },
  {
    "path": "apps/kubefiles/myboot-deployment-resources-limits.yml",
    "chars": 697,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-resources.yml",
    "chars": 464,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-deployment-startup-live-ready.yml",
    "chars": 1031,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app"
  },
  {
    "path": "apps/kubefiles/myboot-deployment.yml",
    "chars": 357,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-node-affinity.yml",
    "chars": 618,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/myboot-persistent-volume-claim.yaml",
    "chars": 197,
    "preview": "kind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: myboot-volumeclaim\nspec:\n  storageClassName: pv-demo \n  acc"
  },
  {
    "path": "apps/kubefiles/myboot-pod-affinity.yml",
    "chars": 666,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot2\n  name: myboot2\nspec:\n  replicas: 1\n  selector"
  },
  {
    "path": "apps/kubefiles/myboot-pod-antiaffinity.yaml",
    "chars": 670,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot3\n  name: myboot3\nspec:\n  replicas: 1\n  selector"
  },
  {
    "path": "apps/kubefiles/myboot-pod-volume-hostpath.yaml",
    "chars": 296,
    "preview": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo\n    image: quay.io/rhde"
  },
  {
    "path": "apps/kubefiles/myboot-pod-volume-pvc.yaml",
    "chars": 310,
    "preview": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo\n    image: quay.io/rhde"
  },
  {
    "path": "apps/kubefiles/myboot-pod-volume.yml",
    "chars": 280,
    "preview": "apiVersion: v1\nkind: Pod #<.>\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo\n    image: quay.io"
  },
  {
    "path": "apps/kubefiles/myboot-pods-volume.yml",
    "chars": 477,
    "preview": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo-1 #<.>\n    image: quay."
  },
  {
    "path": "apps/kubefiles/myboot-service.yml",
    "chars": 177,
    "preview": "apiVersion: v1\nkind: Service\nmetadata:\n  name: myboot\n  labels:\n    app: myboot    \nspec:\n  ports:\n  - name: http\n    po"
  },
  {
    "path": "apps/kubefiles/myboot-toleration.yaml",
    "chars": 475,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "apps/kubefiles/mykafka.yml",
    "chars": 303,
    "preview": "apiVersion: kafka.strimzi.io/v1alpha1\nkind: Kafka\nmetadata: \n  name: my-cluster\nspec:\n  kafka:\n    replicas: 3\n    liste"
  },
  {
    "path": "apps/kubefiles/quarkus-daemonset.yaml",
    "chars": 355,
    "preview": "apiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: quarkus-daemonset\n  labels:\n    app: quarkus-daemonset\nspec:\n  sel"
  },
  {
    "path": "apps/kubefiles/quarkus-statefulset-external-svc.yaml",
    "chars": 253,
    "preview": "apiVersion: v1\nkind: Service\nmetadata:\n  name: quarkus-statefulset-2\nspec:\n  type: LoadBalancer #<.>\n  externalTrafficPo"
  },
  {
    "path": "apps/kubefiles/quarkus-statefulset.yaml",
    "chars": 676,
    "preview": "apiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: quarkus-statefulset\n  labels:\n    app: quarkus-statefulset\nspec:"
  },
  {
    "path": "apps/kubefiles/whalesay-cronjob.yaml",
    "chars": 470,
    "preview": "apiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: whale-say-cronjob\nspec:\n  schedule: \"* * * * *\" #<.>\n  jobTemplate:"
  },
  {
    "path": "apps/kubefiles/whalesay-job.yaml",
    "chars": 251,
    "preview": "apiVersion: batch/v1\nkind: Job\nmetadata:\n  name: whale-say-job #<.>\nspec:\n  template:\n    spec:\n      containers:\n      "
  },
  {
    "path": "apps/pizza-operator/.dockerignore",
    "chars": 53,
    "preview": "*\n!target/*-runner\n!target/*-runner.jar\n!target/lib/*"
  },
  {
    "path": "apps/pizza-operator/.gitignore",
    "chars": 308,
    "preview": "# Eclipse\n.project\n.classpath\n.settings/\nbin/\n\n# IntelliJ\n.idea\n*.ipr\n*.iml\n*.iws\n\n# NetBeans\nnb-configuration.xml\n\n# Vi"
  },
  {
    "path": "apps/pizza-operator/.mvn/wrapper/MavenWrapperDownloader.java",
    "chars": 4941,
    "preview": "/*\n * Copyright 2007-present the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \""
  },
  {
    "path": "apps/pizza-operator/.mvn/wrapper/maven-wrapper.properties",
    "chars": 218,
    "preview": "distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip\nwrap"
  },
  {
    "path": "apps/pizza-operator/README.md",
    "chars": 1213,
    "preview": "# pizza-operator project\n\nThis project uses Quarkus, the Supersonic Subatomic Java Framework.\n\nIf you want to learn more"
  },
  {
    "path": "apps/pizza-operator/mvnw",
    "chars": 10069,
    "preview": "#!/bin/sh\n# ----------------------------------------------------------------------------\n# Licensed to the Apache Softwa"
  },
  {
    "path": "apps/pizza-operator/mvnw.cmd",
    "chars": 6607,
    "preview": "@REM ----------------------------------------------------------------------------\n@REM Licensed to the Apache Software F"
  },
  {
    "path": "apps/pizza-operator/pom.xml",
    "chars": 3994,
    "preview": "<?xml version=\"1.0\"?>\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-"
  },
  {
    "path": "apps/pizza-operator/src/main/docker/Dockerfile.jvm",
    "chars": 1866,
    "preview": "####\n# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode\n#\n# Before bu"
  },
  {
    "path": "apps/pizza-operator/src/main/docker/Dockerfile.native",
    "chars": 638,
    "preview": "####\n# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode\n#"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/ExampleResource.java",
    "chars": 285,
    "preview": "package org.acme;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/KubernetesClientProducer.java",
    "chars": 1980,
    "preview": "package org.acme;\n\nimport io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition;\nimport io.fabric8.kube"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/PizzaResource.java",
    "chars": 934,
    "preview": "package org.acme;\n\nimport com.fasterxml.jackson.databind.annotation.JsonDeserialize;\nimport io.fabric8.kubernetes.client"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/PizzaResourceDoneable.java",
    "chars": 365,
    "preview": "package org.acme;\n\nimport io.fabric8.kubernetes.api.builder.Function;\nimport io.fabric8.kubernetes.client.CustomResource"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/PizzaResourceList.java",
    "chars": 232,
    "preview": "package org.acme;\n\nimport com.fasterxml.jackson.databind.annotation.JsonSerialize;\nimport io.fabric8.kubernetes.client.C"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/PizzaResourceSpec.java",
    "chars": 790,
    "preview": "package org.acme;\n\nimport com.fasterxml.jackson.annotation.JsonProperty;\nimport com.fasterxml.jackson.databind.annotatio"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/PizzaResourceStatus.java",
    "chars": 140,
    "preview": "package org.acme;\n\nimport com.fasterxml.jackson.databind.annotation.JsonDeserialize;\n\n@JsonDeserialize\npublic class Pizz"
  },
  {
    "path": "apps/pizza-operator/src/main/java/org/acme/PizzaResourceWatcher.java",
    "chars": 2846,
    "preview": "package org.acme;\n\nimport io.fabric8.kubernetes.api.model.ContainerBuilder;\nimport io.fabric8.kubernetes.api.model.Objec"
  },
  {
    "path": "apps/pizza-operator/src/main/resources/META-INF/resources/index.html",
    "chars": 4112,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>pizza-operator - 1.0.0-SNAPSHOT</title>\n  "
  },
  {
    "path": "apps/pizza-operator/src/main/resources/application.properties",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "apps/pizza-operator/src/test/java/org/acme/ExampleResourceTest.java",
    "chars": 424,
    "preview": "package org.acme;\n\nimport io.quarkus.test.junit.QuarkusTest;\nimport org.junit.jupiter.api.Test;\n\nimport static io.restas"
  },
  {
    "path": "apps/pizza-operator/src/test/java/org/acme/NativeExampleResourceIT.java",
    "chars": 202,
    "preview": "package org.acme;\n\nimport io.quarkus.test.junit.NativeImageTest;\n\n@NativeImageTest\npublic class NativeExampleResourceIT "
  },
  {
    "path": "apps/pizzas/cheese-pizza.yaml",
    "chars": 125,
    "preview": "apiVersion: mykubernetes.acme.org/v1\nkind: Pizza\nmetadata:\n  name: cheesep\nspec:\n  toppings:\n  - mozzarella\n  sauce: reg"
  },
  {
    "path": "apps/pizzas/meat-pizza.yaml",
    "chars": 157,
    "preview": "apiVersion: mykubernetes.acme.org/v1\nkind: Pizza\nmetadata:\n  name: meatsp\nspec:\n  toppings:\n  - mozzarella\n  - pepperoni"
  },
  {
    "path": "apps/pizzas/pizza-crd.yaml",
    "chars": 964,
    "preview": "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: pizzas.mykubernetes.acme.org\n  labe"
  },
  {
    "path": "apps/pizzas/pizza-deployment.yaml",
    "chars": 1263,
    "preview": "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: quarkus-operator-example\nrules:\n- apiGroups"
  },
  {
    "path": "apps/pizzas/veggie-lovers.yaml",
    "chars": 140,
    "preview": "apiVersion: mykubernetes.acme.org/v1\nkind: Pizza\nmetadata:\n  name: veggiep\nspec:\n  toppings:\n  - mozzarella\n  - black ol"
  },
  {
    "path": "bin/build-site.sh",
    "chars": 124,
    "preview": "#!/bin/sh\ndocker run -u $(id -u) -v $PWD:/antora:Z --rm -t antora/antora:2.3.1 --cache-dir=./.cache/antora github-pages."
  },
  {
    "path": "documentation/antora.yml",
    "chars": 141,
    "preview": "name: kubernetes-tutorial\nversion: v1.34\ndisplay_version: v1.34\nprerelease: false\nnav:\n  - modules/ROOT/nav.adoc\nstart_p"
  },
  {
    "path": "documentation/modules/ROOT/examples/PizzaResourceWatcher.java",
    "chars": 2846,
    "preview": "package org.acme;\n\nimport io.fabric8.kubernetes.api.model.ContainerBuilder;\nimport io.fabric8.kubernetes.api.model.Objec"
  },
  {
    "path": "documentation/modules/ROOT/examples/cheese-pizza.yaml",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "documentation/modules/ROOT/examples/meat-pizza.yaml",
    "chars": 157,
    "preview": "apiVersion: mykubernetes.acme.org/v1\nkind: Pizza\nmetadata:\n  name: meatsp\nspec:\n  toppings:\n  - mozzarella\n  - pepperoni"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-deployment-configuration-secret.yml",
    "chars": 784,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: myboot\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-deployment-live-ready-aggressive.yml",
    "chars": 857,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-deployment-live-ready.yml",
    "chars": 898,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-deployment-startup-live-ready.yml",
    "chars": 1031,
    "preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myboot\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-pod-volume-hostpath.yaml",
    "chars": 296,
    "preview": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo\n    image: quay.io/rhde"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-pod-volume.yml",
    "chars": 280,
    "preview": "apiVersion: v1\nkind: Pod #<.>\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo\n    image: quay.io"
  },
  {
    "path": "documentation/modules/ROOT/examples/myboot-pods-volume.yml",
    "chars": 477,
    "preview": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: myboot-demo\nspec:\n  containers:\n  - name: myboot-demo-1 #<.>\n    image: quay."
  },
  {
    "path": "documentation/modules/ROOT/examples/pizza-crd.yaml",
    "chars": 964,
    "preview": "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: pizzas.mykubernetes.acme.org\n  labe"
  },
  {
    "path": "documentation/modules/ROOT/examples/quarkus-statefulset-external-svc.yaml",
    "chars": 253,
    "preview": "apiVersion: v1\nkind: Service\nmetadata:\n  name: quarkus-statefulset-2\nspec:\n  type: LoadBalancer #<.>\n  externalTrafficPo"
  },
  {
    "path": "documentation/modules/ROOT/examples/whalesay-cronjob.yaml",
    "chars": 470,
    "preview": "apiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: whale-say-cronjob\nspec:\n  schedule: \"* * * * *\" #<.>\n  jobTemplate:"
  },
  {
    "path": "documentation/modules/ROOT/examples/whalesay-job.yaml",
    "chars": 251,
    "preview": "apiVersion: batch/v1\nkind: Job\nmetadata:\n  name: whale-say-job #<.>\nspec:\n  template:\n    spec:\n      containers:\n      "
  },
  {
    "path": "documentation/modules/ROOT/nav.adoc",
    "chars": 1063,
    "preview": "* 1. Requirements\n** xref:installation.adoc[Installation]\n*** xref:installation.adoc#tutorial-all-local[CLI]\n*** xref:in"
  },
  {
    "path": "documentation/modules/ROOT/pages/_attributes.adoc",
    "chars": 192,
    "preview": ":moduledir: ..\n:branch: master\n:github-repo: https://github.com/redhat-scholars/kubernetes-tutorial\n:openshift-version: "
  },
  {
    "path": "documentation/modules/ROOT/pages/_partials/affinity_label.adoc",
    "chars": 1655,
    "preview": "// tag::openshift[]\n:chosen-node: ip-10-0-175-64.eu-central-1.compute.internal\n// end::openshift[]\n// tag::minikube[]\n:c"
  },
  {
    "path": "documentation/modules/ROOT/pages/_partials/find_node_for_pod.adoc",
    "chars": 247,
    "preview": "[.console-input]\n[source,bash,subs=\"+macros\"]\n----\nNODE=$(kubectl get pod -o jsonpath='{.items[0].spec.nodeName}') #<.>\n"
  },
  {
    "path": "documentation/modules/ROOT/pages/_partials/invoke-service.adoc",
    "chars": 40,
    "preview": "[k8s-env='']\n[k8s-cli='']\n[doc-sec='']\n\n"
  },
  {
    "path": "documentation/modules/ROOT/pages/_partials/set-env-vars.adoc",
    "chars": 633,
    "preview": ".Environment Variables\n\n[cols=\"4*^,4*.\"]\n|===\n|**Variable** |**Description** |**Default Value** | **e.g.**\n\n|REGISTRY_US"
  },
  {
    "path": "documentation/modules/ROOT/pages/_partials/verify-setup.adoc",
    "chars": 1270,
    "preview": "\nThe following checks ensure that each chapter exercises are done with the right environment settings.\n\n[#minikube-confi"
  },
  {
    "path": "documentation/modules/ROOT/pages/_partials/watching-logs.adoc",
    "chars": 829,
    "preview": "[kube-ns='kubernetestutorial']\n[kube-svc='']\n\nSince a Cron job source is used in this section of the tutorial, it would "
  },
  {
    "path": "documentation/modules/ROOT/pages/blue-green.adoc",
    "chars": 2882,
    "preview": "= Blue/Green\n\nhttps://martinfowler.com/bliki/BlueGreenDeployment.html[Here] you can find a description and history of Bl"
  },
  {
    "path": "documentation/modules/ROOT/pages/building-images.adoc",
    "chars": 5616,
    "preview": "= Building Images\n\n// See antora yaml (such as github-pages.yml) to change what attribute docker-host is set to\n\n== Prer"
  },
  {
    "path": "documentation/modules/ROOT/pages/configmap.adoc",
    "chars": 6779,
    "preview": "= ConfigMap\n\nConfigMap is the Kubernetes resource that allows you to externalize your application's configuration.\n\n*_An"
  },
  {
    "path": "documentation/modules/ROOT/pages/crds.adoc",
    "chars": 24440,
    "preview": "= Operators\ninclude::_attributes.adoc[]\n:watch-terminal: Terminal 2\n:log-terminal: Terminal 3\n:section-namespace: pizzah"
  },
  {
    "path": "documentation/modules/ROOT/pages/daemonset.adoc",
    "chars": 1647,
    "preview": "= DaemonSets\ninclude::_attributes.adoc[]\n\nA DaemonSet ensures that all nodes run a copy of a Pod. \nAs nodes are added to"
  },
  {
    "path": "documentation/modules/ROOT/pages/exec.adoc",
    "chars": 5862,
    "preview": "= Kubectl exec\n\nThe exec command allows you to \"shell into\" your pod and execute commands inside of that tiny linux mach"
  },
  {
    "path": "documentation/modules/ROOT/pages/index.adoc",
    "chars": 159,
    "preview": "= Kubernetes Tutorial\n\nWelcome to your Kubernetes Journey!\n\nYour journey contains four steps, each one of them in a diff"
  },
  {
    "path": "documentation/modules/ROOT/pages/ingress.adoc",
    "chars": 5610,
    "preview": "= Ingress\n\nMake sure you are in the correct namespace.\n\n== Enable Ingress Controller\n\nIn case of using `minikube` you ne"
  },
  {
    "path": "documentation/modules/ROOT/pages/installation.adoc",
    "chars": 1284,
    "preview": "= Installation & Setup\ninclude::_attributes.adoc[]\n\n[#tutorial-all-local]\n== CLI tools\n\ninclude::partial$prerequisites-k"
  },
  {
    "path": "documentation/modules/ROOT/pages/jobs-cronjobs.adoc",
    "chars": 13408,
    "preview": "= Jobs & CronJobs\ninclude::_attributes.adoc[]\n:watch-terminal: Terminal 2\n\nMost of the time, you are using Kubernetes as"
  },
  {
    "path": "documentation/modules/ROOT/pages/kubectl.adoc",
    "chars": 8051,
    "preview": "= kubectl: The Kubernetes Client\n\n[[talk]]\n== Talk to your Cluster\n[#kubectl-view-config]\n[.console-input]\n[source,bash,"
  },
  {
    "path": "documentation/modules/ROOT/pages/live-ready.adoc",
    "chars": 13022,
    "preview": "= Liveness & Readiness\n\nMake sure you are in the correct namespace:\n\n:section-k8s: liveready\n:set-namespace: myspace\n\nin"
  },
  {
    "path": "documentation/modules/ROOT/pages/logs.adoc",
    "chars": 4008,
    "preview": "= Logs\n\nThere are various \"production-ready\" ways to do log gathering and viewing across a Kubernetes/OpenShift cluster."
  },
  {
    "path": "documentation/modules/ROOT/pages/pod-rs-deployment.adoc",
    "chars": 7421,
    "preview": "= Pod, ReplicaSet, Deployment\n\nFirst create a namespace to work in:\n\n[#create-namespace]\n[.console-input]\n[source,bash,s"
  },
  {
    "path": "documentation/modules/ROOT/pages/resources.adoc",
    "chars": 8473,
    "preview": "= Resources and Limits\n\nMake sure you are in the correct namespace:\n\n:section-k8s: resource\n:set-namespace: myspace\n\n[TI"
  },
  {
    "path": "documentation/modules/ROOT/pages/rolling-updates.adoc",
    "chars": 6828,
    "preview": "= Rolling updates\n\nMake sure you are in the correct namespace\n\n:section-k8s: rolling\n:set-namespace: myspace\ninclude::pa"
  },
  {
    "path": "documentation/modules/ROOT/pages/secrets.adoc",
    "chars": 9686,
    "preview": "= Secrets\ninclude::_attributes.adoc[]\n:watch-terminal: Terminal 2\n\nSecrets are an out of the box way Kubernetes provides"
  },
  {
    "path": "documentation/modules/ROOT/pages/service-magic.adoc",
    "chars": 5996,
    "preview": "= Service Magic\n\nCreate a Namespace:\n\n[#create-namespace]\n[.console-input]\n[source,bash,subs=\"+macros,+attributes\"]\n----"
  },
  {
    "path": "documentation/modules/ROOT/pages/service.adoc",
    "chars": 5475,
    "preview": "= Service\n\nNOTE: This follows the creation of the Deployment in the previous chapter\n\nMake sure you are in the correct n"
  },
  {
    "path": "documentation/modules/ROOT/pages/statefulset.adoc",
    "chars": 14491,
    "preview": "= StatefulSets\ninclude::_attributes.adoc[]\n:watch-terminal: Terminal 2\n\nA `StatefulSet` provides a unique identity to th"
  },
  {
    "path": "documentation/modules/ROOT/pages/taints-affinity.adoc",
    "chars": 18401,
    "preview": "= Taints and Affinity\ninclude::_attributes.adoc[]\n:watch-terminal: Terminal 2\n\nSo far, when we deployed any Pod in the K"
  },
  {
    "path": "documentation/modules/ROOT/pages/volumes-persistentvolumes.adoc",
    "chars": 23287,
    "preview": "= Volumes & Persistent Volumes\ninclude::_attributes.adoc[]\n:watch-terminal: Terminal 2\n:file-watch-terminal: Terminal 3\n"
  },
  {
    "path": "documentation/modules/ROOT/partials/create-greeting-file.adoc",
    "chars": 243,
    "preview": "[.console-input]\n[source,bash]\n----\nkubectl exec -ti myboot-demo -- /bin/bash\n----\n\nand then from within the pod, genera"
  },
  {
    "path": "documentation/modules/ROOT/partials/describe-deployment.adoc",
    "chars": 169,
    "preview": "[#{section-k8s}-kubectl-describe-deployment]\n[.console-input]\n[source, bash,subs=\"+macros,+attributes\"]\n----\nkubectl des"
  },
  {
    "path": "documentation/modules/ROOT/partials/describe.adoc",
    "chars": 244,
    "preview": "[#{section-k8s}-kubectl-describe-services]\n[.console-input]\n[source,bash,subs=\"+macros,+attributes\"]\n----\nPODNAME=$(kube"
  },
  {
    "path": "documentation/modules/ROOT/partials/env-curl.adoc",
    "chars": 1072,
    "preview": "[tabs]\n====\nMinikube::\n+\n--\n:tmp-service-exposed: {service-exposed}\n\n[.console-input]\n[source,bash,subs=\"+macros,+attrib"
  },
  {
    "path": "documentation/modules/ROOT/partials/file-watch-command.adoc",
    "chars": 142,
    "preview": "[.console-input]\n[source,bash,subs=\"+macros,+attributes\"]\n----\nwatch -n1 -- \"ls -al {mount-dir} && eval \"\"cat {mount-dir"
  },
  {
    "path": "documentation/modules/ROOT/partials/loop.adoc",
    "chars": 158,
    "preview": "[#{section-k8s}-curl-loop]\n[.console-input]\n[source,bash,subs=\"+macros,+attributes\"]\n----\nwhile true\ndo curl $IP:$PORT\ns"
  },
  {
    "path": "documentation/modules/ROOT/partials/namespace-setup-tip.adoc",
    "chars": 519,
    "preview": "[TIP]\n====\nYou will need to create the `{set-namespace}` if you haven't already.  Check for the existence of the namespa"
  },
  {
    "path": "documentation/modules/ROOT/partials/open-terminal-in-editor-inset.adoc",
    "chars": 386,
    "preview": ".VSCode: Open Terminal in Editor\n****\nIf you're doing this tutorial from within VSCode you may be running out of space t"
  },
  {
    "path": "documentation/modules/ROOT/partials/optional-requisites.adoc",
    "chars": 1620,
    "preview": "The following CLI tools are optional for running the exercises in this tutorial.\nAlthough they are used in the tutorial,"
  },
  {
    "path": "documentation/modules/ROOT/partials/prerequisites-kubernetes.adoc",
    "chars": 2518,
    "preview": ":kubernetes-version: v1.34.0\n:minikube-version: v1.37.0\n:maven-version: 3.9.9\n:java-version: 21\n:stern-version: 1.33.0\n\n"
  },
  {
    "path": "documentation/modules/ROOT/partials/set-context.adoc",
    "chars": 176,
    "preview": "[#{section-k8s}-change-context-resource]\n[.console-input]\n[source, bash, subs=\"+macros,+attributes\"]\n----\nkubectl config"
  },
  {
    "path": "documentation/modules/ROOT/partials/stern-watch.adoc",
    "chars": 411,
    "preview": "[#{section-k8s}-kubectl-watch-logs]\n\n// FIXME: the attributes inside the code block in the tab don't get filled in \n// i"
  },
  {
    "path": "documentation/modules/ROOT/partials/taint-remove-taint.adoc",
    "chars": 3786,
    "preview": "// tag::openshift[]\n:chosen-node: ip-10-0-140-186.eu-central-1.compute.internal\n// end::openshift[]\n// tag::minikube[]\n:"
  },
  {
    "path": "documentation/modules/ROOT/partials/terminal-cleanup.adoc",
    "chars": 753,
    "preview": "[tabs]\n====\nTerminal 1::\n+\n--\n// tag::term-exec[]\nExit the `exec` command\n\n[.console-input]\n[source,bash]\n----\nexit\n----"
  },
  {
    "path": "documentation/modules/ROOT/partials/tip_vscode_kube_editor.adoc",
    "chars": 313,
    "preview": "[TIP]\n====\nIf you're running this tutorial from within VSCode or would like to use VSCode to edit the resource targeted,"
  },
  {
    "path": "documentation/modules/ROOT/partials/tip_vscode_quick_open.adoc",
    "chars": 146,
    "preview": "[TIP]\n====\nIf you're running this from within VSCode you can use kbd:[CTRL+p] (or kbd:[CMD+p] on Mac OSX) to quickly ope"
  },
  {
    "path": "documentation/modules/ROOT/partials/watch-node-directory.adoc",
    "chars": 479,
    "preview": "\nLet's use the `minikube ssh` command to simulate a connection to the kubernetes node.  (There is only one node running "
  },
  {
    "path": "documentation/modules/ROOT/partials/watching-pods-with-nodes.adoc",
    "chars": 465,
    "preview": "[#{section-k8s}-kubectl-watch-pods]\n[tabs]\n====\n{watch-terminal}::\n+\n--\n[.console-input]\n[source,bash,subs=\"+macros,+att"
  },
  {
    "path": "documentation/modules/ROOT/partials/watching-pods.adoc",
    "chars": 135,
    "preview": "[#{section-k8s}-kubectl-watch-pods]\n[.console-input]\n[source,bash,subs=\"+macros,+attributes\"]\n----\nwatch -n 1 -- kubectl"
  },
  {
    "path": "documentation/modules/ROOT/partials/watching-services.adoc",
    "chars": 825,
    "preview": "[#{section-k8s}-kubectl-watch-services]\n[.console-input]\n[source,bash,subs=\"+macros,+attributes\"]\n----\nkubectl get servi"
  },
  {
    "path": "documentation/modules/_attributes.adoc",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "github-pages-stage.yml",
    "chars": 1271,
    "preview": "runtime:\n  cache_dir: ./.cache/antora\n\nsite:\n  title: Kubernetes Tutorial (Proposed Changes)\n  url: https://hatmarch.git"
  },
  {
    "path": "github-pages.yml",
    "chars": 1362,
    "preview": "runtime:\n  cache_dir: ./.cache/antora\n\nsite:\n  title: Kubernetes Tutorial\n  url: https://redhat-scholars.github.io/kuber"
  },
  {
    "path": "gulpfile.babel.js",
    "chars": 1796,
    "preview": "/*jshint esversion: 6 */\n\nimport { series, watch } from \"gulp\";\nimport { remove } from \"fs-extra\";\nimport { readFileSync"
  },
  {
    "path": "lib/copy-to-clipboard.js",
    "chars": 1182,
    "preview": "const BlockCopyToClipboardMacro = (() => {\n  const $context = Symbol(\"context\");\n  const superclass = Opal.module(null, "
  },
  {
    "path": "lib/remote-include-processor.js",
    "chars": 423,
    "preview": "module.exports = function () {\n    this.includeProcessor(function () {\n      this.$option('position', '>>')\n      this.h"
  },
  {
    "path": "lib/tab-block.js",
    "chars": 2662,
    "preview": "/**\n * Extends the AsciiDoc syntax to support a tabset element. The tabset is\n * created from a dlist that is enclosed i"
  },
  {
    "path": "package.json",
    "chars": 1007,
    "preview": "{\n  \"name\": \"kubernetes-tutorial-site\",\n  \"description\": \"Kubernetes Tutorial Documentation\",\n  \"homepage\": \"https://red"
  },
  {
    "path": "scripts/create-kubeconfig.sh",
    "chars": 3240,
    "preview": "#!/bin/bash\n\nset -euo pipefail\n\ndeclare MINIKUBE_HOST=${1:-192.168.86.48}\n\n# private key to be used to authenticate with"
  },
  {
    "path": "scripts/github-pages-publish.sh",
    "chars": 741,
    "preview": "#!/bin/bash\n\nset -euo pipefail\n\ndeclare SITE=${1:-github-pages-stage.yml}\ndeclare REPO=${2:-$(git remote get-url origin)"
  },
  {
    "path": "scripts/minikube-server-setup.sh",
    "chars": 1626,
    "preview": "set -euo pipefail\n\ndeclare MINIKUBE_PROFILE=${1:-devnation}\ndeclare MINIKUBE_IP=${2:-$(hostname -I | awk '{print $1}')}\n"
  },
  {
    "path": "scripts/pod-node-columns-template.txt",
    "chars": 206,
    "preview": "NAME                       READY   STATUS    RESTARTS   AGE   IP       NODE     NOMINATED NODE  READINESS GATES\nmyboot2-"
  },
  {
    "path": "scripts/shell-setup.sh",
    "chars": 607,
    "preview": "#!/bin/bash\n\n# per the following $0 doesn't work reliably when the script is sourced:\n# https://stackoverflow.com/questi"
  },
  {
    "path": "supplemental-ui/partials/header-content.hbs",
    "chars": 2277,
    "preview": "<header class=\"header\">\n  <style>\n    /* override master stylesheet properties for this partial here */\n\n    .navbar-ite"
  },
  {
    "path": "supplemental-ui/partials/nav-explore.hbs",
    "chars": 974,
    "preview": "<div class=\"nav-panel-explore{{#unless page.navigation}} is-active{{/unless}}\" {{#if page.attributes.hide-versions-compo"
  }
]

// ... and 5 more files (download for full content)

About this extraction

This page contains the full source code of the redhat-scholars/kubernetes-tutorial GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 205 files (350.0 KB), approximately 103.2k tokens, and a symbol index with 63 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!