Skip to content

Commit d6518fe

Browse files
authored
Merge pull request #33 from replicatedhq/gerard/sc-116412/demo-app
Sync fake-services app update
2 parents 9c9c5c1 + cc6d6ae commit d6518fe

18 files changed

+264
-18
lines changed

applications/fake-services/.github/workflows/replicated-release-unstable.yaml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: replicated-release-unstable
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version tag (e.g. v1.0.0)"
8+
required: false
59
push:
610
branches:
711
- main
@@ -17,7 +21,7 @@ jobs:
1721
- uses: actions/checkout@v3
1822
with:
1923
fetch-depth: 0
20-
24+
2125
- name: Get latest tag
2226
id: get-latest-tag
2327
run: |
@@ -28,16 +32,22 @@ jobs:
2832
- name: Set release version
2933
id: set-release-version
3034
run: |
31-
VERSION=${{ env.LATEST_TAG }}-$(git rev-parse --short HEAD)
32-
echo "VERSION=${VERSION}" >> $GITHUB_ENV
35+
if [ -z "${{ github.event.inputs.version }}" ]; then
36+
git_hash=$(git rev-parse --short HEAD)
37+
date_version=$(date -u '+%Y.%-m.%-d-%H%M%S')
38+
version="${date_version}-Unstable-${git_hash}"
39+
else
40+
version="${{ github.event.inputs.version }}"
41+
fi
42+
echo "VERSION=${version}" >> $GITHUB_ENV
3343
3444
- name: Package Helm chart
3545
id: package-helm-chart
3646
run: |
3747
helm package ./app --debug -u -d ./replicated \
3848
--version ${{ env.VERSION }} \
3949
--app-version ${{ env.VERSION }}
40-
50+
4151
- name: Install yq
4252
run: |
4353
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq &&\
@@ -46,13 +56,13 @@ jobs:
4656
- name: Update HelmChart kind
4757
run: |
4858
yq -i '.spec.chart.chartVersion = "${{ env.VERSION }}"' replicated/kots-chart.yaml
49-
59+
5060
- name: Create Replicated release
5161
id: create-release
5262
uses: replicatedhq/compatibility-actions/create-release@v1
5363
with:
5464
app-slug: ${{ secrets.REPLICATED_APP }}
5565
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
5666
yaml-dir: ./replicated
57-
promote-channel: unstable
58-
version: ${{ env.VERSION }}
67+
promote-channel: Unstable
68+
version: ${{ env.VERSION }}

applications/fake-services/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,60 @@
22

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

5+
![app](img/app.png)
6+
57
## Components
68

