Skip to content

Commit

Permalink
Merge pull request #12 from gatewayd-io/8-add-configmap
Browse files Browse the repository at this point in the history
Add ConfigMap for Persistent Plugin File Values
  • Loading branch information
mostafa authored Apr 18, 2024
2 parents 450ab23 + e84125b commit d9020bf
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 36 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/helm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

name: Test Action
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main

jobs:
test:
name: Basic chart test using Minikube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start minikube
uses: medyagh/setup-minikube@master
- name: Test whether the cluster is running
run: kubectl get pods -A
- name: Install PostgreSQL
run: helm install psql oci://registry-1.docker.io/bitnamicharts/postgresql --set global.postgresql.auth.postgresPassword=postgres
- name: Check deployment status
run: |
kubectl rollout status --watch statefulset/psql-postgresql --timeout=5m
- name: Wait for PostgreSQL database to start
run: |
for n in [ 0 1 2 3 4 5 6 7 8 9 ]
do
if kubectl logs pod/psql-postgresql-0 | grep 'database system is ready to accept connections'
then
exit 0
fi
sleep 30
done
echo PostgreSQL did not start within 300 seconds!
exit 1
- name: Install gatewayd
run: helm install gatewayd .
- name: Check deployment status
run: |
kubectl rollout status --watch deployment/gatewayd --timeout=5m
- name: Wait for gatewayd to start
run: |
for n in [ 0 1 2 3 4 5 6 7 8 9 ]
do
if kubectl get deployment gatewayd | awk '{print $2}' | grep 1/1
then
exit 0
fi
sleep 30
done
echo gatewayd did not start within 300 seconds!
exit 1
File renamed without changes.
File renamed without changes.
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,97 @@ We welcome contributions from everyone. Just open an [issue](https://github.com/
## License

GatewayD Helm Charts is licensed under the [Apache 2.0 License](https://github.com/gatewayd-io/helm-charts/blob/main/LICENSE).

# GatewayD Community Kubernetes Helm Charts

This Helm charts installs GatewayD on your Kubernetes cluster.

## How to use the charts

1. Clone this repository
2. Install the chart
3. (Optionally) Uninstall the chart

```bash
git clone https://github.com/gatewayd-io/helm-charts.git
cd helm-charts/charts/gatewayd/
helm install gatewayd-release -f values.yaml ./
# helm uninstall gatewayd-release
```

## Configuration for GatewayD Helm Chart

#### Deployment Configuration

| Parameter | Description | Default Value |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------|
| `autoscaling.enabled` | Determines whether autoscaling is enabled for the deployment. If not enabled, the `replicaCount` value is used to set the number of replicas. | `false` |
| `replicaCount` | The number of replicas to create for the deployment | `1` |
| `podAnnotations` | Annotations to add to the pod | `{}` |
| `podLabels` | Labels to add to the pod | `{}` |
| `imagePullSecrets` | Image pull secrets for the Docker registry | `[]` |
| `serviceAccountName` | The name of the service account to use for the deployment | `""` |
| `podSecurityContext` | Security context for the pod | `{}` |
| `securityContext` | Security context for the container | `{}` |
| `image.repository` | The Docker image repository | `gatewaydio/gatewayd` |
| `image.tag` | The Docker image tag. If not set, the app version from the chart is used | `""` |
| `image.pullPolicy` | The image pull policy | `IfNotPresent` |
| `resources` | Resource requests and limits for the container | `{}` |
| `gatewaydPluginsConfig.enabled` | Determines whether the `gatewayd_plugins.yaml` ConfigMap is mounted to the container. If enabled, a volume and volumeMount are added to the deployment. | `false` |
| `nodeSelector` | Node selector for the pod | `{}` |
| `affinity` | Affinity for the pod | `{}` |
| `tolerations` | Tolerations for the pod | `[]` |

#### Service Configuration

| Parameter | Description | Default Value |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------|
| `service.port` | The port that the service listens on | `15432` |
| `ingress.enabled` | Determines whether an Ingress resource should be created | `false` |

#### Ingress Configuration

| Parameter | Description | Default Value |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------|
| `gatewayd.fullname` | The full name of the deployment, used as part of the Ingress resource name | |
| `service.port` | The port that the service listens on, used as the service port in the Ingress rules | |
| `ingress.className` | The Ingress class to assign to the Ingress resource. This is only used for Kubernetes versions less than 1.18. | |
| `ingress.annotations` | Annotations to add to the Ingress resource. If `ingress.className` is set and the Kubernetes version is less than 1.18, the `kubernetes.io/ingress.class` annotation is added with the value of `ingress.className`. | `{}` |
| `Capabilities.KubeVersion.GitVersion` | The Kubernetes version running in the cluster. This is used to determine the API version of the Ingress resource to create. | |

#### Autoscaling Configuration

| Parameter | Description | Default Value |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------|
| `gatewayd.fullname` | The full name of the deployment, used as the target of the Horizontal Pod Autoscaler. | |
| `autoscaling.minReplicas` | The minimum number of replicas that the Horizontal Pod Autoscaler should maintain | |
| `autoscaling.maxReplicas` | The maximum number of replicas that the Horizontal Pod Autoscaler can scale out to | |
| `autoscaling.targetCPUUtilizationPercentage`| The target percentage of CPU utilization across all replicas that the Horizontal Pod Autoscaler should maintain. If set, a CPU utilization metric is added to the Horizontal Pod Autoscaler. | |
| `autoscaling.targetMemoryUtilizationPercentage`| The target percentage of memory utilization across all replicas that the Horizontal Pod Autoscaler should maintain. If set, a memory utilization metric is added to the Horizontal Pod Autoscaler. | |

#### Service Account Configuration

| Parameter | Description | Default Value |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------|
| `serviceAccount.create` | Determines whether a ServiceAccount should be created | |
| `gatewayd.serviceAccountName` | The name of the ServiceAccount. This is used as the name of the ServiceAccount resource. | |
| `gatewayd.labels` | The labels to apply to the ServiceAccount. | |
| `serviceAccount.annotations` | Annotations to add to the ServiceAccount. | |
| `serviceAccount.automount` | Determines whether the ServiceAccount token should be automatically mounted to the pods. This is set as the `automountServiceAccountToken` field in the ServiceAccount resource. | |

#### ConfigMap Configuration

| Parameter | Description | Default Value |
|---------------------------------------------|-------------------------------------------------------------------------------------------------------|-----------------------------|
| `gatewayd.fullname` | The full name of the deployment, used as the name of the ConfigMap. | |
| `.Release.Name` | The release name, used as part of the ConfigMap name. | |
| `gatewaydPluginsConfig.content` | The content of the `gatewayd_plugins.yaml` file. This is set as the `gatewayd_plugins.yaml` data in the ConfigMap. | |


## Usage

Modify the [values.yaml](values.yaml) file to customize the deployment according to your requirements. You can override any default values as needed.

## Contributing

Feel free to contribute to the development of this Helm chart by submitting issues or pull requests to the GitHub repository.
16 changes: 0 additions & 16 deletions charts/gatewayd/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- end }}
labels:
{{- include "gatewayd.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
Expand All @@ -46,13 +46,17 @@ spec:
name: {{ include "gatewayd.fullname" . }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
{{- if .Values.gatewaydPluginsConfig.enabled }}
volumeMounts:
{{- toYaml . | nindent 12 }}
- name: config-volume
mountPath: /etc/gatewayd_plugins.yaml
subPath: gatewayd_plugins.yaml
{{- end }}
{{- with .Values.volumes }}
{{- if .Values.gatewaydPluginsConfig.enabled }}
volumes:
{{- toYaml . | nindent 8 }}
- name: config-volume
configMap:
name: {{ .Release.Name }}-gatewayd-plugins-config
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand All @@ -65,4 +69,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions templates/gatewayd_plugins_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if .Values.gatewaydPluginsConfig.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-gatewayd-plugins-config
data:
gatewayd_plugins.yaml: |
{{ .Values.gatewaydPluginsConfig.content | nindent 4 }}
{{- end }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
48 changes: 34 additions & 14 deletions charts/gatewayd/values.yaml → values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gatewayd:
clients:
default:
address: "postgres:5432"
address: "psql-postgresql:5432"
loggers:
default:
# For production, use info
Expand Down Expand Up @@ -82,21 +82,41 @@ autoscaling:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

gatewaydPluginsConfig:
enabled: false
content: |
compatibilityPolicy: "strict"
enableMetricsMerger: True
metricsMergerPeriod: 5s
healthCheckPeriod: 5s
reloadOnCrash: True
timeout: 30s
plugins:
- name: gatewayd-plugin-cache
enabled: True
url: github.com/gatewayd-io/gatewayd-plugin-cache@latest
localPath: ../gatewayd-plugin-cache/gatewayd-plugin-cache
args: ["--log-level", "info"]
env:
- MAGIC_COOKIE_KEY=GATEWAYD_PLUGIN
- MAGIC_COOKIE_VALUE=5712b87aa5d7e9f9e9ab643e6603181c5b796015cb1c09d6f5ada882bf2a1872
- REDIS_URL=redis://localhost:6379/0
- EXPIRY=1h
- METRICS_ENABLED=True
- METRICS_UNIX_DOMAIN_SOCKET=/tmp/gatewayd-plugin-cache.sock
- METRICS_PATH=/metrics
- PERIODIC_INVALIDATOR_ENABLED=True
- PERIODIC_INVALIDATOR_INTERVAL=1m
- PERIODIC_INVALIDATOR_START_DELAY=1m
- API_ADDRESS=localhost:18080
- EXIT_ON_STARTUP_ERROR=False
- SENTRY_DSN=https://70eb1abcd32e41acbdfc17bc3407a543@o4504550475038720.ingest.sentry.io/4505342961123328
- CACHE_CHANNEL_BUFFER_SIZE=100
checksum: 3988e10aefce2cd9b30888eddd2ec93a431c9018a695aea1cea0dac46ba91cae

0 comments on commit d9020bf

Please sign in to comment.