Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed May 9, 2023
0 parents commit 25d6a74
Show file tree
Hide file tree
Showing 24 changed files with 375 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
site
.cache
.DS_Store
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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="[email protected]: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/
19 changes: 19 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -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
----
23 changes: 23 additions & 0 deletions chart/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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"
41 changes: 41 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions chart/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.namespace }}
annotations:
openshift.io/description: "Lab Guides"
openshift.io/display-name: "Lab Guides"
15 changes: 15 additions & 0 deletions chart/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -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
Empty file.
3 changes: 3 additions & 0 deletions docs/modules/m1/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Module One: Overview
* xref:intro.adoc[Introduction]
// * xref:setup.adoc[Setup]
5 changes: 5 additions & 0 deletions docs/modules/m1/pages/intro.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Red Hat Summit 2023: Vote App Lab Overview - Introduction

## About this lab

Hello world!
24 changes: 24 additions & 0 deletions site.yml
Original file line number Diff line number Diff line change
@@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/supplemental-ui/img/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions ui/supplemental-ui/partials/footer-content.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{!-- <footer class="footer">
<div class="container">
<p class="text-center">
<a class="rhd-logo" href="https://developers.redhat.com" target="_blank"></div>
</p>
</div>
</footer> --}}
78 changes: 78 additions & 0 deletions ui/supplemental-ui/partials/header-content.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<header class="header">
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
const urlParams = new URLSearchParams(window.location.search);
const userId = urlParams.get('USERID');
const subDomain = urlParams.get('SUBDOMAIN');
const apiUrl = urlParams.get('APIURL');
if (userId) {
showUserId( userId );
}
else {
showUserIdForm();
}
} );
function showUserId( userId ) {
document.getElementById('navbar-form-empty').style.display = "none";
document.getElementById('navbar-form-filled').style.display = "flex";
document.getElementById('username').textContent = userId;
document.getElementById('subDomain').value = subDomain;
document.getElementById('apiUrl').value = apiUrl;
}
function showUserIdForm( userId ) {
document.getElementById('navbar-form-empty').style.display = "flex";
document.getElementById('navbar-form-filled').style.display = "none";
}
function goWithUserId() {
elUserIdInput = document.getElementById('userId');
elSubDomainInput = document.getElementById('subDomain');
elapiUrlInput = document.getElementById('apiUrl');
window.location.search = ('&USERID=' + elUserIdInput.value + '&SUBDOMAIN=' + elSubDomainInput.value + '&APIURL=' + elapiUrlInput.value);
}
</script>
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="https://www.redhat.com/en/technologies/cloud-computing/openshift" target="_blank"><img
src="{{uiRootPath}}/img/Logo-Red_Hat-OpenShift_4-A-Reverse-RGB.png" height="40px" alt="Red Hat OpenShift"></a>
<a class="navbar-item" href="{{{or site.url (or siteRootUrl siteRootPath)}}}" style="color: white;"><h3>{{site.title}}</h3></a>
<button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button>
</div>

<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item" id="navbar-form-empty">
<span class="navbar-text" style="margin-left: 1rem;">Your Workshop Environment</span>
<span class="navbar-text" style="margin-left: 1rem; margin-right: 1rem;">&nbsp;<i style="color: orange;"
class="fa fa-exclamation-triangle" aria-hidden="true"></i></span>

<form action="javascript:void(0);" onsubmit="goWithUserId();">
<div class="navbar-item" id="navbar-form-project-filled" style="display: none;">
<span class="navbar-text" style="margin-left: 1rem; margin-right: 1rem;">|</span>
</div>
<input size="40" id="userId" type="text" placeholder="Enter USER ID">
<input type="hidden" id="subDomain" name="subDomain" value="">
<input type="hidden" id="apiUrl" name="apiUrl" value="">
</form>
</div>

<div class="navbar-item" id="navbar-form-filled" style="display: none;">
<span class="navbar-text" style="margin-left: 1rem;">Your Workshop Environment</span>
<span class="navbar-text" style="margin-left: 1rem; margin-right: 1rem;">|</span>
<span class="navbar-text" id="username"></span>
<span class="navbar-text" style="margin-left: 1rem; margin-right: 1rem;">&nbsp;<i onclick="recycle();" style="color: green;" class="fa fa-recycle" aria-hidden="true"></i></span>
</div>

</div>
</nav>
</header>
10 changes: 10 additions & 0 deletions ui/supplemental-ui/partials/nav-menu.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{#with page.navigation}}
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
{{#with @root.page.componentVersion}}
<h3 class="title"><a href="{{{relativize ./url}}}" class=" query-params-link">{{./title}}</a></h3>
{{/with}}
{{> nav-tree navigation=this}}
</nav>
</div>
{{/with}}
Binary file added ui/ui-bundle.zip
Binary file not shown.

0 comments on commit 25d6a74

Please sign in to comment.