diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76c9748..786ce5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,4 +15,4 @@ jobs: - uses: actions/checkout@v3 - name: Run vshnpostgresql - run: make vshnpostgresql + run: make vshnpostgresql -e enable_xfn=false diff --git a/Makefile b/Makefile index 21f82ab..1ca6cf9 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ include kind/kind.mk appcat-apiserver: vshnpostgresql ## Install appcat-apiserver dependencies .PHONY: vshnpostgresql -vshnpostgresql: certmanager-setup stackgres-setup prometheus-setup ## Install vshn postgres dependencies +vshnpostgresql: certmanager-setup stackgres-setup prometheus-setup minio-setup ## Install vshn postgres dependencies .PHONY: help help: ## Show this help @@ -37,9 +37,10 @@ $(crossplane_sentinel): kind-setup local-pv-setup load-comp-image --set "args[0]='--debug'" \ --set "args[1]='--enable-composition-functions'" \ --set "args[2]='--enable-environment-configs'" \ - --set "xfn.enabled=true" \ + --set "xfn.enabled=$(enable_xfn)" \ --set "xfn.args[0]='--log-level'" \ --set "xfn.args[1]='1'" \ + --set "xfn.args[2]='--devmode'" \ --set "xfn.image.repository=ghcr.io/vshn/appcat" \ --set "xfn.image.tag=latest" \ --wait @@ -67,9 +68,9 @@ certmanager-setup: $(crossplane_sentinel) minio-setup: export KUBECONFIG = $(KIND_KUBECONFIG) minio-setup: crossplane-setup ## Install Minio Crossplane implementation - kubectl apply -f minio/s3-composite.yaml - kubectl apply -f minio/s3-composition.yaml - kubectl wait --for condition=Offered compositeresourcedefinition/xs3buckets.syn.tools + helm repo add minio https://charts.min.io/ || true + helm upgrade --install --create-namespace --namespace minio minio --version 5.0.7 minio/minio \ + --values minio/values.yaml k8up-setup: minio-setup prometheus-setup $(k8up_sentinel) ## Install K8up operator diff --git a/Makefile.vars.mk b/Makefile.vars.mk index f47b29f..e6d9a44 100644 --- a/Makefile.vars.mk +++ b/Makefile.vars.mk @@ -3,6 +3,7 @@ crossplane_sentinel = $(kind_dir)/crossplane-sentinel k8up_sentinel = $(kind_dir)/k8up-sentinel prometheus_sentinel = $(kind_dir)/prometheus-sentinel local_pv_sentinel = $(kind_dir)/local_pv +enable_xfn = true PROJECT_ROOT_DIR = . PROJECT_NAME ?= kindev diff --git a/minio/s3-composite.yaml b/minio/s3-composite.yaml deleted file mode 100644 index a29c720..0000000 --- a/minio/s3-composite.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: apiextensions.crossplane.io/v1 -kind: CompositeResourceDefinition -metadata: - annotations: - service.syn.tools/description: S3 Bucket on a supported platform - name: xs3buckets.syn.tools -spec: - connectionSecretKeys: - - endpoint - - accessKey - - secretKey - group: syn.tools - names: - kind: XS3Bucket - plural: xs3buckets - claimNames: - kind: S3Bucket - plural: s3buckets - defaultCompositionRef: - name: s3bucket - versions: - - additionalPrinterColumns: - # - jsonPath: .spec.parameters.resources.storageSize - # name: Storage - # type: string - name: v1 - referenceable: true - served: true - schema: - openAPIV3Schema: - type: object - properties: - status: - type: object - properties: - bucketName: - type: string - endpoint: - type: string diff --git a/minio/s3-composition.yaml b/minio/s3-composition.yaml deleted file mode 100644 index 9408bbc..0000000 --- a/minio/s3-composition.yaml +++ /dev/null @@ -1,178 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - name: crossplane-minio ---- -apiVersion: apiextensions.crossplane.io/v1 -kind: Composition -metadata: - labels: - service.syn.tools/cluster: appc-service1 - name: s3bucket -spec: - compositeTypeRef: - apiVersion: syn.tools/v1 - kind: XS3Bucket - writeConnectionSecretsToNamespace: crossplane-minio - resources: - - base: - apiVersion: v1 - kind: Namespace # Let the composition manage the namespace, Crossplane will clean it up if deprovisioned - metadata: - name: "" # patched from composite name - patches: - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: metadata.name - transforms: - - type: string - string: - fmt: "sv-minio-%s" - readinessChecks: - - type: MatchString - fieldPath: status.phase - matchString: Active - - base: - apiVersion: v1 - kind: Secret - metadata: - annotations: - secret-generator.v1.mittwald.de/encoding: hex - secret-generator.v1.mittwald.de/autogenerate: accessKey,secretKey - patches: - - fromFieldPath: spec.writeConnectionSecretToRef.namespace - toFieldPath: metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: metadata.name - readinessChecks: - - type: NonEmpty - fieldPath: data.accessKey - - type: NonEmpty - fieldPath: data.secretKey - - connectionDetails: - - fromConnectionSecretKey: endpoint - - fromConnectionSecretKey: accessKey - - fromConnectionSecretKey: secretKey - base: - apiVersion: helm.crossplane.io/v1beta1 - kind: Release - spec: - connectionDetails: - - apiVersion: v1 - kind: Service - name: minio-server - fieldPath: spec.clusterIP - toConnectionSecretKey: endpoint - - apiVersion: v1 - kind: Secret - name: minio-server - fieldPath: data.rootUser - toConnectionSecretKey: accessKey - - apiVersion: v1 - kind: Secret - name: minio-server - fieldPath: data.rootPassword - toConnectionSecretKey: secretKey - writeConnectionSecretToRef: # the secret the user gets - name: "" # patched from instance name - namespace: "" # patched from instance namespace - providerConfigRef: - name: appc-service1 - forProvider: - wait: true - chart: - name: minio - repository: https://charts.min.io/ - version: 3.5.9 - set: - # normally we shouldn't user root user, but this is a prototype with Minio - # Plus, a default bucket with the same name gets created and granted access - - name: rootUser - valueFrom: - secretKeyRef: - key: accessKey - name: "" # patched from composite - namespace: crossplane-minio - - name: rootPassword - valueFrom: - secretKeyRef: - key: secretKey - name: "" # patched from composite - namespace: crossplane-minio - values: - fullnameOverride: minio-server - replicas: 1 - resources: - requests: - memory: 128Mi - persistence: - size: 1Gi - mode: standalone - buckets: - - name: "" # patched from instance name - policy: none - deletionPolicy: Delete - rollbackLimit: 3 - patches: - - fromFieldPath: metadata.labels - - fromFieldPath: metadata.annotations - # Patch connection secret name - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: spec.forProvider.set[0].valueFrom.secretKeyRef.name - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: spec.forProvider.set[1].valueFrom.secretKeyRef.name - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.writeConnectionSecretToRef.name - # bucket name - - type: CombineFromComposite - combine: - variables: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - strategy: string - string: - fmt: "%s-%s" - toFieldPath: spec.forProvider.values.buckets[0].name - - type: CombineToComposite - combine: - variables: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - strategy: string - string: - fmt: "%s-%s" - toFieldPath: status.bucketName - - type: ToCompositeFieldPath - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: status.endpoint - transforms: - - type: string - string: - fmt: "http://minio-server.sv-minio-%s.svc.cluster.local:9000" - # Namespace patches - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.writeConnectionSecretToRef.namespace - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: spec.forProvider.namespace - transforms: - - type: string - string: - fmt: "sv-minio-%s" - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: spec.connectionDetails[0].namespace - transforms: - - type: string - string: - fmt: "sv-minio-%s" - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: spec.connectionDetails[1].namespace - transforms: - - type: string - string: - fmt: "sv-minio-%s" - - fromFieldPath: metadata.labels[crossplane.io/composite] - toFieldPath: spec.connectionDetails[2].namespace - transforms: - - type: string - string: - fmt: "sv-minio-%s" diff --git a/minio/values.yaml b/minio/values.yaml new file mode 100644 index 0000000..01b0a47 --- /dev/null +++ b/minio/values.yaml @@ -0,0 +1,10 @@ +fullnameOverride: minio-server +mode: standalone +persistence: + size: 1Gi +replicas: 1 +resources: + requests: + memory: 128Mi +rootUser: minioadmin +rootPassword: minioadmin