Skip to content

Commit 88eec94

Browse files
committed
demo ready, doc to be completed
1 parent 3a5ba64 commit 88eec94

20 files changed

+418
-36
lines changed

.github/workflows/build.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ on:
1111
branches: ['main', 'master']
1212

1313
jobs:
14-
lint:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v3
14+
# lint:
15+
# runs-on: ubuntu-latest
16+
# steps:
17+
# - name: Checkout repository
18+
# uses: actions/checkout@v3
1919

20-
- name: Run golangci-lint
21-
uses: reviewdog/action-golangci-lint@v2
22-
with:
23-
go_version: "1.24.3"
24-
golangci_lint_flags: "--timeout=5m0s"
20+
# - name: Run golangci-lint
21+
# uses: reviewdog/action-golangci-lint@v2
22+
# with:
23+
# go_version: "1.24.3"
24+
# golangci_lint_flags: "--timeout=5m0s"
2525
build:
2626
runs-on: ubuntu-latest
2727
needs: lint

.github/workflows/release.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,18 @@ jobs:
9595

9696
- name: Set up Helm
9797
uses: azure/setup-helm@v4
98+
- name: Setup yq
99+
uses: mikefarah/yq@v4
98100
- name: Log in to GitHub Container Registry
99101
run: |
100102
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
101103
- name: Prepare and package Helm chart
102104
run: |
103105
CLEAN_VERSION=$(echo "$RELEASE_VERSION" | sed 's/^v//')
104106
echo "Using chart version and appVersion: $CLEAN_VERSION"
105-
sed -i "s/^version:.*/version: ${CLEAN_VERSION}/" ./helm/Chart.yaml
106-
sed -i "s/^appVersion:.*/appVersion: ${CLEAN_VERSION}/" ./helm/Chart.yaml
107+
yq -i ".image.tag = \"${RELEASE_VERSION}\"" values.yaml
108+
yq -i ".version = \"${CLEAN_VERSION}\"" ./helm/Chart.yaml
109+
yq -i ".appVersion = \"${CLEAN_VERSION}\"" ./helm/Chart.yaml
107110
helm package ./helm -d .
108111
- name: Push Helm chart to GHCR
109112
run: |

fluxcd-demo/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Fluxcd Demo
2+
3+
doc to be finished
4+
5+
6+
docker run -d -p 5000:5000 --restart=always --name registry-5000 registry:2
7+
kind create cluster --config kind-cluster.yaml
8+
9+
10+
kubectl apply -f https://github.com/fluxcd/flux2/releases/download/v2.7.2/install.yaml
11+
12+
update chart version
13+
helm package ./helm -d .
14+
helm push ./fluxcd-demo-0.0.1-dev.tgz oci://localhost:5000/fluxcd/
15+
kubectl get helmreleases
16+
17+
18+
kind delete cluster

fluxcd-demo/fluxcd-helmconfig.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: source.toolkit.fluxcd.io/v1
2+
kind: HelmRepository
3+
metadata:
4+
name: demo-repo
5+
namespace: default
6+
spec:
7+
type: "oci"
8+
insecure: true
9+
interval: 10s
10+
url: oci://host.docker.internal:5000/fluxcd
11+
---
12+
apiVersion: helm.toolkit.fluxcd.io/v2
13+
kind: HelmRelease
14+
metadata:
15+
name: demo-release
16+
namespace: default
17+
spec:
18+
interval: 10s
19+
timeout: 5m
20+
chart:
21+
spec:
22+
chart: fluxcd-demo
23+
version: '0.0.x-dev'
24+
sourceRef:
25+
kind: HelmRepository
26+
name: demo-repo
27+
interval: 1m
28+
releaseName: myhelmrelease
29+
# valuesFrom:
30+
# - kind: ConfigMap
31+
# name: tests
32+
# valuesKey: test-cases.yaml
33+
# targetPath: testFile

