Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: replicated-release-unstable

on:
workflow_dispatch:
inputs:
version:
description: "Version tag (e.g. v1.0.0)"
required: false
push:
branches:
- main
Expand All @@ -17,7 +21,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get latest tag
id: get-latest-tag
run: |
Expand All @@ -28,16 +32,22 @@ jobs:
- name: Set release version
id: set-release-version
run: |
VERSION=${{ env.LATEST_TAG }}-$(git rev-parse --short HEAD)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
if [ -z "${{ github.event.inputs.version }}" ]; then
git_hash=$(git rev-parse --short HEAD)
date_version=$(date -u '+%Y.%-m.%-d-%H%M%S')
version="${date_version}-Unstable-${git_hash}"
else
version="${{ github.event.inputs.version }}"
fi
echo "VERSION=${version}" >> $GITHUB_ENV

- name: Package Helm chart
id: package-helm-chart
run: |
helm package ./app --debug -u -d ./replicated \
--version ${{ env.VERSION }} \
--app-version ${{ env.VERSION }}

- name: Install yq
run: |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq &&\
Expand All @@ -46,13 +56,13 @@ jobs:
- name: Update HelmChart kind
run: |
yq -i '.spec.chart.chartVersion = "${{ env.VERSION }}"' replicated/kots-chart.yaml

- name: Create Replicated release
id: create-release
uses: replicatedhq/compatibility-actions/create-release@v1
with:
app-slug: ${{ secrets.REPLICATED_APP }}
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
yaml-dir: ./replicated
promote-channel: unstable
version: ${{ env.VERSION }}
promote-channel: Unstable
version: ${{ env.VERSION }}
53 changes: 53 additions & 0 deletions applications/fake-services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,60 @@

This repository contains an example Helm chart that distributed with Replicated Embedded Cluster.

![app](img/app.png)

## Components

