Skip to content

Commit

Permalink
Add nginx sidecar for gunicorn to fence
Browse files Browse the repository at this point in the history
  • Loading branch information
jawadqur committed Nov 14, 2023
1 parent de10727 commit b820875
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-07-27T21:47:16Z",
"generated_at": "2023-11-14T19:51:24Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -289,10 +289,10 @@
"type": "Secret Keyword"
},
{
"hashed_secret": "9d8fada0e01336e865c461bb3549084d206fe6da",
"hashed_secret": "680318f193e2ef208430b002ad07ff98a79ac457",
"is_secret": false,
"is_verified": false,
"line_number": 181,
"line_number": 185,
"type": "Secret Keyword"
}
],
Expand Down Expand Up @@ -356,7 +356,7 @@
"hashed_secret": "5d07e1b80e448a213b392049888111e1779a52db",
"is_secret": false,
"is_verified": false,
"line_number": 1916,
"line_number": 1932,
"type": "Secret Keyword"
}
],
Expand Down Expand Up @@ -470,10 +470,10 @@
"type": "Secret Keyword"
},
{
"hashed_secret": "1cc98556e7b1353c7bd08344f9190808b0d3d6d4",
"is_secret": true,
"hashed_secret": "ffa29bb5e69093c793d39762da0340f0bcf3fe53",
"is_secret": false,
"is_verified": false,
"line_number": 101,
"line_number": 104,
"type": "Secret Keyword"
}
],
Expand Down
2 changes: 1 addition & 1 deletion helm/fence/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.1.13
version: 0.1.14

# 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
Expand Down
8 changes: 6 additions & 2 deletions helm/fence/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fence

