Skip to content

Commit

Permalink
3proxy: Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
  • Loading branch information
mjtrangoni committed Apr 2, 2024
1 parent 8f20195 commit f3d7da4
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/3proxy/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
30 changes: 30 additions & 0 deletions charts/3proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
apiVersion: v2
name: 3proxy
description: A Helm chart for 3proxy tiny proxy server
keywords:
- 3proxy
- proxy
- helm
icon: https://hsto.org/webt/kp/e1/ud/kpe1udvcjss_-wtmrws-w9radke.png
home: https://github.com/enthus-it/helm-charts
sources:
- https://github.com/3proxy/3proxy
- https://github.com/tarampampam/3proxy-docker

type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 1.9.1

maintainers:
- name: mjtrangoni
email: mjtrangoni@gmail.com
53 changes: 53 additions & 0 deletions charts/3proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 3proxy-helm

The unofficial Helm Chart for 3proxy. See more about 3proxy at <https://github.com/z3APA3A/3proxy>.

The goal of this project is to provide a Helm chart for running 3proxy in Kubernetes.

This chart creates a kubernetes *service* for the ports forwarded by [this 3proxy docker image](https://github.com/tarampampam/3proxy-docker).

## Get Repository Info

```console
helm repo add enthus-it https://enthus-it.github.io/helm-charts
helm repo update
```

See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation.

## Installing

```console
helm install --namespace=3proxy --values values.yaml 3proxy enthus-it/3proxy
```

## Uninstalling

```console
helm delete --namespace=3proxy 3proxy
# OR
helm delete MY-RELEASE
```

## Parameters

### 3proxy configuration

| Parameter | Description | Default |
| ----------------------- | ----------------------------------------------- | ------- |
| `config.proxyLogin` | Authorization login | empty |
| `config.proxyPassword` | Authorization password | empty |
| `config.dns.primary` | Primary nameserver | `1.0.0.1` |
| `config.dns.secondary` | Secondary nameserver | `8.8.4.4` |
| `config.maxConnections` | Maximal connections count | `1024` |
| `config.extraConfig` | Additional 3proxy configuration (see example) | empty |

### Service configuration

| Parameter | Description | Default |
| ------------------------ | ----------------------------------------------- | ------- |
| `service.type` | See `kubectl explain service.spec.type` | `ClusterIP` |
| `service.http.enabled` | Enable service HTTP proxy port | `true` |
| `service.http.port` | HTTP proxy port | `3128` |
| `service.socks.enabled` | Enable service SOCKS proxy port | `true` |
| `service.socks.port` | SOCKS proxy port | `1080`|
62 changes: 62 additions & 0 deletions charts/3proxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "3proxy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "3proxy.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "3proxy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "3proxy.labels" -}}
helm.sh/chart: {{ include "3proxy.chart" . }}
{{ include "3proxy.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "3proxy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "3proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "3proxy.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "3proxy.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
84 changes: 84 additions & 0 deletions charts/3proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "3proxy.fullname" . }}
labels:
{{- include "3proxy.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "3proxy.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "3proxy.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "3proxy.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- if .Values.service.http.enabled }}
- name: http-proxy
containerPort: {{ .Values.service.http.port }}
protocol: TCP
{{- end }}
{{- if .Values.service.socks.enabled }}
- name: socks-proxy
containerPort: {{ .Values.service.socks.port }}
protocol: TCP
{{- end }}
env:
{{- if .Values.config.proxyLogin }}
- name: "PROXY_LOGIN"
value: "{{- .Values.config.proxyLogin -}}"
{{- end }}
{{- if .Values.config.proxyLogin }}
- name: "PROXY_PASSWORD"
value: "{{- .Values.config.proxyPassword -}}"
{{- end }}
{{- if .Values.config.dns.primary }}
- name: "PRIMARY_RESOLVER"
value: "{{- .Values.config.dns.primary -}}"
{{- end }}
{{- if .Values.config.dns.secondary }}
- name: "SECONDARY_RESOLVER"
value: "{{- .Values.config.dns.secondary -}}"
{{- end }}
{{- if .Values.config.maxConnections }}
- name: "MAX_CONNECTIONS"
value: "{{- .Values.config.maxConnections -}}"
{{- end }}
{{- if .Values.config.extraConfig }}
- name: "EXTRA_CONFIG"
value: "{{- .Values.config.extraConfig -}}"
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/3proxy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: Service
metadata:
name: svc-{{ include "3proxy.fullname" . }}
labels:
{{- include "3proxy.labels" . | nindent 4 }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- if .Values.service.http.enabled }}
- name: {{ .Values.service.http.portName }}
port: {{ .Values.service.http.port }}
targetPort: http-proxy
protocol: TCP
{{- end }}
{{- if .Values.service.socks.enabled }}
- name: {{ .Values.service.socks.portName }}
port: {{ .Values.service.socks.port }}
targetPort: socks-proxy
protocol: TCP
{{- end }}
selector:
{{- include "3proxy.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/3proxy/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "3proxy.serviceAccountName" . }}
labels:
{{- include "3proxy.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/3proxy/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "3proxy.fullname" . }}-test-connection"
labels:
{{- include "3proxy.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: curl-test-proxy
image: quay.io/curl/curl:latest
command: ['curl']
args: ['--proxy', 'http://svc-{{ include "3proxy.fullname" . }}:{{ .Values.service.http.port }}', 'google.com']
restartPolicy: Never
82 changes: 82 additions & 0 deletions charts/3proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# Default values for chisel.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
registry: ghcr.io
repository: tarampampam/3proxy
# Overrides the image tag whose default is {{ printf "v%s" .Chart.AppVersion }}
tag: ""
pullPolicy: IfNotPresent
digest: ""

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
replicaCount: 1

serviceAccount:
create: true
annotations: {}
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

# 3proxy container configuration
config:
# Authorization login
proxyLogin: ""
# Authorization password
proxyPassword: ""
# DNS Configuration
dns:
primary: 1.0.0.1
secondary: 8.8.4.4
# Maximal connections count
maxConnections: 1024
# Additional 3proxy configuration (do not leave empty spaces around config.)
# extraConfig: '# Allow domains \nallow * * google.com\n# Deny not allowed \ndeny *\n'

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
http:
enabled: true
port: 3128
portName: http-port
socks:
enabled: true
port: 1080
portName: socks-port
annotations: {}
labels: {}

nodeSelector: {}

tolerations: []

affinity: {}

# deployment additional annotations and labels
annotations: {}
labels: {}

resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

0 comments on commit f3d7da4

Please sign in to comment.