Skip to content

Commit

Permalink
add spark to catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Beutl committed Sep 16, 2024
1 parent 513bc7f commit 30f03a1
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
86 changes: 86 additions & 0 deletions package/spark/composition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: sparks.catalog.cluster.local
spec:
compositeTypeRef:
apiVersion: catalog.cluster.local/v1
kind: SparkComposite

writeConnectionSecretsToNamespace: crossplane-system

mode: Pipeline
pipeline:
- step: get-environment-configs
functionRef:
name: crossplane-contrib-function-environment-configs
input:
apiVersion: environmentconfigs.fn.crossplane.io/v1beta1
kind: Input
spec:
environmentConfigs:
- type: Reference
ref:
name: environment

- step: spark
functionRef:
name: crossplane-contrib-function-go-templating
input:
apiVersion: gotemplating.fn.crossplane.io/v1beta1
kind: GoTemplate
source: Inline
inline:
template: |
{{ $host := regexReplaceAll "[^a-z0-9-]" (.observed.composite.resource.spec.claimRef.name | lower) "" }}
{{ $zone := index $.context "apiextensions.crossplane.io/environment" "zone" }}
{{ $claim := .observed.composite.resource.spec.claimRef }}
apiVersion: helm.crossplane.io/v1beta1
kind: Release
metadata:
annotations:
crossplane.io/external-name: {{ $claim.name }}
gotemplating.fn.crossplane.io/composition-resource-name: "helm-release"
spec:
providerConfigRef:
name: provider-helm
forProvider:
chart: # https://artifacthub.io/packages/helm/bitnami/spark
name: spark
repository: oci://registry-1.docker.io/bitnamicharts
version: 9.2.10
namespace: {{ $claim.namespace }}
values:
ingress:
enabled: true
{{- if or ($.observed.composite.resource.spec.ingress.public) (eq $.observed.composite.resource.spec.ingress nil) }}
ingressClassName: nginx
{{- else }}
ingressClassName: nginx-internal
{{- end }}
hostname: {{ $host }}.{{ $zone }}
tls: true
annotations:
kubernetes.io/tls-acme: "true"
fullnameOverride: {{ $claim.name }}
commonLabels:
catalog.cluster.local/kind: {{ $claim.kind }}
catalog.cluster.local/name: {{ $claim.name }}
---
{{ $values := dig "resources" "helm-release" "resource" "spec" "forProvider" "values" dict .observed }}
apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1
kind: CompositeConnectionDetails
{{ if eq $.observed.resources nil }}
data: {}
{{ else }}
data:
host: {{ $values.ingress.hostname | b64enc }}
port: {{ "7077" | b64enc }}
{{ end }}
- step: automatically-detect-ready-composed-resources
functionRef:
name: crossplane-contrib-function-auto-ready
43 changes: 43 additions & 0 deletions package/spark/definition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: sparkcomposites.catalog.cluster.local
spec:
group: catalog.cluster.local
metadata:
labels:
catalog.cluster.local/kind: Spark
annotations:
catalog.cluster.local/title: "Spark"
catalog.cluster.local/description: "Apache Spark is a high-performance engine for large-scale computing tasks, such as data processing, machine learning and real-time data streaming. It includes APIs for Java, Python, Scala and R."
catalog.cluster.local/icon: "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBmaWxsPSIjZTE1OTE5IiBkPSJNNTcuNjQ2LjAwNGMtMi4yNjkuMDY0LTQuNTEgMS4xNDMtNi4zODQgMy4yMjMtMS4wMyAxLjE0Ni0xLjkwNSAyLjUxLTIuNjMgMy44NTUtMS44OSAzLjU0LTIuMjYyIDcuNTQ3LTIuOTYyIDExLjQzbC0zLjg1MiAyMS44MWMtLjE0OC44NTYtLjUzMiAxLjIxLTEuMyAxLjQ1NWwtMjguMjY4IDguOThjLTIuMDYuNjczLTQuMTI1IDEuNTQzLTUuOTQ3IDIuNy01LjU1OCAzLjUzLTYuMzggOS4zMzgtMi4yMDcgMTQuNDM4IDEuODQyIDIuMjU2IDQuMjE2IDMuODQzIDYuODUgNC45OTZsMTcuNjAzIDcuODQzYy4xNDcuMDguMzA0LjEzMi40Nj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IuNzQzIDI0LjE2LjU4NSAxLjIzNy0uMDE1LjAyLTIyLjcyNy02LjI2NC0uMDA2LS4wMTgtNC4yOTgtMS4yMDUtMjUuNDkzIDI4LjI1NiA0LjY2My0zNy4xNS00LjE4NC0xLjgyLjAwOC0uMDA3LTIzLjY3NC05LjRjLjQ1NC0uNDEzLjg2LS41ODUgMS4yODUtLjcxN2wyOC43NzctOS4wOTZjLjY3Ni0uMjEgMS4wNjEtLjQ3IDEuMTI1LTEuMjQybC40MDMtMi4zNTUgMy44NzUtMjEuODA3IDEuMTItNi4xNzR6Ii8+PC9zdmc+"
catalog.cluster.local/maintainer: ""
catalog.cluster.local/url: "https://spark.apache.org/"
catalog.cluster.local/tags: "engine,unmanaged,helm"
names:
kind: SparkComposite
plural: sparkcomposites
claimNames:
kind: Spark
plural: sparks
versions:
- name: v1
served: true
referenceable: true
schema:
openAPIV3Schema:
description: Spark is the Schema for the sparks API
type: object
properties:
spec:
description: SparkSpec defines the desired state of Spark
type: object
properties:
ingress:
type: object
default: {}
properties:
public:
type: boolean
default: true
description: Expose public endpoint (Be aware that your application will be public available on the internet.)

0 comments on commit 30f03a1

Please sign in to comment.