diff --git a/deployment/Chart.yaml b/deployment/Chart.yaml index 5cb39a5..b099360 100644 --- a/deployment/Chart.yaml +++ b/deployment/Chart.yaml @@ -1,21 +1,6 @@ apiVersion: v2 name: cloud-registry description: A Helm chart for Kubernetes - -# 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. -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. -appVersion: 1.16.0 +version: 2.0.0 +appVersion: 2.0.0 diff --git a/deployment/templates/NOTES.txt b/deployment/templates/NOTES.txt new file mode 100644 index 0000000..952aeb5 --- /dev/null +++ b/deployment/templates/NOTES.txt @@ -0,0 +1,11 @@ +Elixir Cloud Service Registry is being deployed! + +Once deployed: + + 1. Access the API via https://{{ .Values.host_name }}/ga4gh/registry/v1/ + + To test the connection, you can run: + + curl -X GET "https://{{ .Values.host_name }}/ga4gh/registry/v1/service-info" -H "Accept: application/json" -H "Authorization: Bearer {TOKEN}" + + 2. Access the Swagger UI via https://{{ .Values.host_name }}/ga4gh/registry/v1/ui diff --git a/deployment/templates/cloud-registry-configmap-job.yaml b/deployment/templates/cloud-registry-configmap-job.yaml index 8024999..f707332 100644 --- a/deployment/templates/cloud-registry-configmap-job.yaml +++ b/deployment/templates/cloud-registry-configmap-job.yaml @@ -29,10 +29,9 @@ spec: - name: HOST_NAME value: {{ .Values.host_name }} - name: MONGO_HOST - value: mongodb-{{ .Values.cloud-registry.appName }} + value: mongodb restartPolicy: Never serviceAccountName: {{ .Values.cloud_registry.appName }}-configurer -status: {} --- apiVersion: v1 kind: ServiceAccount diff --git a/deployment/templates/cloud-registry-deploy.yaml b/deployment/templates/cloud-registry-deploy.yaml index bfbf2b6..30d4c19 100644 --- a/deployment/templates/cloud-registry-deploy.yaml +++ b/deployment/templates/cloud-registry-deploy.yaml @@ -27,7 +27,7 @@ spec: ports: - containerPort: 8080 protocol: TCP - resources: {} + resources: {{- toYaml .Values.cloud_registry.resources | nindent 10 }} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: @@ -47,4 +47,3 @@ spec: path: config.yaml name: app-config name: config-yaml -status: diff --git a/deployment/templates/cloud-registry-ingress.yaml b/deployment/templates/cloud-registry-ingress.yaml new file mode 100644 index 0000000..0b71862 --- /dev/null +++ b/deployment/templates/cloud-registry-ingress.yaml @@ -0,0 +1,29 @@ +{{ if .Values.cloud_registry.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + {{- if .Values.cloud_registry.ingress.https.enabled }} + cert-manager.io/cluster-issuer: {{ .Values.cloud_registry.ingress.https.issuer }} + kubernetes.io/tls-acme: "true" + {{- end }} + name: {{ .Values.cloud_registry.appName }} +spec: + rules: + - host: {{ .Values.host_name }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Values.cloud_registry.appName }} + port: + number: 8080 +{{- if .Values.cloud_registry.ingress.https.enabled }} + tls: + - hosts: + - {{ .Values.host_name }} + secretName: {{ .Values.cloud_registry.appName }}-ingress-secret +{{- end }} +{{ end }} diff --git a/deployment/templates/cloud-registry-route.yaml b/deployment/templates/cloud-registry-route.yaml index 8f40efb..c96361f 100644 --- a/deployment/templates/cloud-registry-route.yaml +++ b/deployment/templates/cloud-registry-route.yaml @@ -1,4 +1,4 @@ -{{ if .Capabilities.APIVersions.Has "route.openshift.io/v1" }} +{{ if (and (.Capabilities.APIVersions.Has "route.openshift.io/v1") (not .Values.cloud_registry.ingress.enabled)) }} apiVersion: route.openshift.io/v1 kind: Route metadata: @@ -15,6 +15,4 @@ spec: name: {{ .Values.cloud_registry.appName }} weight: 100 wildcardPolicy: None -status: - ingress: [] {{ end }} diff --git a/deployment/templates/cloud-registry-service.yaml b/deployment/templates/cloud-registry-service.yaml index 3bce2f2..9daaec9 100644 --- a/deployment/templates/cloud-registry-service.yaml +++ b/deployment/templates/cloud-registry-service.yaml @@ -12,5 +12,3 @@ spec: app: {{ .Values.cloud_registry.appName }} sessionAffinity: None type: ClusterIP -status: - loadBalancer: {} diff --git a/deployment/templates/mongo-deploy.yaml b/deployment/templates/mongo-deploy.yaml index a4afc80..36f9673 100644 --- a/deployment/templates/mongo-deploy.yaml +++ b/deployment/templates/mongo-deploy.yaml @@ -27,12 +27,15 @@ spec: ports: - containerPort: 27017 protocol: TCP - resources: {} + resources: {{- toYaml .Values.mongodb.resources | nindent 10 }} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /data/db/ name: mongodb + - name: init-script + mountPath: /docker-entrypoint-initdb.d/init-script.js + subPath: init-script.js dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler @@ -42,4 +45,6 @@ spec: - name: mongodb persistentVolumeClaim: claimName: mongodb -status: + - name: init-script + configMap: + name: mongo-init-script diff --git a/deployment/templates/mongo-init-script.yaml b/deployment/templates/mongo-init-script.yaml new file mode 100644 index 0000000..72d66c8 --- /dev/null +++ b/deployment/templates/mongo-init-script.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: mongo-init-script +data: + init-script.js: | + db = db.getSiblingDB('serviceStore'); + + // Create the 'services' and 'service_info' collections + // Database configuration from https://github.com/elixir-cloud-aai/cloud-registry/blob/fa8a1b0dd1361751574550116150a630035dc199/cloud_registry/config.yaml#L32 + db.createCollection('services'); + db.services.createIndex( + { id: 1 }, + { unique: true } + ); + db.createCollection('service_info'); + db.service_info.createIndex( + { id: 1 }, + { unique: true } + ); + diff --git a/deployment/templates/mongo-pvc.yaml b/deployment/templates/mongo-pvc.yaml index ef8989d..5b51178 100644 --- a/deployment/templates/mongo-pvc.yaml +++ b/deployment/templates/mongo-pvc.yaml @@ -8,4 +8,3 @@ spec: resources: requests: storage: {{ .Values.mongodb.volumeSize }} -status: diff --git a/deployment/templates/mongo-service.yaml b/deployment/templates/mongo-service.yaml index 22959a9..1c407a4 100644 --- a/deployment/templates/mongo-service.yaml +++ b/deployment/templates/mongo-service.yaml @@ -14,5 +14,3 @@ spec: app: mongodb sessionAffinity: None type: ClusterIP -status: - loadBalancer: {} diff --git a/deployment/values.yaml b/deployment/values.yaml index 06c8e11..36ee9b2 100644 --- a/deployment/values.yaml +++ b/deployment/values.yaml @@ -2,14 +2,35 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -host_name: cloud-registry.rahtiapp.fi +host_name: "" cloud_registry: - image: elixircloud/cloud-registry:0.1.0 + image: elixircloud/cloud-registry:20240716 appName: cloud-registry + # if ingress.enabled: false, it will deploy an OpenShift Route (https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/network_apis/route-route-openshift-io-v1) + ingress: + enabled: true + https: + enabled: false + issuer: letsencrypt-prod + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi apiServer: kubernetes.default.svc:443 # address of k8s API server mongodb: - image: mongo:3.6 + image: docker.io/library/mongo:noble volumeSize: 1Gi + resources: + limits: + cpu: 200m + memory: 512Mi + requests: + cpu: 200m + memory: 512Mi +