![Version: 0.1.13](https://img.shields.io/badge/Version-0.1.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: master](https://img.shields.io/badge/AppVersion-master-informational?style=flat-square)
![Version: 0.1.14](https://img.shields.io/badge/Version-0.1.14-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: master](https://img.shields.io/badge/AppVersion-master-informational?style=flat-square)

A Helm chart for gen3 Fence

Expand Down Expand Up @@ -163,6 +163,10 @@ A Helm chart for gen3 Fence
| serviceAccount.annotations."eks.amazonaws.com/role-arn" | string | `nil` | The Amazon Resource Name (ARN) of the role to associate with the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created. |
| serviceAccount.name | string | `"fence-sa"` | The name of the service account |
| sidecar | map | `{"enabled":true,"image":"quay.io/cdis/nginx","pullPolicy":"Always","tag":"master"}` | Configuration for Nginx sidecar container to be deployed with gunicorn. |
| sidecar.image | string | `"quay.io/cdis/nginx"` | The Docker image repository for nginx |
| sidecar.pullPolicy | string | `"Always"` | When to pull the image. |
| sidecar.tag | string | `"master"` | Image tag. |
| tolerations | list | `[]` | Tolerations for the pods |
| usersync | map | `{"addDbgap":false,"custom_image":null,"onlyDbgap":false,"schedule":"*/30 * * * *","secrets":{"awsAccessKeyId":"","awsSecretAccessKey":""},"slack_send_dbgap":false,"slack_webhook":"None","syncFromDbgap":false,"userYamlS3Path":"s3://cdis-gen3-users/helm-test/user.yaml","usersync":false}` | Configuration options for usersync cronjob. |
| usersync.addDbgap | bool | `false` | Force attempting a dbgap sync if "true", falls back on user.yaml |
Expand All @@ -178,7 +182,7 @@ A Helm chart for gen3 Fence
| usersync.userYamlS3Path | string | `"s3://cdis-gen3-users/helm-test/user.yaml"` | Path to the user.yaml file in S3. |
| usersync.usersync | bool | `false` | Whether to run Fence usersync or not. |
| volumeMounts | list | `[{"mountPath":"/var/www/fence/local_settings.py","name":"old-config-volume","readOnly":true,"subPath":"local_settings.py"},{"mountPath":"/var/www/fence/fence_credentials.json","name":"json-secret-volume","readOnly":true,"subPath":"fence_credentials.json"},{"mountPath":"/var/www/fence/creds.json","name":"creds-volume","readOnly":true,"subPath":"creds.json"},{"mountPath":"/var/www/fence/config_helper.py","name":"config-helper","readOnly":true,"subPath":"config_helper.py"},{"mountPath":"/fence/fence/static/img/logo.svg","name":"logo-volume","readOnly":true,"subPath":"logo.svg"},{"mountPath":"/fence/fence/static/privacy_policy.md","name":"privacy-policy","readOnly":true,"subPath":"privacy_policy.md"},{"mountPath":"/var/www/fence/fence-config.yaml","name":"config-volume","readOnly":true,"subPath":"fence-config.yaml"},{"mountPath":"/var/www/fence/yaml_merge.py","name":"yaml-merge","readOnly":true,"subPath":"yaml_merge.py"},{"mountPath":"/var/www/fence/fence_google_app_creds_secret.json","name":"fence-google-app-creds-secret-volume","readOnly":true,"subPath":"fence_google_app_creds_secret.json"},{"mountPath":"/var/www/fence/fence_google_storage_creds_secret.json","name":"fence-google-storage-creds-secret-volume","readOnly":true,"subPath":"fence_google_storage_creds_secret.json"},{"mountPath":"/fence/keys/key/jwt_private_key.pem","name":"fence-jwt-keys","readOnly":true,"subPath":"jwt_private_key.pem"}]` | Volumes to mount to the container. |
| volumes | list | `[{"name":"old-config-volume","secret":{"secretName":"fence-secret"}},{"name":"json-secret-volume","secret":{"optional":true,"secretName":"fence-json-secret"}},{"name":"creds-volume","secret":{"secretName":"fence-creds"}},{"configMap":{"name":"config-helper","optional":true},"name":"config-helper"},{"configMap":{"name":"logo-config"},"name":"logo-volume"},{"name":"config-volume","secret":{"secretName":"fence-config"}},{"name":"fence-google-app-creds-secret-volume","secret":{"secretName":"fence-google-app-creds-secret"}},{"name":"fence-google-storage-creds-secret-volume","secret":{"secretName":"fence-google-storage-creds-secret"}},{"name":"fence-jwt-keys","secret":{"secretName":"fence-jwt-keys"}},{"configMap":{"name":"privacy-policy"},"name":"privacy-policy"},{"configMap":{"name":"fence-yaml-merge","optional":true},"name":"yaml-merge"}]` | Volumes to attach to the container. |
| volumes | list | `[{"name":"old-config-volume","secret":{"secretName":"fence-secret"}},{"name":"json-secret-volume","secret":{"optional":true,"secretName":"fence-json-secret"}},{"name":"creds-volume","secret":{"secretName":"fence-creds"}},{"configMap":{"name":"config-helper","optional":true},"name":"config-helper"},{"configMap":{"name":"logo-config"},"name":"logo-volume"},{"name":"config-volume","secret":{"secretName":"fence-config"}},{"name":"fence-google-app-creds-secret-volume","secret":{"secretName":"fence-google-app-creds-secret"}},{"name":"fence-google-storage-creds-secret-volume","secret":{"secretName":"fence-google-storage-creds-secret"}},{"name":"fence-jwt-keys","secret":{"secretName":"fence-jwt-keys"}},{"configMap":{"name":"privacy-policy"},"name":"privacy-policy"},{"configMap":{"name":"fence-yaml-merge","optional":true},"name":"yaml-merge"},{"configMap":{"name":"fence-wsgi"},"name":"wsgi-config"},{"configMap":{"name":"fence-nginx-configmap"},"name":"nginx-config"}]` | Volumes to attach to the container. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
13 changes: 13 additions & 0 deletions helm/fence/nginx-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: fence-nginx-configmap
data:
default.conf: |
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8000; # Gunicorn binds to this address
}
}
23 changes: 16 additions & 7 deletions helm/fence/templates/fence-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,28 @@ spec:
volumes:
{{- toYaml .Values.volumes | nindent 8 }}
containers:
{{- if .Values.sidecar.enabled }}
- name: sidecar-nginx
image: {{ .Values.sidecar.image }}
ports:
- name: http
containerPort: 80
volumeMounts:
- name: "nginx-config"
mountPath: "/etc/nginx/conf.d/default.conf"
subPath: default.conf
{{- end }}
- name: fence
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
- name: app
containerPort: 8000
# - name: https
# containerPort: 443
# protocol: TCP
- name: container
containerPort: 6567
protocol: TCP
livenessProbe:
httpGet:
path: /_status
Expand Down
16 changes: 16 additions & 0 deletions helm/fence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ image:
# -- (string) Overrides the image tag whose default is the chart appVersion.
tag: "master"

# -- (map) Configuration for Nginx sidecar container to be deployed with gunicorn.
sidecar:
enabled: true
# -- (string) The Docker image repository for nginx
image: quay.io/cdis/nginx
# -- (string) When to pull the image.
pullPolicy: Always
# -- (string) Image tag.
tag: "master"

# -- (list) Docker image pull secrets.
imagePullSecrets: []

Expand Down Expand Up @@ -333,6 +343,12 @@ volumes:
configMap:
name: "fence-yaml-merge"
optional: true
- name: wsgi-config
configMap:
name: fence-wsgi
- name: nginx-config
configMap:
name: fence-nginx-configmap

# -- (list) Volumes to mount to the container.
volumeMounts:
Expand Down
11 changes: 11 additions & 0 deletions helm/fence/wsgi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: fence-wsgi
data:
gunicorn.conf.py: |
wsgi_app = "deployment.wsgi.wsgi:application"
bind = "0.0.0.0:8000"
workers = 1
user = 'appuser'
group = 'appuser'

0 comments on commit b820875

Please sign in to comment.