diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7625739 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: build + +on: + push: + branches: + - main + tags: + - "v*" + paths-ignore: + - "README.md" + +permissions: + packages: write + contents: write + +concurrency: + group: build + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: set datetime + run: | + echo "datetime=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: build image + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: rht-summit-2023-lab-guide + tags: latest ${{ github.ref_name }} + dockerfiles: | + ./Dockerfile + build-args: | + CREATED_AT=${{ env.datetime }} + GITHUB_SHA=${{ github.sha }} + - name: push image to quay.io + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: quay.io/evanshortiss + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23ceec1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +site +.cache +.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5c8f8d4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +### BUILDER IMAGE ### +FROM docker.io/antora/antora:3.1.2 as builder + +ADD . /antora/ + +RUN antora generate --stacktrace site.yml + +### RUNTIME IMAGE ### +FROM registry.access.redhat.com/ubi8/httpd-24@sha256:7a46fd21bbaf590960b39161c968298a32b49f7cb7eb3a840e211e13a16e313e + +ARG CREATED_AT=none +ARG GITHUB_SHA=none + +LABEL org.opencontainers.image.created="$CREATED_AT" +LABEL org.opencontainers.image.revision="$GITHUB_SHA" + +LABEL org.opencontainers.image.title="Summit 2023 GitOps Workshop Guide" +LABEL org.opencontainers.image.description="A httpd container that serve the workshop guide." +LABEL org.opencontainers.image.url="https://demo.redhat.com" +LABEL org.opencontainers.image.source="git@github.com:evanshortiss/rht-summit-2023-lab-guide" +LABEL org.opencontainers.image.documentation="https://github.com/evanshortiss/rht-summit-2023-lab-guide" +LABEL org.opencontainers.image.authors="evanshortiss" +LABEL org.opencontainers.image.vendor="redhat" +LABEL org.opencontainers.image.licenses="MIT" +LABEL org.opencontainers.image.version="1.0.0" + +COPY --from=builder /antora/site/ /var/www/html/ diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..df7e674 --- /dev/null +++ b/README.adoc @@ -0,0 +1,19 @@ +# Summit 2023 - GitOps Workshop Guide + +## Local development + +[source,bash] +---- +podman build -t localhost/rht-summit-2023-lab-guide . +podman run --rm --name guides -d -p 4000:8080 localhost/rht-summit-2023-lab-guide +---- + +## Deploy to OpenShift + +[source,bash] +---- +oc new-app https://github.com/blues-man/rht-summit-2023-lab-guide.git --strategy=docker + oc create route edge rht-summit-2023-lab-guide --service=rht-summit-2023-lab-guide +# To rebuild after changes pushed to git +oc start-build rht-summit-2023-lab-guide --follow +---- diff --git a/chart/.helmignore b/chart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000..a58ab5b --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: guides +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.1.0" diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml new file mode 100644 index 0000000..39a18de --- /dev/null +++ b/chart/templates/deployment.yaml @@ -0,0 +1,41 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: guides + namespace: {{ .Values.namespace }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: guides + template: + metadata: + labels: + app.kubernetes.io/name: guides + spec: + containers: + - name: guides + image: {{ .Values.image }} + imagePullPolicy: Always + ports: + - containerPort: 8080 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: 8080 + readinessProbe: + httpGet: + path: / + port: 8080 + resources: + {{- toYaml .Values.resources | nindent 10 }} + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault diff --git a/chart/templates/namespace.yaml b/chart/templates/namespace.yaml new file mode 100644 index 0000000..96e8bd5 --- /dev/null +++ b/chart/templates/namespace.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace }} + annotations: + openshift.io/description: "Lab Guides" + openshift.io/display-name: "Lab Guides" diff --git a/chart/templates/route.yaml b/chart/templates/route.yaml new file mode 100644 index 0000000..0427637 --- /dev/null +++ b/chart/templates/route.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: guides + namespace: {{ .Values.namespace }} +spec: + tls: + termination: edge + to: + kind: Service + name: guides + port: + targetPort: 8080 + wildcardPolicy: None diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml new file mode 100644 index 0000000..fb3b36c --- /dev/null +++ b/chart/templates/service.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: guides + namespace: {{ .Values.namespace }} +spec: + type: ClusterIP + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app.kubernetes.io/name: guides diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000..593f517 --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,21 @@ +# Default values for guides. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +namespace: guides + +image: quay.io/evanshortiss/rht-summit-2023-lab-guide:latest + +replicaCount: 1 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi diff --git a/docs/antora.yml b/docs/antora.yml new file mode 100644 index 0000000..657ec40 --- /dev/null +++ b/docs/antora.yml @@ -0,0 +1,6 @@ +name: summit-2023-gitops-workshop-guide +title: Summit 2023 - GitOps Workshop Guide +version: main +nav: + - modules/m1/nav.adoc +start_page: m1:intro.adoc diff --git a/docs/modules/m1/assets/images/.keepme b/docs/modules/m1/assets/images/.keepme new file mode 100644 index 0000000..e69de29 diff --git a/docs/modules/m1/nav.adoc b/docs/modules/m1/nav.adoc new file mode 100644 index 0000000..7129af5 --- /dev/null +++ b/docs/modules/m1/nav.adoc @@ -0,0 +1,3 @@ +.Module One: Overview +* xref:intro.adoc[Introduction] +// * xref:setup.adoc[Setup] \ No newline at end of file diff --git a/docs/modules/m1/pages/intro.adoc b/docs/modules/m1/pages/intro.adoc new file mode 100644 index 0000000..34db500 --- /dev/null +++ b/docs/modules/m1/pages/intro.adoc @@ -0,0 +1,5 @@ +# Red Hat Summit 2023: Vote App Lab Overview - Introduction + +## About this lab + +Hello world! \ No newline at end of file diff --git a/site.yml b/site.yml new file mode 100644 index 0000000..f3cf22d --- /dev/null +++ b/site.yml @@ -0,0 +1,24 @@ +runtime: + cache_dir: ./.cache/antora + +site: + title: Summit 2023 - GitOps Workshop Guide + start_page: summit-2023-gitops-workshop-guide:m1:intro.adoc + +content: + sources: + - url: . + start_path: docs + +asciidoc: + attributes: + experimental: true + page-pagination: true + +ui: + bundle: + url: ./ui/ui-bundle.zip + supplemental_files: ./ui/supplemental-ui + +output: + dir: ./site diff --git a/ui/supplemental-ui/img/Logo-Red_Hat-A-Standard-Pantone.jpg b/ui/supplemental-ui/img/Logo-Red_Hat-A-Standard-Pantone.jpg new file mode 100644 index 0000000..f07c7b7 Binary files /dev/null and b/ui/supplemental-ui/img/Logo-Red_Hat-A-Standard-Pantone.jpg differ diff --git a/ui/supplemental-ui/img/Logo-Red_Hat-OpenShift_4-A-Reverse-RGB.png b/ui/supplemental-ui/img/Logo-Red_Hat-OpenShift_4-A-Reverse-RGB.png new file mode 100644 index 0000000..2e167ef Binary files /dev/null and b/ui/supplemental-ui/img/Logo-Red_Hat-OpenShift_4-A-Reverse-RGB.png differ diff --git a/ui/supplemental-ui/img/Logo-Red_Hat-Runtimes-A-Reverse-RGB.png b/ui/supplemental-ui/img/Logo-Red_Hat-Runtimes-A-Reverse-RGB.png new file mode 100644 index 0000000..5610085 Binary files /dev/null and b/ui/supplemental-ui/img/Logo-Red_Hat-Runtimes-A-Reverse-RGB.png differ diff --git a/ui/supplemental-ui/img/favicon.ico b/ui/supplemental-ui/img/favicon.ico new file mode 100644 index 0000000..11c5cd2 Binary files /dev/null and b/ui/supplemental-ui/img/favicon.ico differ diff --git a/ui/supplemental-ui/partials/footer-content.hbs b/ui/supplemental-ui/partials/footer-content.hbs new file mode 100644 index 0000000..931fcc3 --- /dev/null +++ b/ui/supplemental-ui/partials/footer-content.hbs @@ -0,0 +1,7 @@ +{{!--
+
\ No newline at end of file diff --git a/ui/supplemental-ui/partials/nav-menu.hbs b/ui/supplemental-ui/partials/nav-menu.hbs new file mode 100644 index 0000000..8b71247 --- /dev/null +++ b/ui/supplemental-ui/partials/nav-menu.hbs @@ -0,0 +1,10 @@ +{{#with page.navigation}} + +{{/with}} diff --git a/ui/ui-bundle.zip b/ui/ui-bundle.zip new file mode 100644 index 0000000..436da19 Binary files /dev/null and b/ui/ui-bundle.zip differ