- A Helm chart using [fake-service](https://github.com/nicholasjackson/fake-service)
- Replicated [manifests](https://docs.replicated.com/reference/custom-resource-about) to deploy the chart with Replicated

## Replicated features

- [x] Packaged as a Helm chart
- [x] Installation works via Helm CLI, as well as KOTS & Embedded Cluster
- [x] Support Online and Airgap install
- [x] Replicated SDK installed
- [x] Custom Metrics implemented
- [x] Github Actions workflow for Replicated test and release
- [x] Support Replicated Proxy Service
- [x] Support Replicated Custom Domain

## Troubleshooting features for CRE

We do include utility pods to peek into KOTS Admin Console underlying database and object storage (Minio).

### rqlite

For database, to peek into `rqlite` database, you can use the following command:

```bash
kubectl port-forward svc/rqlite-ui-service 3000:80
```

And go to http://localhost:3000 to browse the database.

![rqlite-ui](img/rqlite-ui.png)

### Minio

For object storage, to peek into `minio` object storage, you can use the following command:

First, get the WebUI port from `kotsadm-minio-0` pod:

```log
kubectl logs kotsadm-minio-0
...
WebUI: http://10.42.0.11:<port>> http://127.0.0.1:<port>
```

Next, port forward to the WebUI port:

```bash
kubectl port-forward svc/kotsadm-minio <port>:<port>
```

And go to http://localhost:<port> to browse the object storage.

The username is `admin` and the password is the secretkey in `kotsadm-minio` secret.

![minio-ui](img/minio-ui.png)
2 changes: 1 addition & 1 deletion applications/fake-services/app/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ dependencies:
repository: oci://registry.replicated.com/library
version: 1.0.0-beta.31
digest: sha256:c349fc2fe99276ed430877ef2a0cf0e05150cd27f6e4eae2d7bfe47733f64846
generated: "2024-11-27T11:01:55.491515+11:00"
generated: "2025-02-04T08:53:26.530341+11:00"
20 changes: 20 additions & 0 deletions applications/fake-services/app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ Backend service name
backend-service
{{- end }}

{{/*
Rqlite UI service name
*/}}
{{- define "fake-service.rqliteui.name" -}}
rqlite-ui-service
{{- end }}

{{/*
Rqlite UI labels selector
*/}}
{{- define "fake-service.rqliteui.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fake-service.name" . }}-rqliteui
{{- end }}

{{/*
Minio UI labels selector
*/}}
{{- define "fake-service.minioui.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fake-service.name" . }}-minioui
{{- end }}

{{/*
Image Pull Secrets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
name: {{ quote (printf "%s-backend" (include "fake-service.fullname" .)) }}
labels:
{{- include "fake-service.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
name: {{ quote (printf "%s-frontend" (include "fake-service.fullname" .)) }}
labels:
{{- include "fake-service.labels" . | nindent 4 }}
spec:
Expand Down Expand Up @@ -33,4 +33,4 @@ spec:
- name: LOG_LEVEL
value: "{{ .Values.frontend.logLevel }}"
- name: UPSTREAM_URIS
value: "http://{{ include "fake-service.backend.name" . }}.{{ .Release.Namespace }}"
value: "http://{{ include "fake-service.backend.name" . }}.{{ .Release.Namespace }}"
51 changes: 51 additions & 0 deletions applications/fake-services/app/templates/minio-ui-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ quote (printf "%s-minio-ui" (include "fake-service.fullname" .)) }}
labels:
{{- include "fake-service.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "fake-service.minioui.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "fake-service.minioui.selectorLabels" . | nindent 8 }}
spec:
initContainers:
- name: setup-minio-ui
image: minio/minio
env:
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: kotsadm-minio
key: accesskey
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: kotsadm-minio
key: secretkey
command:
- /bin/sh
- -c
- |
mc alias set myminio http://kotsadm-minio:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
echo "Creating Minio Console Admin User..."
mc admin user add myminio admin $MINIO_SECRET_KEY
echo "Attaching IAM policy..."
mc admin policy attach myminio consoleAdmin --user admin
containers:
- name: minio-ui
image: alpine
command:
- /bin/sh
- -c
- |
echo "Check WebUI port in kotsadm-minio pod logs and port forward to it to browse the Minio UI"
echo "e.g. kubectl port-forward svc/kotsadm-minio 33655:33655"
echo "username: admin, password: set to secretkey in kotsadm-minio secret"
sleep infinity
restartPolicy: Always
35 changes: 35 additions & 0 deletions applications/fake-services/app/templates/rqlite-ui-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ quote (printf "%s-rqlite-ui" (include "fake-service.fullname" .)) }}
labels:
{{- include "fake-service.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "fake-service.rqliteui.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "fake-service.rqliteui.selectorLabels" . | nindent 8 }}
spec:
{{- include "helpers.imagePullSecrets" . | nindent 6 }}
containers:
- name: rqliteui
image: {{ .Values.rqliteui.image.registry }}/{{ .Values.rqliteui.image.repository }}:{{ .Values.rqliteui.image.tag }}
env:
- name: RQLITE_HOST
valueFrom:
secretKeyRef:
key: uri
name: kotsadm-rqlite
- name: RQLITE_USERNAME
value: kotsadm
- name: RQLITE_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: kotsadm-rqlite
ports:
- name: rqliteui
containerPort: 3000
15 changes: 15 additions & 0 deletions applications/fake-services/app/templates/rqlite-ui-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "fake-service.rqliteui.name" . }}
labels: {{- include "fake-service.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: 80
targetPort: rqliteui
protocol: TCP
name: rqliteui
selector:
{{- include "fake-service.rqliteui.selectorLabels" . | nindent 4 }}

11 changes: 11 additions & 0 deletions applications/fake-services/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ ingress-nginx:
http: 30080
ingressClassResource:
default: true

rqliteui:
image:
registry: docker.io
repository: gerardnguyen/rqman
tag: 0.0.3
pullPolicy: IfNotPresent
imagePullSecrets: []

cert-manager:
enabled: true
Binary file added applications/fake-services/img/app.png
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 applications/fake-services/img/minio-ui.png
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 applications/fake-services/img/rqlite-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions applications/fake-services/replicated/cert-manager-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kots.io/v1beta2
kind: HelmChart
metadata:
name: cert-manager
spec:
chart:
name: cert-manager
chartVersion: v1.17.0
releaseName: cert-manager
weight: -4
helmUpgradeFlags:
- --wait
- --debug
values:
global:
imagePullSecrets:
- name: repl{{ ImagePullSecretName }}
installCRDs: true
1 change: 1 addition & 0 deletions applications/fake-services/replicated/k8s-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: fake-service
message: thisistheway
spec:
descriptor:
links:
Expand Down
12 changes: 9 additions & 3 deletions applications/fake-services/replicated/kots-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- --debug
values:
image:
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "proxy.replicated.com" }}'
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "quirkyquokka.dev" }}'
repository: '{{repl HasLocalRegistry | ternary LocalRegistryNamespace "proxy/gerard-helm-fake-service/429114214526.dkr.ecr.ap-southeast-2.amazonaws.com/gerard" }}/fake-service'
imagePullSecrets:
- name: "{{repl ImagePullSecretName }}"
Expand All @@ -29,10 +29,16 @@ spec:
- name: "{{repl ImagePullSecretName }}"
controller:
image:
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "proxy.replicated.com" }}'
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "quirkyquokka.dev" }}'
image: '{{repl HasLocalRegistry | ternary LocalRegistryNamespace "proxy/gerard-helm-fake-service/429114214526.dkr.ecr.ap-southeast-2.amazonaws.com/gerard" }}/controller'
admissionWebhooks:
patch:
image:
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "proxy.replicated.com" }}'
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "quirkyquokka.dev" }}'
image: '{{repl HasLocalRegistry | ternary LocalRegistryNamespace "proxy/gerard-helm-fake-service/429114214526.dkr.ecr.ap-southeast-2.amazonaws.com/gerard" }}/kube-webhook-certgen'
rqliteui:
image:
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "quirkyquokka.dev" }}'
repository: '{{repl HasLocalRegistry | ternary LocalRegistryNamespace "proxy/gerard-helm-fake-service/429114214526.dkr.ecr.ap-southeast-2.amazonaws.com/gerard" }}/rqman'
imagePullSecrets:
- name: "{{repl ImagePullSecretName }}"
Loading