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>
This commit is contained in:
Andrei Kvapil
2025-02-06 12:11:01 +01:00
committed by GitHub
parent 861e6c464b
commit d91bc52594
12 changed files with 134 additions and 0 deletions

View File

@@ -31,6 +31,13 @@ releases:
autoDirectNodeRoutes: true
routingMode: native
- name: cozy-proxy
releaseName: cozystack
chart: cozy-cozy-proxy
namespace: cozy-system
optional: true
dependsOn: [cilium]
- name: cert-manager-crds
releaseName: cert-manager-crds
chart: cozy-cert-manager-crds

View File

@@ -50,6 +50,12 @@ releases:
SVC_CIDR: "{{ index $cozyConfig.data "ipv4-svc-cidr" }}"
JOIN_CIDR: "{{ index $cozyConfig.data "ipv4-join-cidr" }}"
- name: cozy-proxy
releaseName: cozystack
chart: cozy-cozy-proxy
namespace: cozy-system
dependsOn: [cilium,kubeovn]
- name: cert-manager-crds
releaseName: cert-manager-crds
chart: cozy-cert-manager-crds

View File

@@ -0,0 +1,3 @@
apiVersion: v2
name: cozy-cozystack-api
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process

View File

@@ -0,0 +1,11 @@
NAME=cozy-proxy
NAMESPACE=cozy-system
include ../../../scripts/common-envs.mk
include ../../../scripts/package.mk
update:
rm -rf charts
tag=$$(git ls-remote --tags --sort="v:refname" https://github.com/aenix-io/cozy-proxy | awk -F'[/^]' 'END{print $$3}') && \
curl -sSL https://github.com/aenix-io/cozy-proxy/archive/refs/tags/$${tag}.tar.gz | \
tar xzvf - --strip 1 cozy-proxy-$${tag#*v}/charts

View File

@@ -0,0 +1,6 @@
apiVersion: v2
name: cozy-proxy
description: A simple kube-proxy addon for 1:1 NAT services in Kubernetes using an NFT backend
type: application
version: 0.1.0
appVersion: 0.1.0

View File

@@ -0,0 +1,24 @@
{{- define "cozy-proxy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "cozy-proxy.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- if eq .Release.Name $name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "cozy-proxy.labels" -}}
helm.sh/chart: {{ include "cozy-proxy.name" . }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: {{ include "cozy-proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "cozy-proxy.fullname" . }}
labels:
{{- include "cozy-proxy.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
app: {{ include "cozy-proxy.name" . }}
template:
metadata:
labels:
app: {{ include "cozy-proxy.name" . }}
annotations:
{{- toYaml .Values.daemonset.podAnnotations | nindent 8 }}
spec:
serviceAccountName: {{ include "cozy-proxy.fullname" . }}
hostNetwork: {{ .Values.daemonset.hostNetwork }}
containers:
- name: cozy-proxy
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
privileged: true
capabilities:
add: ["NET_ADMIN"]

View File

@@ -0,0 +1,12 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "cozy-proxy.fullname" . }}
labels:
{{- include "cozy-proxy.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["services", "endpoints"]
verbs: ["get", "list", "watch"]
{{- end }}

View File

@@ -0,0 +1,16 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "cozy-proxy.fullname" . }}
labels:
{{- include "cozy-proxy.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "cozy-proxy.fullname" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ include "cozy-proxy.fullname" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}

View File

@@ -0,0 +1,8 @@
{{- if .Values.rbac.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "cozy-proxy.fullname" . }}
labels:
{{- include "cozy-proxy.labels" . | nindent 4 }}
{{- end }}

View File

@@ -0,0 +1,12 @@
image:
repository: ghcr.io/aenix-io/cozystack/cozy-proxy
tag: v0.1.0
pullPolicy: IfNotPresent
daemonset:
hostNetwork: true
podAnnotations: {}
podLabels: {}
rbac:
create: true

View File

@@ -0,0 +1,2 @@
cozy-proxy:
fullnameOverride: cozy-proxy