diff --git a/swh-graphql/Chart.yaml b/swh-graphql/Chart.yaml deleted file mode 100644 --- a/swh-graphql/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: swh-graphql -description: A Helm chart to deploy the graphql service - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -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.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.16.0" diff --git a/swh-graphql/README.md b/swh-graphql/README.md deleted file mode 100644 --- a/swh-graphql/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Goal - -- Deploy a standalone graphql instance - -This chart will be merged with the global swh chart when available - -# helm - -We use helm to ease the cluster application management. - -# Install - -## Prerequisites -- Helm >= 3.0 -- Access to a kubernetes cluster -- The url of a reachable swh storage - -## Chart installation - -Install the worker declaration from this directory in the cluster -``` -swh-charts/swh-graphql $ helm install -f values/default.yaml values/local.yaml graphql . -``` - -With `local.yaml` containing some overrides of the default values matching your -environment. - -What's currently deployed can be seen with: - -``` -swh-charts/swh-graphql $ helm list -NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION -graphql default 1 2022-07-20 10:40:21.405492989 +0200 CEST deployed swh-graphql-0.1.0 1.16.0 - -``` - -Possible values can be listed too: -``` -swh-charts/swh-graphql $ helm show values . -``` - -# minikube - -If you are using minikube locally to play with the chart, you need to provide the image -to the minikube registry. - -Assuming you are using the values.yml provided in the repository, that'd be: -``` -$ docker pull softwareheritage/graphql:latest -$ minikube image load softwareheritage/graphql:latest -``` - -You will also need to enable ingress: -``` -$ minikube addons enable ingress -``` diff --git a/swh-graphql/values/default.yaml b/swh-graphql/values/default.yaml deleted file mode 100644 --- a/swh-graphql/values/default.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# Default values for graphql. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -namespace: default - -# Number of graphql pods to deploy -replicas: 1 - -image: - # The name of the image to use - name: softwareheritage/graphql - # The version of the image to use - version: latest - pullPolicy: Always - -# The storage url to query -storageUrl: http://storage.svc.cluster.local:5002 - -# Deploy or not an ingress controller -enableIngress: true -# Specify the ingress class to use if several are available in the cluster -ingressClassName: {} - -# The ingress host to listen for -ingressHost: "" - -# Configure the path of the ingress -ingressHttpPath: / - -# The graphql log level. Possible values TRACE, DEBUG, INFO, ERROR -logLevel: INFO - -gunicornThreads: 4 -gunicornWorkers: 2 -gunicornTimeout: 3600 diff --git a/swh-graphql/values/local.yaml b/swh-graphql/values/local.yaml deleted file mode 100644 --- a/swh-graphql/values/local.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# The storage url to query -storageUrl: http://webapp.internal.staging.swh.network:5002/ - -# The ingress host to listen for -# ingressHost: graphql-worker0.internal.staging.swh.network -ingressHost: graphql.local - -# Configure the path of the ingress -ingressHttpPath: /graph - -# The graphql log level. Possible values TRACE, DEBUG, INFO, ERROR -logLevel: DEBUG - diff --git a/swh-graphql/values/staging.yaml b/swh-graphql/values/staging.yaml deleted file mode 100644 --- a/swh-graphql/values/staging.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# namespace: graphql-rancher-cluster - -# The storage url to query -storageUrl: http://webapp.internal.staging.swh.network:5002/ - -# Configure the path of the ingress -ingressHttpPath: / - -# The graphql log level. Possible values TRACE, DEBUG, INFO, ERROR -logLevel: DEBUG - -# Number of graphql pods to deploy -replicas: 3 diff --git a/swh-graphql/templates/configmap.yaml b/swh/templates/graphql/configmap.yaml rename from swh-graphql/templates/configmap.yaml rename to swh/templates/graphql/configmap.yaml --- a/swh-graphql/templates/configmap.yaml +++ b/swh/templates/graphql/configmap.yaml @@ -1,3 +1,4 @@ +{{ if .Values.graphql.enabled -}} --- apiVersion: v1 kind: ConfigMap @@ -8,8 +9,9 @@ config.yml: | storage: cls: remote - url: {{ .Values.storageUrl }} + url: {{ .Values.graphql.storageUrl }} debug: yes server-type: wsgi +{{ end }} diff --git a/swh-graphql/templates/deployment.yaml b/swh/templates/graphql/deployment.yaml rename from swh-graphql/templates/deployment.yaml rename to swh/templates/graphql/deployment.yaml --- a/swh-graphql/templates/deployment.yaml +++ b/swh/templates/graphql/deployment.yaml @@ -1,3 +1,4 @@ +{{ if .Values.graphql.enabled -}} --- apiVersion: apps/v1 kind: Deployment @@ -7,7 +8,7 @@ labels: app: graphql spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.graphql.replicas }} selector: matchLabels: app: graphql @@ -21,25 +22,25 @@ app: graphql annotations: # Force a rollout upgrade if the configuration changes - checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/graphql/configmap.yaml") . | sha256sum }} spec: containers: - name: graphql - image: {{ .Values.image.name }}:{{ .Values.image.version }} - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: {{ .Values.swh_graphql_image }}:{{ .Values.swh_graphql_image_version }} + imagePullPolicy: Always ports: - containerPort: 5013 env: - name: PORT value: "5013" - name: THREADS - value: {{ .Values.gunicornThreads | quote }} + value: {{ .Values.graphql.gunicorn.threads | quote }} - name: WORKERS - value: {{ .Values.gunicornWorkers | quote }} + value: {{ .Values.graphql.gunicorn.workers | quote }} - name: LOG_LEVEL - value: {{ .Values.logLevel | quote }} + value: {{ .Values.graphql.logLevel | quote }} - name: TIMEOUT - value: {{ .Values.gunicornTimeout | quote }} + value: {{ .Values.graphql.gunicorn.timeout | quote }} volumeMounts: - name: config mountPath: /etc/swh/config.yml @@ -51,3 +52,4 @@ name: graphql defaultMode: 0444 +{{ end }} diff --git a/swh-graphql/templates/ingress.yaml b/swh/templates/graphql/ingress.yaml rename from swh-graphql/templates/ingress.yaml rename to swh/templates/graphql/ingress.yaml --- a/swh-graphql/templates/ingress.yaml +++ b/swh/templates/graphql/ingress.yaml @@ -1,4 +1,5 @@ -{{ if .Values.enableIngress }} +{{ if .Values.graphql.enabled -}} +{{ if .Values.graphql.ingress.enabled -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -7,21 +8,22 @@ annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: - {{- if .Values.ingressClassName }} - ingressClassName: {{ .Values.ingressClassName }} + {{- if .Values.graphql.ingress.className }} + ingressClassName: {{ .Values.graphql.ingress.className }} {{- end }} rules: - http: paths: - - path: {{ .Values.ingressHttpPath }} + - path: {{ .Values.graphql.ingress.httpPath }} pathType: Prefix backend: service: name: graphql port: number: 5013 - {{- if .Values.ingressHost }} - host: {{ .Values.ingressHost }} + {{- if .Values.graphql.ingress.host }} + host: {{ .Values.graphql.ingress.host }} {{- end }} {{ end }} +{{ end }} diff --git a/swh-graphql/templates/service.yaml b/swh/templates/graphql/service.yaml rename from swh-graphql/templates/service.yaml rename to swh/templates/graphql/service.yaml --- a/swh-graphql/templates/service.yaml +++ b/swh/templates/graphql/service.yaml @@ -1,3 +1,4 @@ +{{ if .Values.graphql.enabled -}} --- apiVersion: v1 kind: Service @@ -11,3 +12,4 @@ ports: - port: 5013 targetPort: 5013 +{{ end }} diff --git a/swh/values/default.yaml b/swh/values/default.yaml --- a/swh/values/default.yaml +++ b/swh/values/default.yaml @@ -30,5 +30,16 @@ values: - "true" +graphql: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: swh/rpc + operator: In + values: + - "true" + statsd_exporter: enabled: true diff --git a/swh/values/staging.yaml b/swh/values/staging.yaml --- a/swh/values/staging.yaml +++ b/swh/values/staging.yaml @@ -86,4 +86,14 @@ graphql: enabled: true - + storageUrl: http://webapp.internal.staging.swh.network:5002/ + replicas: 1 + gunicorn: + threads: 4 + Workers: 2 + timeout: 3600 + ingress: + enabled: true + httpPath: / + logLevel: DEBUG + diff --git a/values-swh-application-versions.yaml b/values-swh-application-versions.yaml --- a/values-swh-application-versions.yaml +++ b/values-swh-application-versions.yaml @@ -5,3 +5,5 @@ swh_storage_replayer_image_version: "20220819.1" swh_loaders_image: softwareheritage/loaders swh_loaders_image_version: 2022-05-17 +swh_graphql_image: softwareheritage/graphql +swh_graphql_image_version: latest