diff --git a/swh-graphql/Chart.yaml b/swh-graphql/Chart.yaml deleted file mode 100644 index 8441941..0000000 --- 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 index 1e8f3ff..0000000 --- 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 index 61b5dde..0000000 --- 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 index 9206a8c..0000000 --- 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 index 7176192..0000000 --- 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 similarity index 68% rename from swh-graphql/templates/configmap.yaml rename to swh/templates/graphql/configmap.yaml index 81e6b99..1824633 100644 --- a/swh-graphql/templates/configmap.yaml +++ b/swh/templates/graphql/configmap.yaml @@ -1,15 +1,17 @@ +{{ if .Values.graphql.enabled -}} --- apiVersion: v1 kind: ConfigMap metadata: name: graphql namespace: {{ .Values.namespace }} data: 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 similarity index 66% rename from swh-graphql/templates/deployment.yaml rename to swh/templates/graphql/deployment.yaml index 5ccae45..4b69a0e 100644 --- a/swh-graphql/templates/deployment.yaml +++ b/swh/templates/graphql/deployment.yaml @@ -1,53 +1,55 @@ +{{ if .Values.graphql.enabled -}} --- apiVersion: apps/v1 kind: Deployment metadata: name: graphql namespace: {{ .Values.namespace }} labels: app: graphql spec: - replicas: {{ .Values.replicas }} + replicas: {{ .Values.graphql.replicas }} selector: matchLabels: app: graphql strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 template: metadata: labels: 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 subPath: config.yml readOnly: true volumes: - name: config configMap: name: graphql defaultMode: 0444 +{{ end }} diff --git a/swh-graphql/templates/ingress.yaml b/swh/templates/graphql/ingress.yaml similarity index 54% rename from swh-graphql/templates/ingress.yaml rename to swh/templates/graphql/ingress.yaml index 715a8ff..f43970d 100644 --- a/swh-graphql/templates/ingress.yaml +++ b/swh/templates/graphql/ingress.yaml @@ -1,27 +1,29 @@ -{{ if .Values.enableIngress }} +{{ if .Values.graphql.enabled -}} +{{ if .Values.graphql.ingress.enabled -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: {{ .Values.namespace }} name: graphql-ingress 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 similarity index 81% rename from swh-graphql/templates/service.yaml rename to swh/templates/graphql/service.yaml index b983d61..93d62f1 100644 --- a/swh-graphql/templates/service.yaml +++ b/swh/templates/graphql/service.yaml @@ -1,13 +1,15 @@ +{{ if .Values.graphql.enabled -}} --- apiVersion: v1 kind: Service metadata: name: graphql namespace: {{ .Values.namespace }} spec: type: ClusterIP selector: app: graphql ports: - port: 5013 targetPort: 5013 +{{ end }} diff --git a/swh/values/default.yaml b/swh/values/default.yaml index b5b4000..d20de4b 100644 --- a/swh/values/default.yaml +++ b/swh/values/default.yaml @@ -1,34 +1,45 @@ namespace: swh storage_replayer: storageClass: cassandra # only cassandra is currently supported maxMessagesBytes: "524288000" journalBrokers: # The name of the secret containing the BROKER_USER_PASSWORD value secretName: storage-replayer-broker-secret cassandra: keySpace: swh consistencyLevel: LOCAL_QUORUM affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: node-role.kubernetes.io/etcd operator: NotIn values: - "true" loaders: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: "swh/loader" operator: In 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 index 00b34cb..d7290ae 100644 --- a/swh/values/staging.yaml +++ b/swh/values/staging.yaml @@ -1,89 +1,99 @@ sentry: environment: staging loaders: enabled: true storage: host: storage1.internal.staging.swh.network port: 5002 amqp: host: scheduler0.internal.staging.swh.network deployments: # bzr: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.bzr.tasks.LoadBazaar # autoScaling: # queueThreshold: 10 # minReplicacount: 1 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.bzr # cvs: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.cvs.tasks.LoadCvsRepository # autoScaling: # queueThreshold: 10 # minReplicacount: 1 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.cvs git: requestedMemory: 256Mi requestedCpu: 200m queues: - swh.loader.git.tasks.UpdateGitRepository - swh.loader.git.tasks.LoadDiskGitRepository - swh.loader.git.tasks.UncompressAndLoadDiskGitRepository autoScaling: queueThreshold: 5 # spawn worker per increment of `value` messages minReplicacount: 1 maxReplicaCount: 3 sentrySwhPackage: swh.loader.git # maven: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.package.maven.tasks.LoadMaven # autoScaling: # queueThreshold: 10 # minReplicacount: 1 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.core # npm: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.package.npm.tasks.LoadNpm # autoScaling: # queueThreshold: 10 # minReplicacount: 1 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.core # pypi: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.package.pypi.tasks.LoadPyPI # autoScaling: # queueThreshold: 10 # minReplicacount: 1 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.core # svn: # requestedMemory: 256Mi # requestedCpu: 200m # queues: # - swh.loader.svn.tasks.LoadSvnRepository # - swh.loader.svn.tasks.MountAndLoadSvnRepository # - swh.loader.svn.tasks.DumpMountAndLoadSvnRepository # autoScaling: # queueThreshold: 10 # minReplicacount: 1 # maxReplicaCount: 3 # sentrySwhPackage: swh.loader.svn 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 index 593140b..fa20cb6 100644 --- a/values-swh-application-versions.yaml +++ b/values-swh-application-versions.yaml @@ -1,7 +1,9 @@ # This file references the last version of all the softwareheritage images # It's used to manage the automatic update of the environments swh_storage_replayer_image: softwareheritage/storage-replayer 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