Skip to content

Commit dfdab20

Browse files
authored
Merge pull request #6 from SUSE/develop
Merge from develop #4 and #5
2 parents 33248e8 + d81476d commit dfdab20

File tree

226 files changed

+22001
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+22001
-19
lines changed

.github/workflows/ci.yml

+54-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,33 @@ concurrency:
1616
group: "${{ github.ref }}-${{ github.workflow }}"
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
pull-requests: write
22+
1923
jobs:
20-
code-check:
24+
changes:
2125
runs-on: ubuntu-latest
26+
permissions:
27+
pull-requests: read
28+
outputs:
29+
apps: ${{ steps.filter.outputs.changes }}
2230
steps:
2331
- name: Check-out the repository
2432
uses: actions/checkout@v4
33+
- uses: dorny/paths-filter@v3
34+
id: filter
35+
with:
36+
base: ${{ github.ref }}
37+
filters: |
38+
game-2048: src/game-2048/**
39+
cow-demo: src/cow-demo/**
40+
rancher-helloworld: src/rancher-helloworld/**
41+
code-check:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout source code
45+
uses: actions/checkout@v4
2546
with:
2647
# gets all history for all branches and tags (mandatory for chart-testing to work, see https://github.com/helm/chart-testing/issues/186)
2748
fetch-depth: 0
@@ -60,3 +81,35 @@ jobs:
6081
- name: Run chart-testing (lint)
6182
if: steps.list-changed.outputs.changed == 'true'
6283
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
84+
image-scan:
85+
needs: changes
86+
if: needs.changes.outputs.apps != '[]'
87+
strategy:
88+
matrix:
89+
app: ${{ fromJSON(needs.changes.outputs.apps) }}
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout source code
93+
uses: actions/checkout@v4
94+
- name: Login to Docker Hub
95+
uses: docker/login-action@v3
96+
with:
97+
username: ${{ secrets.DOCKERHUB_USERNAME }}
98+
password: ${{ secrets.DOCKERHUB_TOKEN }}
99+
- name: Build container image from source
100+
run: |
101+
cd src/${{ matrix.app }}
102+
docker build . --tag $CONTAINER_REGITRY_DOMAIN/$IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
103+
- name: Scan container image with NeuVector
104+
if: ${{ vars.USE_NEUVECTOR == 'true' }}
105+
uses: neuvector/scan-action@main
106+
with:
107+
image-repository: ${{ env.CONTAINER_REGITRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}
108+
image-tag: ${{ env.IMAGE_TAG }}
109+
min-high-cves-to-fail: "1"
110+
min-medium-cves-to-fail: "1"
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
CONTAINER_REGITRY_DOMAIN: docker.io
114+
IMAGE_FOLDER: ${{ vars.DOCKERHUB_NAMESPACE }}
115+
IMAGE_TAG: 1.0.${{ github.run_id }}

.github/workflows/pkg.yml

+49
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ permissions:
1111
id-token: write
1212

1313
jobs:
14+
changes:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
pull-requests: read
18+
outputs:
19+
apps: ${{ steps.filter.outputs.changes }}
20+
steps:
21+
- name: Check-out the repository
22+
uses: actions/checkout@v4
23+
- uses: dorny/paths-filter@v3
24+
id: filter
25+
with:
26+
base: ${{ github.ref }}
27+
filters: |
28+
game-2048: src/game-2048/**
29+
cow-demo: src/cow-demo/**
30+
rancher-helloworld: src/rancher-helloworld/**
1431
build:
1532
runs-on: ubuntu-latest
1633
steps:
@@ -32,6 +49,8 @@ jobs:
3249
helm repo update
3350
- name: Host charts repository on GitHub Pages
3451
uses: helm/[email protected]
52+
with:
53+
skip_existing: true
3554
env:
3655
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3756
- name: Checkout gh-pages branch
@@ -63,3 +82,33 @@ jobs:
6382
- name: Deploy to GitHub Pages
6483
id: deployment
6584
uses: actions/deploy-pages@v1
85+
create-image:
86+
if: needs.changes.outputs.apps != '[]'
87+
strategy:
88+
matrix:
89+
app: ${{ fromJSON(needs.changes.outputs.apps) }}
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout source code
93+
uses: actions/checkout@v4
94+
- name: Login to container registry
95+
uses: docker/login-action@v3
96+
with:
97+
registry: ${{ env.CONTAINER_REGITRY_DOMAIN }}
98+
username: ${{ secrets.DOCKERHUB_USERNAME }}
99+
password: ${{ secrets.DOCKERHUB_TOKEN }}
100+
- name: Build container image
101+
run: |
102+
cd src/${{ matrix.app }}
103+
docker build . --tag $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
104+
- name: Push image to container registry
105+
run: docker push $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
106+
- name: Push latest tag to container registry
107+
if: ${{ github.ref_name == 'main' }}
108+
run: |
109+
docker tag $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }} $IMAGE_FOLDER/${{ matrix.app }}:latest
110+
docker push $IMAGE_FOLDER/${{ matrix.app }}:latest
111+
env:
112+
CONTAINER_REGITRY_DOMAIN: docker.io
113+
IMAGE_FOLDER: ${{ vars.DOCKERHUB_NAMESPACE }}
114+
IMAGE_TAG: 1.0.${GITHUB_RUN_ID}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
temp*.yaml
66
temp.sh
77
/charts/temp/
8-
values_*.y*ml
8+
values_mine.y*ml
9+
.sass-cache/

CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Contribution guide
2+
3+
## Code lifecycle
4+
5+
This git repository follows the Gitflow pattern, so make sure to follow the convention.
6+
7+
For instance, create a branch `feature/my-change-title` from `develop`, once good enough to be shared and reviewed create a Pull Request targetting `develop`.
8+
9+
## Code convention
10+
11+
For bash/shell script files, follow the conventions from [Google Style Guide](https://google.github.io/styleguide/shellguide.html).

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Welcome! You'll find in this repository some open-source material to setup a lab environment.
66

7-
It is used internally at SUSE (the goal being to capitalize and factorize), but is open to everyone. Feel free to contribute and share feedback!
7+
It is used internally at SUSE but is open to everyone. Feel free to [contribute](CONTRIBUTING.md) and share feedback!
88

99
## Getting started
1010

@@ -32,7 +32,7 @@ Browse the [catalog of functions](scripts/README.md#shell-functions) and [concre
3232
Add Helm repository:
3333

3434
```bash
35-
helm repo add suse-lab-setup https://suse.github.io/lab-setup
35+
helm repo add suse-lab-setup https://opensource.suse.com/lab-setup
3636
helm repo update
3737
```
3838

charts/README.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@
55
* [Cow Demo](cow-demo/README.md)
66
* [Game 2048](game-2048/README.md)
77
* [Let's Encrypt](letsencrypt/README.md)
8+
* [NFS-Ganesha](nfs-ganesha/README.md)
9+
* [Rancher Cluster Template](rancher-cluster-templates/README.md)
810
* [WordPress](wordpress/README.md)
911

1012
## Developer's guide
1113

14+
From within a chart directory:
15+
1216
```bash
1317
# lints a chart
14-
helm lint .
18+
helm lint
19+
20+
# generates the manifest file from a chart (for review/comparison)
21+
helm template <releasename> . -f values.yaml -f values_mine.yaml --namespace demo > temp.yaml
1522

16-
# creates Kubernetes template file from chart (for review/comparison)
17-
helm template myname . -f values.yaml --namespace demo > temp.yaml
23+
# installs a chart from local source
24+
helm upgrade --install <releasename> . -f values.yaml \
25+
# --debug > output.yaml \
26+
--create-namespace --namespace nfs-ganesha
1827
```

charts/cow-demo/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: cow-demo
33
description: Helm chart for Cow Demo Application
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: "2.0.0"
77
home: https://github.com/SUSE/lab-setup/tree/main/charts/cow-demo
88
maintainers:

charts/cow-demo/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Install the app with default settings:
88

99
```bash
1010
# adds the repo
11-
helm repo add devpro https://devpro.github.io/helm-charts
11+
helm repo add suse-lab-setup https://opensource.suse.com/lab-setup
1212
helm repo update
1313

1414
# installs the chart
15-
helm upgrade --install cow-demo devpro/cow-demo --namespace demo --create-namespace
15+
helm upgrade --install cow-demo suse-lab-setup/cow-demo --namespace demo --create-namespace
1616
```
1717

1818
Look at [values.yaml](values.yaml) for the configuration.

charts/game-2048/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: game-2048
33
description: Helm chart for Game 2048
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: "1.0.0"
77
home: https://github.com/SUSE/lab-setup/tree/main/charts/game-2048
88
maintainers:

charts/game-2048/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Install the app with default settings:
88

99
```bash
1010
# adds the repo
11-
helm repo add devpro https://devpro.github.io/helm-charts
11+
helm repo add suse-lab-setup https://opensource.suse.com/lab-setup
1212
helm repo update
1313

1414
# installs the chart
15-
helm upgrade --install game-2048 devpro/game-2048 --namespace demo --create-namespace
15+
helm upgrade --install game-2048 suse-lab-setup/game-2048 --namespace demo --create-namespace
1616
```
1717

1818
Look at [values.yaml](values.yaml) for the configuration.

charts/letsencrypt/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: letsencrypt
33
description: Helm chart for managing Let's Encrypt
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: "1.0.0"
77
home: https://github.com/SUSE/lab-setup/tree/main/charts/letsencrypt
88
maintainers:

charts/letsencrypt/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Install the app with minimal settings:
1010

1111
```bash
1212
# adds the repo
13-
helm repo add devpro https://devpro.github.io/helm-charts
13+
helm repo add suse-lab-setup https://opensource.suse.com/lab-setup
1414
helm repo update
1515

1616
# installs the chart (this examples assumes NGINX Ingress Controller is installed)
17-
helm upgrade --install letsencrypt devpro/letsencrypt \
17+
helm upgrade --install letsencrypt suse-lab-setup/letsencrypt \
1818
--namespace cert-manager \
1919
2020
--set ingress.className=nginx

charts/nfs-ganesha/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/nfs-ganesha/Chart.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: nfs-ganesha
3+
description: Helm chart for managing NFS-Ganesha
4+
type: application
5+
version: "0.1.0"
6+
appVersion: "1.0.0"
7+
dependencies: []
8+
home: https://github.com/SUSE/lab-setup/tree/main/charts/nfs-ganesha
9+
maintainers:
10+
- name: devpro
11+

charts/nfs-ganesha/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# NFS-Ganesha Helm Chart
2+
3+
This Helm chart will install [NFS-Ganesha](https://nfs-ganesha.github.io/) on a Kubernetes cluster.
4+
5+
## Quick start
6+
7+
Install the app with minimal settings:
8+
9+
```bash
10+
# adds the repo
11+
helm repo add suse-lab-setup https://opensource.suse.com/lab-setup
12+
helm repo update
13+
14+
# installs the chart with default parameters
15+
helm upgrade --install nfs-ganesha suse-lab-setup/nfs-ganesha --create-namespace --namespace nfs-ganesha
16+
```
17+
18+
Clean-up:
19+
20+
```bash
21+
helm delete nfs-ganesha -n nfs-ganesha
22+
kubectl delete ns nfs-ganesha
23+
```

charts/nfs-ganesha/templates/NOTES.txt

Whitespace-only changes.

charts/nfs-ganesha/templates/_helpers.tpl

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
labels:
6+
app: {{ .Values.name }}
7+
name: {{ .Values.name }}
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: {{ .Values.name }}
13+
template:
14+
metadata:
15+
labels:
16+
app: nfs-ganesha
17+
spec:
18+
containers:
19+
- name: container-0
20+
image: {{ .Values.image }}:{{ .Values.tag }}
21+
imagePullPolicy: Always
22+
ports:
23+
- containerPort: 2049
24+
name: nfsv4
25+
protocol: TCP
26+
securityContext:
27+
capabilities:
28+
add:
29+
- NET_ADMIN
30+
- DAC_READ_SEARCH
31+
privileged: true
32+
volumeMounts:
33+
- mountPath: /data/nfs
34+
name: share
35+
dnsPolicy: ClusterFirst
36+
restartPolicy: Always
37+
volumes:
38+
- emptyDir: {}
39+
name: share

0 commit comments

Comments
 (0)