diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 9d61c95..8904493 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -19,6 +19,15 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Install Helm dependencies + run: | + # Iterate over all charts in the zazuko directory + for chart in zazuko/*; do + echo "- ${chart}" + helm dependency update "${chart}" + echo "" + done + - name: Lint Helm Charts run: | helm lint zazuko/* diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8710cb1..948d2b8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,6 +26,15 @@ jobs: - name: Install Helm uses: azure/setup-helm@v4 + - name: Install Helm dependencies + run: | + # Iterate over all charts in the zazuko directory + for chart in zazuko/*; do + echo "- ${chart}" + helm dependency update "${chart}" + echo "" + done + - name: Run helm-docs uses: losisin/helm-docs-github-action@v1.3.0 with: diff --git a/zazuko/blueprint/.helmignore b/zazuko/blueprint/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/zazuko/blueprint/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/zazuko/blueprint/Chart.lock b/zazuko/blueprint/Chart.lock new file mode 100644 index 0000000..58e1eff --- /dev/null +++ b/zazuko/blueprint/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: trifid + repository: https://charts.zazuko.com + version: 0.1.7 +- name: fuseki + repository: https://charts.zazuko.com + version: 0.0.5 +digest: sha256:969373b1aaf41eb1e38722a610488abfe74bbee03af87cdd863b88c5f35947ef +generated: "2024-08-07T08:22:47.980467+02:00" diff --git a/zazuko/blueprint/Chart.yaml b/zazuko/blueprint/Chart.yaml new file mode 100644 index 0000000..e2486c8 --- /dev/null +++ b/zazuko/blueprint/Chart.yaml @@ -0,0 +1,48 @@ +apiVersion: v2 +name: blueprint +description: Zazuko Blueprint is an enterprise knowledge graph frontend and browser, designed to make RDF Knowledge Graphs accessible and customizable for domain users +home: https://github.com/zazuko/blueprint +icon: https://charts.zazuko.com/icons/logo-blueprint.svg + +# 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.0.1 + +# 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: "v0.1.0" + +annotations: + artifacthub.io/license: Apache-2.0 + artifacthub.io/links: | + - name: Chart Source + url: https://github.com/zazuko/helm-charts/tree/main/zazuko/blueprint + - name: GitHub Repository + url: https://github.com/zazuko/blueprint + - name: Zazuko + url: https://www.zazuko.com/ + - name: support + url: https://github.com/zazuko/helm-charts/issues + +dependencies: + - name: trifid + version: 0.1.7 + repository: "https://charts.zazuko.com" + condition: trifid.enabled + - name: fuseki + version: 0.0.5 + repository: "https://charts.zazuko.com" + condition: fuseki.enabled diff --git a/zazuko/blueprint/templates/NOTES.txt b/zazuko/blueprint/templates/NOTES.txt new file mode 100644 index 0000000..bfefe59 --- /dev/null +++ b/zazuko/blueprint/templates/NOTES.txt @@ -0,0 +1,5 @@ +Thanks for using our Helm Chart! + +To report any issue: +- about the Helm Chart: https://github.com/zazuko/helm-charts +- about Zazuko Blueprint itself: https://github.com/zazuko/blueprint diff --git a/zazuko/blueprint/templates/_helpers.tpl b/zazuko/blueprint/templates/_helpers.tpl new file mode 100644 index 0000000..eba7555 --- /dev/null +++ b/zazuko/blueprint/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "blueprint.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "blueprint.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blueprint.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "blueprint.labels" -}} +helm.sh/chart: {{ include "blueprint.chart" . }} +{{ include "blueprint.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "blueprint.selectorLabels" -}} +app.kubernetes.io/name: {{ include "blueprint.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "blueprint.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "blueprint.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/zazuko/blueprint/templates/deployment.yaml b/zazuko/blueprint/templates/deployment.yaml new file mode 100644 index 0000000..3fe14f3 --- /dev/null +++ b/zazuko/blueprint/templates/deployment.yaml @@ -0,0 +1,84 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "blueprint.fullname" . }} + labels: + {{- include "blueprint.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "blueprint.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "blueprint.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "blueprint.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + env: + - name: ENDPOINT_URL + value: {{ .Values.endpointUrl | quote }} + - name: SPARQL_CONSOLE_URL + value: {{ .Values.sparqlConsoleUrl | quote }} + - name: GRAPH_EXPLORER_URL + value: {{ .Values.graphExplorerUrl | quote }} + - name: FULL_TEXT_SEARCH_DIALECT + value: {{ .Values.fullTextSearchDialect | quote }} + {{- if .Values.fullTextSearchDialect }} + - name: NEPTUNE_FTS_ENDPOINT + value: {{ .Values.neptuneFtsEndpoint | quote }} + {{- end }} + {{- with .Values.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/zazuko/blueprint/templates/hpa.yaml b/zazuko/blueprint/templates/hpa.yaml new file mode 100644 index 0000000..39524f2 --- /dev/null +++ b/zazuko/blueprint/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "blueprint.fullname" . }} + labels: + {{- include "blueprint.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "blueprint.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/zazuko/blueprint/templates/ingress.yaml b/zazuko/blueprint/templates/ingress.yaml new file mode 100644 index 0000000..057191a --- /dev/null +++ b/zazuko/blueprint/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "blueprint.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "blueprint.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/zazuko/blueprint/templates/service.yaml b/zazuko/blueprint/templates/service.yaml new file mode 100644 index 0000000..f7b1009 --- /dev/null +++ b/zazuko/blueprint/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "blueprint.fullname" . }} + labels: + {{- include "blueprint.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "blueprint.selectorLabels" . | nindent 4 }} diff --git a/zazuko/blueprint/templates/serviceaccount.yaml b/zazuko/blueprint/templates/serviceaccount.yaml new file mode 100644 index 0000000..e607f05 --- /dev/null +++ b/zazuko/blueprint/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "blueprint.serviceAccountName" . }} + labels: + {{- include "blueprint.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/zazuko/blueprint/templates/tests/test-connection.yaml b/zazuko/blueprint/templates/tests/test-connection.yaml new file mode 100644 index 0000000..fed06bf --- /dev/null +++ b/zazuko/blueprint/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "blueprint.fullname" . }}-test-connection" + labels: + {{- include "blueprint.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "blueprint.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/zazuko/blueprint/values.yaml b/zazuko/blueprint/values.yaml new file mode 100644 index 0000000..ba6457e --- /dev/null +++ b/zazuko/blueprint/values.yaml @@ -0,0 +1,265 @@ +# Blueprint configuration + +## In case you want to use Trifid and Fuseki, you can enable them with `trifid.enabled` and `fuseki.enabled` set to `true`. +## Replace `example.com` in the `endpointUrl`, `sparqlConsoleUrl` and `graphExplorerUrl` fields with the exposed URL of your Trifid instance (see `trifid.ingress` section). + +# -- endpointUrl is the SPARQL endpoint URL +endpointUrl: http://example.com/query +# -- sparqlConsoleUrl is the SPARQL console URL +sparqlConsoleUrl: http://example.com/sparql/#query +# -- graphExplorerUrl is the Graph Explorer URL +graphExplorerUrl: http://example.com/graph-explorer/?resource +# -- fullTextSearchDialect is the full text search dialect +fullTextSearchDialect: fuseki +# -- neptuneFtsEndpoint (in case fullTextSearchDialect is "neptune") is the Neptune FTS endpoint +neptuneFtsEndpoint: "" + +# Trifid configuration +trifid: + # -- enabled tells if a Trifid instance should be deployed + enabled: false + + # Information about the SPARQL endpoint + sparql: + # -- endpoint is the URL of the SPARQL endpoint (required) + endpoint: "http://blueprint-fuseki:3030/query" + # -- username for the SPARQL endpoint + username: "" + # -- password for the SPARQL endpoint + password: "" + + # Changes to the Trifid configuration + config: + # -- file is the path to the Trifid configuration file + file: "" + + # Set the base URL for the dataset, to allow some rewriting features + dataset: + # -- baseUrl is the base URL for the dataset + baseUrl: "" + + # Ingress configuration + ingress: + # -- enabled allows you to enable or disable the Ingress + enabled: false + # -- className is the ingress class to use + className: "" + # -- annotations to add to the Ingress + annotations: + {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + + ## Make sure to configure the following fields if you enable the Ingress + # -- hosts is the list of hostnames to be exposed + hosts: + [] + # - host: trifid-example.local + # paths: + # - path: / + # pathType: ImplementationSpecific + # -- tls is the list of TLS configuration + tls: [] + # - secretName: trifid-example-tls + # hosts: + # - trifid-example.local + + # More fields can be added here, see the Trifid values.yaml for more options + +# Fuseki configuration +fuseki: + # -- enabled tells if a Fuseki instance should be deployed + enabled: false + + # Configuration + config: + # -- adminPassword is the password for the admin user + adminPassword: super-secret-password + # -- javaOpts is the Java options to use + javaOpts: "-Xmx2048m -Xms2048m" + # -- disableOtel tells if OpenTelemetry should be disabled + disableOtel: true + + # Storage configuration (for persistent storage) + storage: + # -- enabled tells if the storage should be enabled + enabled: true + # -- size is the size of the storage to use + size: 10Gi + # -- storageClass is the storage class to use + storageClass: "" + # -- accessMode is the access mode to use + accessMode: ReadWriteOnce + # -- existingClaim is the name of an existing PVC to use + existingClaim: "" + # -- mountPath is the path to mount the storage + mountPath: /fuseki/databases/ds/ + + # -- fullnameOverride overrides the full name of the chart + ## Make sure that this is unique within the namespace + ## If you are using the embedded Trifid, you should also update the `trifid.sparql.endpoint` field + fullnameOverride: "blueprint-fuseki" + + # More fields can be added here, see the Fuseki values.yaml for more options + +# -- replicaCount is the number of replicas to deploy +replicaCount: 1 + +# Information about the Blueprint Docker image to use. +# In case you want to use a custom image, you can set the repository and tag here. +image: + # -- repository is the Docker image to use + repository: ghcr.io/zazuko/blueprint + # -- pullPolicy is the policy to use when pulling the image + pullPolicy: IfNotPresent + # -- tag is used to overrides the image tag whose default is the chart appVersion + tag: "" + +# -- extraEnv is a list of extra environment variables to set +extraEnv: + [] + # - name: MY_ENV_VAR + # value: my-value + +# -- imagePullSecrets used to pull the Docker image +imagePullSecrets: [] +# -- nameOverride overrides the chart name +nameOverride: "" +# -- fullnameOverride overrides the full name of the chart +fullnameOverride: "" + +# Service account configuration +serviceAccount: + # -- create tells if a service account should be created + create: false + # -- automount tells if the service account should be automounted + automount: true + # -- annotations to add to the service account + annotations: {} + # -- name is the name of the service account to use + name: "" + +# -- podAnnotations to use +podAnnotations: {} +# -- podLabels to use +podLabels: {} + +# Pod security context configuration +podSecurityContext: + # -- fsGroup is the group ID to run the container as + fsGroup: 0 + # -- runAsGroup is the group ID to run the container as + runAsGroup: 0 + # -- runAsNonRoot tells if the container should run as a non-root user + runAsNonRoot: false + # -- runAsUser is the user ID to run the container as + runAsUser: 0 + +# Security context configuration +securityContext: + # -- allowPrivilegeEscalation tells if the container can request to allow privilege escalation + allowPrivilegeEscalation: false + # -- capabilities to add/drop + capabilities: {} + # -- privileged tells if the container is privileged + privileged: false + # -- runAsNonRoot tells if the container should run as a non-root user + runAsNonRoot: false + # -- runAsUser is the user ID to run the container as + runAsUser: 0 + # -- readOnlyRootFilesystem tells if the container should have a read-only root filesystem + readOnlyRootFilesystem: false + # -- seLinuxOptions to add + seLinuxOptions: {} + +# Service configuration +service: + # -- type is the type of service to create + type: ClusterIP + # -- port is the port the service will listen on + port: 80 + +# Ingress configuration +ingress: + # -- enabled allows you to enable or disable the Ingress + enabled: false + # -- className is the ingress class to use + className: "" + # -- annotations to add to the Ingress + annotations: + {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- hosts is the list of hostnames to be exposed + hosts: + [] + # - host: blueprint-example.local + # paths: + # - path: / + # pathType: ImplementationSpecific + # -- tls is the list of TLS configuration + tls: [] + # - secretName: blueprint-example-tls + # hosts: + # - blueprint-example.local + +# -- resources to request for the pod +resources: + {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# -- livenessProbe is a health check to determine if the container is still running +livenessProbe: + httpGet: + path: "/" + port: http + +# -- readinessProbe is a health check to determine if the container is ready to serve traffic +readinessProbe: + httpGet: + path: "/" + port: http + +# Configure autoscaling +autoscaling: + # -- enabled allows you to enable or disable autoscaling + enabled: false + # -- minReplicas is the minimum number of replicas that will be set when autoscaling is enabled + minReplicas: 1 + # -- maxReplicas is the maximum number of replicas that will be set when autoscaling is enabled + maxReplicas: 100 + # -- targetCPUUtilizationPercentage is the target average CPU utilization across all pods + targetCPUUtilizationPercentage: 80 + # -- targetMemoryUtilizationPercentage is the target average memory utilization across all pods + targetMemoryUtilizationPercentage: 80 + +# -- volumes to mount on the output Deployment definition +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# -- volume mounts to use +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +# -- nodeSelector to use +nodeSelector: {} + +# -- tolerations to use +tolerations: [] + +# -- affinity to use +affinity: {}