Skip to content

Commit d91bc52

Browse files
authored
Introduce cozy-proxy (#615)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a new proxy component to enhance deployment orchestration and dependency management. - Introduced dynamic update capabilities for fetching and deploying the latest assets. - Enabled configurable settings for container images, networking, and access control. - Incorporated streamlined resource naming and labeling for improved management. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent 861e6c4 commit d91bc52

File tree

12 files changed

+134
-0
lines changed

12 files changed

+134
-0
lines changed

packages/core/platform/bundles/distro-full.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ releases:
3131
autoDirectNodeRoutes: true
3232
routingMode: native
3333

34+
- name: cozy-proxy
35+
releaseName: cozystack
36+
chart: cozy-cozy-proxy
37+
namespace: cozy-system
38+
optional: true
39+
dependsOn: [cilium]
40+
3441
- name: cert-manager-crds
3542
releaseName: cert-manager-crds
3643
chart: cozy-cert-manager-crds

packages/core/platform/bundles/paas-full.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ releases:
5050
SVC_CIDR: "{{ index $cozyConfig.data "ipv4-svc-cidr" }}"
5151
JOIN_CIDR: "{{ index $cozyConfig.data "ipv4-join-cidr" }}"
5252

53+
- name: cozy-proxy
54+
releaseName: cozystack
55+
chart: cozy-cozy-proxy
56+
namespace: cozy-system
57+
dependsOn: [cilium,kubeovn]
58+
5359
- name: cert-manager-crds
5460
releaseName: cert-manager-crds
5561
chart: cozy-cert-manager-crds

packages/system/cozy-proxy/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiVersion: v2
2+
name: cozy-cozystack-api
3+
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process

packages/system/cozy-proxy/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
NAME=cozy-proxy
2+
NAMESPACE=cozy-system
3+
4+
include ../../../scripts/common-envs.mk
5+
include ../../../scripts/package.mk
6+
7+
update:
8+
rm -rf charts
9+
tag=$$(git ls-remote --tags --sort="v:refname" https://github.com/aenix-io/cozy-proxy | awk -F'[/^]' 'END{print $$3}') && \
10+
curl -sSL https://github.com/aenix-io/cozy-proxy/archive/refs/tags/$${tag}.tar.gz | \
11+
tar xzvf - --strip 1 cozy-proxy-$${tag#*v}/charts
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: cozy-proxy
3+
description: A simple kube-proxy addon for 1:1 NAT services in Kubernetes using an NFT backend
4+
type: application
5+
version: 0.1.0
6+
appVersion: 0.1.0
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- define "cozy-proxy.name" -}}
2+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
3+
{{- end -}}
4+
5+
{{- define "cozy-proxy.fullname" -}}
6+
{{- $name := default .Chart.Name .Values.nameOverride -}}
7+
{{- if .Values.fullnameOverride -}}
8+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
9+
{{- else -}}
10+
{{- if eq .Release.Name $name }}
11+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
12+
{{- else -}}
13+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
14+
{{- end -}}
15+
{{- end -}}
16+
{{- end -}}
17+
18+
{{- define "cozy-proxy.labels" -}}
19+
helm.sh/chart: {{ include "cozy-proxy.name" . }}-{{ .Chart.Version | replace "+" "_" }}
20+
app.kubernetes.io/name: {{ include "cozy-proxy.name" . }}
21+
app.kubernetes.io/instance: {{ .Release.Name }}
22+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
23+
app.kubernetes.io/managed-by: {{ .Release.Service }}
24+
{{- end -}}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: {{ include "cozy-proxy.fullname" . }}
5+
labels:
6+
{{- include "cozy-proxy.labels" . | nindent 4 }}
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: {{ include "cozy-proxy.name" . }}
11+
template:
12+
metadata:
13+
labels:
14+
app: {{ include "cozy-proxy.name" . }}
15+
annotations:
16+
{{- toYaml .Values.daemonset.podAnnotations | nindent 8 }}
17+
spec:
18+
serviceAccountName: {{ include "cozy-proxy.fullname" . }}
19+
hostNetwork: {{ .Values.daemonset.hostNetwork }}
20+
containers:
21+
- name: cozy-proxy
22+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
23+
imagePullPolicy: {{ .Values.image.pullPolicy }}
24+
securityContext:
25+
privileged: true
26+
capabilities:
27+
add: ["NET_ADMIN"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: {{ include "cozy-proxy.fullname" . }}
6+
labels:
7+
{{- include "cozy-proxy.labels" . | nindent 4 }}
8+
rules:
9+
- apiGroups: [""]
10+
resources: ["services", "endpoints"]
11+
verbs: ["get", "list", "watch"]
12+
{{- end }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ include "cozy-proxy.fullname" . }}
6+
labels:
7+
{{- include "cozy-proxy.labels" . | nindent 4 }}
8+
subjects:
9+
- kind: ServiceAccount
10+
name: {{ include "cozy-proxy.fullname" . }}
11+
namespace: {{ .Release.Namespace }}
12+
roleRef:
13+
kind: ClusterRole
14+
name: {{ include "cozy-proxy.fullname" . }}
15+
apiGroup: rbac.authorization.k8s.io
16+
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "cozy-proxy.fullname" . }}
6+
labels:
7+
{{- include "cozy-proxy.labels" . | nindent 4 }}
8+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
image:
2+
repository: ghcr.io/aenix-io/cozystack/cozy-proxy
3+
tag: v0.1.0
4+
pullPolicy: IfNotPresent
5+
6+
daemonset:
7+
hostNetwork: true
8+
podAnnotations: {}
9+
podLabels: {}
10+
11+
rbac:
12+
create: true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cozy-proxy:
2+
fullnameOverride: cozy-proxy

0 commit comments

Comments
 (0)