Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Deployment and Pod Annotations (#131)
Browse files Browse the repository at this point in the history
* exposed the metrics port on the Microgateway Pod
* created the possibility to configure Deployment annotations
* created the possibility to configure Pod annotations
* increment chart version to 2.1.0

Co-authored-by: Stefan Dietiker <[email protected]>
Co-authored-by: airlockgithubci <[email protected]>
  • Loading branch information
3 people authored Aug 23, 2021
1 parent cc958c7 commit 8e2bff3
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 19 deletions.
2 changes: 1 addition & 1 deletion charts/microgateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ maintainers:
- email: [email protected]
name: Airlock
name: microgateway
version: 2.0.0
version: 2.1.0
appVersion: "2.1.0"
6 changes: 4 additions & 2 deletions charts/microgateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It is the lightweight, container-based deployment form of the *Airlock Gateway*,

The Airlock helm charts are used internally for testing the *Airlock Microgateway*. We make them available publicly under the [MIT license](https://github.com/ergon/airlock-helm-charts/blob/master/LICENSE).

The current chart version is: 2.0.0
The current chart version is: 2.1.0

## Change Notes
[CHANGE-NOTES](CHANGE-NOTES.md) contains a list of noteworthy changes in the Microgateway Helm Chart.
Expand Down Expand Up @@ -96,6 +96,7 @@ The following table lists configuration parameters of the Airlock Microgateway c
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | string | `nil` | Assign custom [affinity rules](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) (multiline string). |
| annotations | object | `{}` | Additional annotations for the Microgateway Deployment |
| commonLabels | object | `{}` | Labels to add to all resources. |
| config.dsl | object | `{}` | [DSL configuration](#dsl-configuration) |
| config.env | object | `{"configbuilder":[],"runtime":[]}` | [DSL Environment Variables](#dsl-environment-variables) |
Expand All @@ -122,7 +123,7 @@ The following table lists configuration parameters of the Airlock Microgateway c
| hpa.resource.cpu | int | `50` | Average Microgateway CPU consumption in percentage to scale up/down.<br><br> :exclamation: Please set the resource request parameter `resources.cpu` to a value reflecting your actual resource needs if you use autoscaling based on cpu consumption. Otherwise autoscaling will not work as expected. |
| hpa.resource.memory | string | `"3Gi"` | Average Microgateway Memory consumption to scale up/down.<br><br> :exclamation: Update this setting depending on your `resources.limits.memory` setting. |
| image.pullPolicy | string | `"IfNotPresent"` | Pull policy (`Always`, `IfNotPresent`, `Never`) |
| image.repository | object | `{"configbuilder":"docker.io/ergon/airlock-microgateway-configbuilder","runtime":"docker.io/ergon/airlock-microgateway"}` | Image repositories for the Airlock Microgateway. |
| image.repository | object | "see `image.repository.*`" | Image repositories for the Airlock Microgateway. |
| image.repository.configbuilder | string | `"docker.io/ergon/airlock-microgateway-configbuilder"` | Image repository for the Airlock Microgateway configbuilder image |
| image.repository.runtime | string | `"docker.io/ergon/airlock-microgateway"` | Image repository for the Airlock Microgateway runtime image |
| image.tag | string | `"2.1.0"` | Image tag for microgateway and configbuilder image |
Expand Down Expand Up @@ -156,6 +157,7 @@ The following table lists configuration parameters of the Airlock Microgateway c
| livenessProbe.timeoutSeconds | int | `5` | Timeout of liveness probes, should roughly reflect allowed timeouts from clients. |
| nameOverride | string | `""` | Provide a name in place of `microgateway`. |
| nodeSelector | object | `{}` | Define which nodes the pods are scheduled on. |
| podAnnotations | object | `{}` | Additional annotations for the Microgateway Pod <br><br> Examples: <br> - prometheus.io/scrape: "true" <br> - prometheus.io/port: "9102" |
| podSecurityContext | object | `{}` | [Security context for the pods](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod). |
| readinessProbe.enabled | bool | `true` | Enable readiness probes. |
| readinessProbe.failureThreshold | int | `3` | After how many tries the pod stops receiving traffic. |
Expand Down
11 changes: 10 additions & 1 deletion charts/microgateway/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ metadata:
name: {{ template "microgateway.fullname" . }}
labels:
{{- include "microgateway.labels" . | nindent 4 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand All @@ -20,7 +24,10 @@ spec:
{{- end }}
{{- if (include "microgateway.createLicenseSecret" .) }}
checksum/licenseSecret: {{ include (print .Template.BasePath "/licensesecret.yaml") . | sha256sum }}
{{- end }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if or .Values.imagePullSecrets .Values.imageCredentials.enabled }}
imagePullSecrets:
Expand Down Expand Up @@ -78,6 +85,8 @@ spec:
containerPort: 8443
- name: probes
containerPort: 9090
- name: metrics
containerPort: 9102
{{- with .Values.config.env.runtime }}
env: {{ toYaml . | nindent 10 }}
{{- end }}
Expand Down
56 changes: 41 additions & 15 deletions charts/microgateway/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests:
- hasDocuments:
count: 1
- isKind:
of: Deployment
of: Deployment
- equal:
path: metadata.name
value: my-microgateway
Expand All @@ -34,8 +34,34 @@ tests:
templates:
- deployment.yaml

- it: does create correct annotations
set:
annotations:
project: "test"
asserts:
- equal:
path: metadata.annotations.project
value: test
templates:
- deployment.yaml

- it: does create correct podAnnotations
set:
podAnnotations:
prometheus.io/scrape: true
prometheus.io/port: "9102"
asserts:
- equal:
path: spec.template.metadata.annotations.[prometheus.io/scrape]
value: true
- equal:
path: spec.template.metadata.annotations.[prometheus.io/port]
value: "9102"
templates:
- deployment.yaml

- it: does create checksums
set:
set:
config.license.key: key
asserts:
- isNull:
Expand All @@ -46,7 +72,7 @@ tests:
not: true
- isNull:
path: spec.template.metadata.annotations.checksum/licenseSecret
not: true
not: true
templates:
- deployment.yaml
- it: does not create secret checksum with existing passphrase secret
Expand Down Expand Up @@ -124,12 +150,12 @@ tests:
- it: does create extra volumes
set:
extraVolumes:
- name: volumename
configMap:
name: config-map-name
- name: volumename2
configMap:
name: config-map-name2
- name: volumename
configMap:
name: config-map-name
- name: volumename2
configMap:
name: config-map-name2
asserts:
- equal:
path: spec.template.spec.volumes[3].name
Expand Down Expand Up @@ -202,12 +228,12 @@ tests:
- it: does render tolerations defined
set:
tolerations:
- key: "example-key"
operator: "Exists"
effect: "NoSchedule"
- key: "example-key2"
operator: "Exists"
effect: "NoSchedule"
- key: "example-key"
operator: "Exists"
effect: "NoSchedule"
- key: "example-key2"
operator: "Exists"
effect: "NoSchedule"
asserts:
- equal:
path: spec.template.spec.tolerations[0].key
Expand Down
13 changes: 13 additions & 0 deletions charts/microgateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ replicaCount: 1

image:
# image.repository -- Image repositories for the Airlock Microgateway.
# @default -- "see `image.repository.*`"
repository:
# image.repository.runtime -- Image repository for the Airlock Microgateway runtime image
runtime: docker.io/ergon/airlock-microgateway
Expand All @@ -13,6 +14,16 @@ image:
# image.pullPolicy -- Pull policy (`Always`, `IfNotPresent`, `Never`)
pullPolicy: IfNotPresent

# annotations -- Additional annotations for the Microgateway Deployment
annotations: {}

# podAnnotations -- Additional annotations for the Microgateway Pod <br><br>
# Examples: <br>
# - prometheus.io/scrape: "true" <br>
# - prometheus.io/port: "9102"
podAnnotations: {}


## Microgateway Config
##
config:
Expand Down Expand Up @@ -128,6 +139,8 @@ service:
# service.annotations -- Annotations to set on the service.
annotations: {}
# service.alpha.openshift.io/serving-cert-secret-name: microgateway
# prometheus.io/scrape: "true"
# prometheus.io/port: "9102"
# service.labels -- Additional labels to add on the service.
labels: {}

Expand Down

0 comments on commit 8e2bff3

Please sign in to comment.