fluxcd-demo/helm/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
description: fluxcd-demo
3+
name: fluxcd-demo
4+
version: 0.0.1-dev
5+
appVersion: 0.0.1-dev
6+
dependencies:
7+
- name: netassert
8+
repository: ghcr.io/controlplaneio/charts/netassert
9+
version: 1.0.0-dev
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "fluxcd-demo.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "fluxcd-demo.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "fluxcd-demo.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: echoserver
6+
---
7+
apiVersion: v1
8+
kind: Namespace
9+
metadata:
10+
name: busybox
11+
---
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
metadata:
15+
name: {{ template "fluxcd-demo.fullname" . }}-echoserver
16+
namespace: echoserver
17+
labels:
18+
app: echoserver-deploy
19+
spec:
20+
replicas: 1
21+
selector:
22+
matchLabels:
23+
app: echoserver
24+
template:
25+
metadata:
26+
labels:
27+
app: echoserver
28+
spec:
29+
initContainers:
30+
- name: "sleepy"
31+
image: busybox:1.36
32+
command: ["sh", "-c", "echo 'Sleeping...'; sleep 20"]
33+
containers:
34+
- name: echoserver
35+
image: k8s.gcr.io/e2e-test-images/echoserver:2.5
36+
imagePullPolicy: IfNotPresent
37+
ports:
38+
- containerPort: 8080
39+
name: web
40+
resources:
41+
requests:
42+
memory: 64Mi
43+
cpu: 300m
44+
limits:
45+
memory: 64Mi
46+
cpu: 400m
47+
securityContext:
48+
allowPrivilegeEscalation: false
49+
privileged: false
50+
---
51+
apiVersion: apps/v1
52+
kind: Deployment
53+
metadata:
54+
name: {{ template "fluxcd-demo.fullname" . }}-busybox
55+
namespace: busybox
56+
labels:
57+
app: busybox
58+
spec:
59+
replicas: 1
60+
selector:
61+
matchLabels:
62+
app: busybox
63+
template:
64+
metadata:
65+
labels:
66+
app: busybox
67+
spec:
68+
containers:
69+
- name: busybox
70+
image: busybox
71+
command:
72+
- sleep
73+
- "360000"
74+
imagePullPolicy: IfNotPresent
75+
resources:
76+
requests:
77+
memory: 64Mi
78+
cpu: 300m
79+
limits:
80+
memory: 64Mi
81+
cpu: 400m
82+
securityContext:
83+
allowPrivilegeEscalation: false
84+
privileged: false
85+
...
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
---
3+
apiVersion: v1
4+
kind: Namespace
5+
metadata:
6+
name: pod1
7+
---
8+
apiVersion: v1
9+
kind: Namespace
10+
metadata:
11+
name: pod2
12+
---
13+
apiVersion: v1
14+
kind: Pod
15+
metadata:
16+
name: {{ template "fluxcd-demo.fullname" . }}-pod2
17+
namespace: pod2
18+
spec:
19+
containers:
20+
- name: webserver
21+
image: nginx:latest
22+
ports:
23+
- containerPort: 80
24+
---
25+
apiVersion: v1
26+
kind: Pod
27+
metadata:
28+
name: {{ template "fluxcd-demo.fullname" . }}-pod1
29+
namespace: pod1
30+
spec:
31+
containers:
32+
- name: busybox
33+
image: busybox
34+
command:
35+
- sleep
36+
- "360000"
37+
imagePullPolicy: IfNotPresent
38+
resources:
39+
requests:
40+
memory: 64Mi
41+
cpu: 300m
42+
limits:
43+
memory: 64Mi
44+
cpu: 400m
45+
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
apiVersion: v1
2+
data:
3+
test.yaml: |
4+
---
5+
- name: busybox-deploy-to-echoserver-deploy
6+
type: k8s
7+
protocol: tcp
8+
targetPort: 8080
9+
timeoutSeconds: 67
10+
attempts: 3
11+
exitCode: 0
12+
src:
13+
k8sResource:
14+
kind: deployment
15+
name: {{ template "fluxcd-demo.fullname" . }}-busybox
16+
namespace: busybox
17+
dst:
18+
k8sResource:
19+
kind: deployment
20+
name: {{ template "fluxcd-demo.fullname" . }}-echoserver
21+
namespace: echoserver
22+
######
23+
######
24+
- name: busybox-deploy-to-echoserver-deploy-2
25+
type: k8s
26+
protocol: udp
27+
targetPort: 53
28+
timeoutSeconds: 67
29+
attempts: 1
30+
exitCode: 0
31+
src:
32+
k8sResource:
33+
kind: deployment
34+
name: {{ template "fluxcd-demo.fullname" . }}-busybox
35+
namespace: busybox
36+
dst:
37+
k8sResource:
38+
kind: deployment
39+
name: {{ template "fluxcd-demo.fullname" . }}-echoserver
40+
namespace: echoserver
41+
########
42+
#########
43+
#######
44+
######
45+
- name: busybox-deploy-to-web-statefulset
46+
type: k8s
47+
protocol: tcp
48+
targetPort: 80
49+
timeoutSeconds: 67
50+
attempts: 3
51+
exitCode: 0
52+
src:
53+
k8sResource: # this is type endpoint
54+
kind: deployment
55+
name: {{ template "fluxcd-demo.fullname" . }}-busybox
56+
namespace: busybox
57+
dst:
58+
k8sResource: ## this is type endpoint
59+
kind: statefulset
60+
name: {{ template "fluxcd-demo.fullname" . }}-web
61+
namespace: web
62+
###
63+
####
64+
- name: busybox-deploy-to-control-plane-dot-io
65+
type: k8s
66+
protocol: tcp
67+
targetPort: 80
68+
timeoutSeconds: 67
69+
attempts: 3
70+
exitCode: 0
71+
src:
72+
k8sResource: # type endpoint
73+
kind: deployment
74+
name: {{ template "fluxcd-demo.fullname" . }}-busybox
75+
namespace: busybox
76+
dst:
77+
host: # type host or node or machine
78+
name: control-plane.io
79+
###
80+
###
81+
- name: test-from-pod1-to-pod2
82+
type: k8s
83+
protocol: tcp
84+
targetPort: 80
85+
timeoutSeconds: 67
86+
attempts: 3
87+
exitCode: 0
88+
src:
89+
k8sResource: ##
90+
kind: pod
91+
name: {{ template "fluxcd-demo.fullname" . }}-pod1
92+
namespace: pod1
93+
dst:
94+
k8sResource:
95+
kind: pod
96+
name: {{ template "fluxcd-demo.fullname" . }}-pod2
97+
namespace: pod2
98+
###
99+
###
100+
- name: busybox-deploy-to-fake-host
101+
type: k8s
102+
protocol: tcp
103+
targetPort: 333
104+
timeoutSeconds: 67
105+
attempts: 3
106+
exitCode: 1
107+
src:
108+
k8sResource: # type endpoint
109+
kind: deployment
110+
name: {{ template "fluxcd-demo.fullname" . }}-busybox
111+
namespace: busybox
112+
dst:
113+
host: # type host or node or machine
114+
name: 0.0.0.0
115+
kind: ConfigMap
116+
metadata:
117+
name: "{{ .Release.Name }}-netassert"

0 commit comments

Comments
 (0)