Skip to content

Commit 46514ea

Browse files
Merge pull request #6 from eyenx/feat/add-initial-chart
feat(Chart): initial testing
2 parents 6391c08 + e9e2715 commit 46514ea

11 files changed

Lines changed: 275 additions & 68 deletions

File tree

.github/ct.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
charts:
2+
- charts/cloudscale-slb-controller
3+
validate-maintainers: false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Lint & Install Helm Charts
2+
on: pull_request
3+
jobs:
4+
lint-test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v3
9+
with:
10+
fetch-depth: 0
11+
12+
- name: Build & save image
13+
run: |
14+
docker build -t cloudscale-slb-controller:latest -f Dockerfile .
15+
docker save -o /tmp/cloudscale-slb-controller.tar cloudscale-slb-controller:latest
16+
17+
- name: Set up Helm
18+
uses: azure/setup-helm@v2.1
19+
with:
20+
version: v3.7.0
21+
22+
- uses: actions/setup-python@v3
23+
with:
24+
python-version: 3.7
25+
26+
- name: Set up chart-testing
27+
uses: helm/chart-testing-action@v2.2.1
28+
29+
- name: Run chart-testing (lint)
30+
run: ct --config .github/ct.yaml lint
31+
32+
- name: Create kind cluster
33+
uses: helm/kind-action@v1.2.0
34+
with:
35+
node_image: kindest/node:v1.23.6
36+
37+
- name: Load container image
38+
run: |
39+
kind load image-archive /tmp/cloudscale-slb-controller.tar --name chart-testing
40+
41+
- name: Run chart-testing (install)
42+
run: ct --config .github/ct.yaml install

.github/workflows/lint-and-test.yaml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,6 @@ jobs:
1515
- name: Run pre-commit
1616
uses: pre-commit/action@v2.0.3
1717

