Skip to content

Commit

Permalink
Merge pull request #79 from qpoint-io/marc-barry/qpoint-proxy
Browse files Browse the repository at this point in the history
Initial qpoint proxy chart (replacing the old qtap chart).
  • Loading branch information
marc-barry authored May 27, 2024
2 parents 091514a + 58d69a4 commit d2ff51c
Show file tree
Hide file tree
Showing 17 changed files with 153 additions and 127 deletions.
File renamed without changes.
8 changes: 4 additions & 4 deletions charts/qtap/Chart.yaml → charts/qpoint-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apiVersion: v2
name: qtap
description: A Helm chart for running Qtap on Kubernetes
name: apoint-proxy
description: A Helm chart for running Qpoint Proxy on Kubernetes
icon: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDMuNjMgMzIuOSI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSwgLmNscy0yIHsKICAgICAgICBzdHJva2Utd2lkdGg6IDBweDsKICAgICAgfQoKICAgICAgLmNscy0zIHsKICAgICAgICBmaWxsOiBub25lOwogICAgICAgIHN0cm9rZTogIzEwMTQxNzsKICAgICAgICBzdHJva2UtbGluZWNhcDogcm91bmQ7CiAgICAgICAgc3Ryb2tlLW1pdGVybGltaXQ6IDEwOwogICAgICAgIHN0cm9rZS13aWR0aDogMi41NXB4OwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGw6ICMxMDE0MTc7CiAgICAgIH0KICAgIDwvc3R5bGU+CiAgPC9kZWZzPgogIDxnIGlkPSJMYXllcl8yLTIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+CiAgICA8ZyBpZD0ibG9nby1ibGFjayI+CiAgICAgIDxnPgogICAgICAgIDxsaW5lIGNsYXNzPSJj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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.0.21
version: 0.0.1

# 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: "v0.0.20"
appVersion: "v0.1.1"
16 changes: 16 additions & 0 deletions charts/qpoint-proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# qpoint-proxy Helm chart