79
- A Helm chart using [fake-service](https://github.com/nicholasjackson/fake-service)
810
- Replicated [manifests](https://docs.replicated.com/reference/custom-resource-about) to deploy the chart with Replicated
11+
12+
## Replicated features
13+
14+
- [x] Packaged as a Helm chart
15+
- [x] Installation works via Helm CLI, as well as KOTS & Embedded Cluster
16+
- [x] Support Online and Airgap install
17+
- [x] Replicated SDK installed
18+
- [x] Custom Metrics implemented
19+
- [x] Github Actions workflow for Replicated test and release
20+
- [x] Support Replicated Proxy Service
21+
- [x] Support Replicated Custom Domain
22+
23+
## Troubleshooting features for CRE
24+
25+
We do include utility pods to peek into KOTS Admin Console underlying database and object storage (Minio).
26+
27+
### rqlite
28+
29+
For database, to peek into `rqlite` database, you can use the following command:
30+
31+
```bash
32+
kubectl port-forward svc/rqlite-ui-service 3000:80
33+
```
34+
35+
And go to http://localhost:3000 to browse the database.
36+
37+
![rqlite-ui](img/rqlite-ui.png)
38+
39+
### Minio
40+
41+
For object storage, to peek into `minio` object storage, you can use the following command:
42+
43+
First, get the WebUI port from `kotsadm-minio-0` pod:
44+
45+
```log
46+
kubectl logs kotsadm-minio-0
47+
...
48+
WebUI: http://10.42.0.11:<port>> http://127.0.0.1:<port>
49+
```
50+
51+
Next, port forward to the WebUI port:
52+
53+
```bash
54+
kubectl port-forward svc/kotsadm-minio <port>:<port>
55+
```
56+
57+
And go to http://localhost:<port> to browse the object storage.
58+
59+
The username is `admin` and the password is the secretkey in `kotsadm-minio` secret.
60+
61+
![minio-ui](img/minio-ui.png)

applications/fake-services/app/Chart.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ dependencies:
66
repository: oci://registry.replicated.com/library
77
version: 1.0.0-beta.31
88
digest: sha256:c349fc2fe99276ed430877ef2a0cf0e05150cd27f6e4eae2d7bfe47733f64846
9-
generated: "2024-11-27T11:01:55.491515+11:00"
9+
generated: "2025-02-04T08:53:26.530341+11:00"

applications/fake-services/app/templates/_helpers.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ Backend service name
7070
backend-service
7171
{{- end }}
7272

73+
{{/*
74+
Rqlite UI service name
75+
*/}}
76+
{{- define "fake-service.rqliteui.name" -}}
77+
rqlite-ui-service
78+
{{- end }}
79+
80+
{{/*
81+
Rqlite UI labels selector
82+
*/}}
83+
{{- define "fake-service.rqliteui.selectorLabels" -}}
84+
app.kubernetes.io/name: {{ include "fake-service.name" . }}-rqliteui
85+
{{- end }}
86+
87+
{{/*
88+
Minio UI labels selector
89+
*/}}
90+
{{- define "fake-service.minioui.selectorLabels" -}}
91+
app.kubernetes.io/name: {{ include "fake-service.name" . }}-minioui
92+
{{- end }}
7393

7494
{{/*
7595
Image Pull Secrets

applications/fake-services/app/templates/backend-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: backend
4+
name: {{ quote (printf "%s-backend" (include "fake-service.fullname" .)) }}
55
labels:
66
{{- include "fake-service.labels" . | nindent 4 }}
77
spec:

applications/fake-services/app/templates/frontend-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: frontend
4+
name: {{ quote (printf "%s-frontend" (include "fake-service.fullname" .)) }}
55
labels:
66
{{- include "fake-service.labels" . | nindent 4 }}
77
spec:
@@ -33,4 +33,4 @@ spec:
3333
- name: LOG_LEVEL
3434
value: "{{ .Values.frontend.logLevel }}"
3535
- name: UPSTREAM_URIS
36-
value: "http://{{ include "fake-service.backend.name" . }}.{{ .Release.Namespace }}"
36+
value: "http://{{ include "fake-service.backend.name" . }}.{{ .Release.Namespace }}"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ quote (printf "%s-minio-ui" (include "fake-service.fullname" .)) }}
5+
labels:
6+
{{- include "fake-service.labels" . | nindent 4 }}
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
{{- include "fake-service.minioui.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
labels:
15+
{{- include "fake-service.minioui.selectorLabels" . | nindent 8 }}
16+
spec:
17+
initContainers:
18+
- name: setup-minio-ui
19+
image: minio/minio
20+
env:
21+
- name: MINIO_ACCESS_KEY
22+
valueFrom:
23+
secretKeyRef:
24+
name: kotsadm-minio
25+
key: accesskey
26+
- name: MINIO_SECRET_KEY
27+
valueFrom:
28+
secretKeyRef:
29+
name: kotsadm-minio
30+
key: secretkey
31+
command:
32+
- /bin/sh
33+
- -c
34+
- |
35+
mc alias set myminio http://kotsadm-minio:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
36+
echo "Creating Minio Console Admin User..."
37+
mc admin user add myminio admin $MINIO_SECRET_KEY
38+
echo "Attaching IAM policy..."
39+
mc admin policy attach myminio consoleAdmin --user admin
40+
containers:
41+
- name: minio-ui
42+
image: alpine
43+
command:
44+
- /bin/sh
45+
- -c
46+
- |
47+
echo "Check WebUI port in kotsadm-minio pod logs and port forward to it to browse the Minio UI"
48+
echo "e.g. kubectl port-forward svc/kotsadm-minio 33655:33655"
49+
echo "username: admin, password: set to secretkey in kotsadm-minio secret"
50+
sleep infinity
51+
restartPolicy: Always
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ quote (printf "%s-rqlite-ui" (include "fake-service.fullname" .)) }}
5+
labels:
6+
{{- include "fake-service.labels" . | nindent 4 }}
7+
spec:
8+
selector:
9+
matchLabels:
10+
{{- include "fake-service.rqliteui.selectorLabels" . | nindent 6 }}
11+
template:
12+
metadata:
13+
labels:
14+
{{- include "fake-service.rqliteui.selectorLabels" . | nindent 8 }}
15+
spec:
16+
{{- include "helpers.imagePullSecrets" . | nindent 6 }}
17+
containers:
18+
- name: rqliteui
19+
image: {{ .Values.rqliteui.image.registry }}/{{ .Values.rqliteui.image.repository }}:{{ .Values.rqliteui.image.tag }}
20+
env:
21+
- name: RQLITE_HOST
22+
valueFrom:
23+
secretKeyRef:
24+
key: uri
25+
name: kotsadm-rqlite
26+
- name: RQLITE_USERNAME
27+
value: kotsadm
28+
- name: RQLITE_PASSWORD
29+
valueFrom:
30+
secretKeyRef:
31+
key: password
32+
name: kotsadm-rqlite
33+
ports:
34+
- name: rqliteui
35+
containerPort: 3000
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "fake-service.rqliteui.name" . }}
5+
labels: {{- include "fake-service.labels" . | nindent 4 }}
6+
spec:
7+
type: ClusterIP
8+
ports:
9+
- port: 80
10+
targetPort: rqliteui
11+
protocol: TCP
12+
name: rqliteui
13+
selector:
14+
{{- include "fake-service.rqliteui.selectorLabels" . | nindent 4 }}
15+

applications/fake-services/app/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,14 @@ ingress-nginx:
4343
http: 30080
4444
ingressClassResource:
4545
default: true
46+
47+
rqliteui:
48+
image:
49+
registry: docker.io
50+
repository: gerardnguyen/rqman
51+
tag: 0.0.3
52+
pullPolicy: IfNotPresent
53+
imagePullSecrets: []
54+
55+
cert-manager:
56+
enabled: true

0 commit comments

Comments
 (0)