18-
golangci-lint:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v3
23-
24-
- name: Set up Go
25-
uses: actions/setup-go@v3
26-
with:
27-
go-version: 1.17.x
28-
29-
# - name: Run GolangCI-Lint
30-
# uses: golangci/golangci-lint-action@v3
31-
# with:
32-
# args: --timeout 3m
33-
3418
test:
3519
runs-on: ubuntu-latest
3620
steps:
@@ -46,29 +30,3 @@ jobs:
4630
- name: Test build
4731
id: docker_build
4832
uses: docker/build-push-action@v2
49-
50-
# - name: Set up Go
51-
# uses: actions/setup-go@v3
52-
# with:
53-
# go-version: 1.17.x
54-
# - name: Build App
55-
# run: go build -v ./...
56-
# - name: Test App
57-
# run: go test -v ./...
58-
59-
# goreleaser:
60-
# runs-on: ubuntu-latest
61-
# steps:
62-
# - name: Checkout
63-
# uses: actions/checkout@v3
64-
# - name: Set up Go
65-
# uses: actions/setup-go@v3
66-
# with:
67-
# go-version: 1.17.x
68-
# - name: Run GoReleaser
69-
# uses: goreleaser/goreleaser-action@v2.9.1
70-
# with:
71-
# version: latest
72-
# args: --snapshot --skip-publish --rm-dist
73-
# env:
74-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,3 @@ jobs:
7171
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
7272
org.opencontainers.image.revision=${{ github.sha }}
7373
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
74-
75-
# goreleaser:
76-
# runs-on: ubuntu-latest
77-
# steps:
78-
# - name: Checkout
79-
# uses: actions/checkout@v3
80-
# with:
81-
# fetch-depth: 0
82-
# - name: Set up Go
83-
# uses: actions/setup-go@v3
84-
# with:
85-
# go-version: 1.17.x
86-
# - name: Login to GitHub Container Registry
87-
# uses: docker/login-action@v1
88-
# if: github.event_name != 'pull_request'
89-
# with:
90-
# registry: ghcr.io
91-
# username: ${{ github.actor }}
92-
# password: ${{ secrets.GITHUB_TOKEN }}
93-
# - name: Run GoReleaser
94-
# uses: goreleaser/goreleaser-action@v2.9.1
95-
# with:
96-
# version: latest
97-
# args: release --rm-dist
98-
# env:
99-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
apiVersion: v2
3+
name: cloudscale-slb-controller
4+
description: Kubernetes service load-balancer-controller for cloudscale resources
5+
type: application
6+
version: 0.2.0
7+
appVersion: v0.2.0
8+
sources:
9+
- https://github.com/linkyard/cloudscale-slb-controller.git
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# cloudscale-slb-controller
2+
3+
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.2.0](https://img.shields.io/badge/AppVersion-v0.2.0-informational?style=flat-square)
4+
5+
Kubernetes service load-balancer-controller for cloudscale resources
6+
7+
## Source Code
8+
9+
* <https://github.com/linkyard/cloudscale-slb-controller.git>
10+
11+
## Values
12+
13+
| Key | Type | Default | Description |
14+
|-----|------|---------|-------------|
15+
| cloudscale.token | object | `{"value":"SECRET"}` | cloudscale token to use |
16+
| controller.controllerId | string | `""` | controllerID to use |
17+
| controller.cpuRequests | string | `"250m"` | cpu requests for controller |
18+
| controller.image | object | `{"pullPolicy":"IfNotPresent","repository":"ghcr.io/linkyard/cloudscale-slb-controller","tag":""}` | controller image to use |
19+
| controller.ipLimit | string | `"10"` | ipLimit for controller |
20+
| controller.logLevel | string | `"Info"` | loglevel for controller |
21+
| controller.memoryRequests | string | `"128Mi"` | memory requests for controller |
22+
23+
----------------------------------------------
24+
Autogenerated from chart metadata using [helm-docs v1.10.0](https://github.com/norwoodj/helm-docs/releases/v1.10.0)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
controller:
2+
image:
3+
repository: cloudscale-slb-controller
4+
tag: latest
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ .Release.Name }}
6+
labels:
7+
app: cloudscale-slb-controller
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: cloudscale-slb-controller
13+
template:
14+
metadata:
15+
labels:
16+
app: cloudscale-slb-controller
17+
spec:
18+
affinity:
19+
podAntiAffinity:
20+
preferredDuringSchedulingIgnoredDuringExecution:
21+
- weight: 100
22+
podAffinityTerm:
23+
labelSelector:
24+
matchExpressions:
25+
- key: app
26+
operator: In
27+
values:
28+
- cloudscale-slb-controller
29+
topologyKey: kubernetes.io/hostname
30+
serviceAccountName: {{ .Release.Name }}-sa
31+
hostNetwork: true
32+
containers:
33+
- name: cloudscale-slb-controller
34+
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag | default .Chart.AppVersion }}"
35+
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
36+
securityContext:
37+
privileged: true
38+
env:
39+
- name: CLOUDSCALE_TOKEN
40+
valueFrom:
41+
secretKeyRef:
42+
{{- if .Values.cloudscale.token.existingSecret }}
43+
name: {{.Values.cloudscale.token.existingSecret }}
44+
{{- else }}
45+
name: {{ .Release.Name }}-cloudscale-token
46+
key: token
47+
{{- end }}
48+
- name: IP_LIMIT
49+
value: {{ default "5" .Values.controller.ipLimit | quote }}
50+
- name: LOG_LEVEL
51+
value: {{ default "Debug" .Values.controller.logLevel | quote }}
52+
- name: CONTROLLER_ID
53+
value: {{ default "" .Values.controller.controllerId | quote }}
54+
- name: LEADER_ELECTION_CONFIGMAP
55+
value: cloudscale-slb-controller-{{ .Release.Name }}-election
56+
- name: LEADER_ELECTION_NAMESPACE
57+
valueFrom:
58+
fieldRef:
59+
fieldPath: metadata.namespace
60+
- name: LEADER_ELECTION_NODE
61+
valueFrom:
62+
fieldRef:
63+
fieldPath: metadata.name
64+
resources:
65+
requests:
66+
cpu: {{ default "250m" .Values.controller.cpuRequests }}
67+
memory: {{ default "128Mi" .Values.controller.memoryRequests }}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
labels:
6+
app: cloudscale-slb-controller
7+
name: {{ .Release.Name }}-sa
8+
9+
---
10+
11+
apiVersion: rbac.authorization.k8s.io/v1
12+
kind: ClusterRole
13+
metadata:
14+
labels:
15+
app: cloudscale-slb-controller
16+
name: {{ .Release.Name }}-cr
17+
rules:
18+
- apiGroups:
19+
- ""
20+
resources:
21+
- services
22+
- endpoints
23+
verbs:
24+
- get
25+
- list
26+
- watch
27+
- apiGroups:
28+
- ""
29+
resources:
30+
- events
31+
verbs:
32+
- get
33+
- create
34+
- patch
35+
- update
36+
- apiGroups:
37+
- ""
38+
resources:
39+
- services/status
40+
verbs:
41+
- update
42+
43+
---
44+
45+
apiVersion: rbac.authorization.k8s.io/v1
46+
kind: ClusterRoleBinding
47+
metadata:
48+
labels:
49+
app: cloudscale-slb-controller
50+
name: {{ .Release.Name }}-binding
51+
roleRef:
52+
apiGroup: rbac.authorization.k8s.io
53+
kind: ClusterRole
54+
name: {{ .Release.Name }}-cr
55+
subjects:
56+
- kind: ServiceAccount
57+
name: {{ .Release.Name }}-sa
58+
namespace: {{ .Release.Namespace }}
59+
60+
---
61+
62+
apiVersion: rbac.authorization.k8s.io/v1
63+
kind: Role
64+
metadata:
65+
labels:
66+
app: cloudscale-slb-controller
67+
name: {{ .Release.Name }}-role
68+
rules:
69+
- apiGroups:
70+
- ""
71+
resources:
72+
- configmaps
73+
verbs:
74+
- get
75+
- create
76+
- patch
77+
- update
78+
79+
---
80+
81+
apiVersion: rbac.authorization.k8s.io/v1
82+
kind: RoleBinding
83+
metadata:
84+
labels:
85+
app: cloudscale-slb-controller
86+
name: {{ .Release.Name }}-binding
87+
roleRef:
88+
apiGroup: rbac.authorization.k8s.io
89+
kind: Role
90+
name: {{ .Release.Name }}-role
91+
subjects:
92+
- kind: ServiceAccount
93+
name: {{ .Release.Name }}-sa
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if not .Values.cloudscale.token.existingSecret }}
2+
---
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ .Release.Name }}-cloudscale-token
7+
type: Opaque
8+
data:
9+
token: {{ required "cloudscale.token.value is required" .Values.cloudscale.token.value | b64enc | quote }}
10+
{{- end }}

0 commit comments

Comments
 (0)