Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce cozy-proxy #615

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/core/platform/bundles/distro-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions packages/core/platform/bundles/paas-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions packages/system/cozy-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions packages/system/cozy-proxy/Makefile
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions packages/system/cozy-proxy/charts/cozy-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 -}}
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
@@ -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 }}
12 changes: 12 additions & 0 deletions packages/system/cozy-proxy/charts/cozy-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions packages/system/cozy-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cozy-proxy:
fullnameOverride: cozy-proxy