This deploys Qpoint Proxy to Kubernetes using [Helm](https://helm.sh/).

The Qpoint Proxy can operate in two modes:

1. Control plane mode. For this mode it depends on a secret called `token` existing within the namespace that the chart is installed. Below is an example of how to create the secret before chart install:

```sh
kubectl --namespace qpoint create secret generic token --from-literal=token="<TOKEN>"
helm install qpoint-gateway . --namespace qpoint --create-namespace --wait --timeout 20s
```

2. Standalone mode. For this mode it depends on a config map named `config` with the file contents of a valid YAML configuration file format.

Both modes will deploy Qpoint with the `proxy` command. Any of the values can be overridden using standard Helm processes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "qtap.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "qpoint.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "qtap.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "qtap.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "qpoint.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "qpoint.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "qtap.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "qpoint.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "qtap.name" -}}
{{- define "qpoint.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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 "qtap.fullname" -}}
{{- define "qpoint.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "qtap.chart" -}}
{{- define "qpoint.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "qtap.labels" -}}
helm.sh/chart: {{ include "qtap.chart" . }}
{{ include "qtap.selectorLabels" . }}
{{- define "qpoint.labels" -}}
helm.sh/chart: {{ include "qpoint.chart" . }}
{{ include "qpoint.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "qtap.selectorLabels" -}}
app.kubernetes.io/name: {{ include "qtap.name" . }}
{{- define "qpoint.selectorLabels" -}}
app.kubernetes.io/name: {{ include "qpoint.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "qtap.serviceAccountName" -}}
{{- define "qpoint.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "qtap.fullname" .) .Values.serviceAccount.name }}
{{- default (include "qpoint.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions charts/qpoint-proxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "qpoint.fullname" . }}-config
labels: {{- include "qpoint.labels" . | nindent 4 }}
data:
proxy-config.yaml: |
{{- .Values.config | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "qtap.fullname" . }}
name: {{ include "qpoint.fullname" . }}
labels:
{{- include "qtap.labels" . | nindent 4 }}
{{- include "qpoint.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "qtap.selectorLabels" . | nindent 6 }}
{{- include "qpoint.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "qtap.labels" . | nindent 8 }}
{{- include "qpoint.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -27,7 +27,7 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "qtap.serviceAccountName" . }}
serviceAccountName: {{ include "qpoint.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand All @@ -39,38 +39,33 @@ spec:
args:
{{- toYaml .Values.args | nindent 12 }}
env:
- name: ENDPOINT
value: "{{ .Values.endpoint }}"
- name: TOKEN
- name: REGISTRATION_ENDPOINT
value: "{{ .Values.registrationEndpoint }}"
{{- if .Values.registrationToken }}
- name: REGISTRATION_TOKEN
valueFrom:
secretKeyRef:
name: token
key: token
- name: INGRESS_HTTP_LISTEN
value: "{{ .Values.service.ingress.http.addr }}:{{ .Values.service.ingress.http.port }}"
- name: INGRESS_HTTPS_LISTEN
value: "{{ .Values.service.ingress.https.addr }}:{{ .Values.service.ingress.https.port }}"
- name: EGRESS_HTTP_LISTEN
value: "{{ .Values.service.egress.http.addr }}:{{ .Values.service.egress.http.port }}"
- name: EGRESS_HTTPS_LISTEN
value: "{{ .Values.service.egress.https.addr }}:{{ .Values.service.egress.https.port }}"
{{- end }}
{{- if .Values.config }}
- name: QPOINT_CONFIG
value: "/app/proxy-config.yaml"
{{- end }}
- name: STATUS_LISTEN
value: "{{ .Values.status.addr }}:{{ .Values.status.port }}"
- name: COLLECTOR_LISTEN
value: "{{ .Values.collector.addr }}:{{ .Values.collector.port }}"
- name: DEFAULT_TCP_LISTEN_ADDRESS
value: "{{ .Values.defaultTCPListenAddress }}"
- name: MIDDLEWARE_TCP_FORWARD_PORTS
value: "{{ .Values.middlewareTCPForwardPorts }}"
- name: TRANSPARENT_TCP_FORWARD_PORTS
value: "{{ .Values.transparentTCPForwardPorts }}"
ports:
- name: i-http-service
containerPort: {{ .Values.service.ingress.http.port }}
protocol: TCP
- name: i-https-service
containerPort: {{ .Values.service.ingress.https.port }}
protocol: TCP
- name: e-http-service
containerPort: {{ .Values.service.egress.http.port }}
protocol: TCP
- name: e-https-service
containerPort: {{ .Values.service.egress.https.port }}
protocol: TCP
{{- range .Values.service.ports }}
- name: {{ .name }}
containerPort: {{ .containerPort }}
protocol: {{ .protocol }}
{{- end }}
- name: status
containerPort: {{ .Values.status.port }}
protocol: TCP
Expand Down Expand Up @@ -103,14 +98,23 @@ spec:
failureThreshold: 3
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
- name: config-volume
mountPath: /app/proxy-config.yaml
subPath: proxy-config.yaml
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
{{- end }}
volumes:
- name: config-volume
configMap:
name: {{ include "qpoint.fullname" . }}-config
items:
- key: proxy-config.yaml
path: proxy-config.yaml
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "qtap.fullname" . }}
name: {{ include "qpoint.fullname" . }}
labels:
{{- include "qtap.labels" . | nindent 4 }}
{{- include "qpoint.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "qtap.fullname" . }}
name: {{ include "qpoint.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
Expand Down
9 changes: 9 additions & 0 deletions charts/qpoint-proxy/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if .Values.registrationToken }}
apiVersion: v1
kind: Secret
metadata:
name: token
type: Opaque
data:
token: {{ .Values.registrationToken | b64enc }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/qpoint-proxy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "qpoint.fullname" . }}
labels: {{- include "qpoint.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- range .Values.service.ports }}
- port: {{ .port }}
targetPort: {{ .name }}
protocol: {{ .protocol }}
name: {{ .name }}
{{- end }}
selector: {{- include "qpoint.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "qtap.serviceAccountName" . }}
name: {{ include "qpoint.serviceAccountName" . }}
labels:
{{- include "qtap.labels" . | nindent 4 }}
{{- include "qpoint.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "qtap.fullname" . }}-test-connection"
name: "{{ include "qpoint.fullname" . }}-test-connection"
labels:
{{- include "qtap.labels" . | nindent 4 }}
{{- include "qpoint.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "qtap.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "qpoint.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
Loading

0 comments on commit d2ff51c

Please sign in to comment.