This helm chart defines a common structure to deploy a Kubernetes job for an Fybrik module.
The configuration for the chart is in the values file.
- Kubernetes cluster 1.10+
- Helm 3.7.x and above
In Makefile:
- Change
DOCKER_USERNAME,DOCKER_PASSWORD,DOCKER_HOSTNAME,DOCKER_NAMESPACE,DOCKER_TAGNAME,DOCKER_NAME,HELM_TAGto your own preferences.
make docker-buildmake docker-push- When testing the chart, configure settings by editing the
values.yamldirectly. - Modify repository in
values.yamlto your preferred Docker image. - Modify copy/read action as needed with appropriate values.
- At runtime, the
fybrik-managerwill pass in the copy/read values to the module so you can leave them blank in your final chart.
To register HWM (Hello World Module) as a Fybrik module apply hello-world-module.yaml to the fybrik-system namespace of your cluster.
To install the latest release run:
kubectl apply -f https://github.com/fybrik/hello-world-module/releases/latest/download/hello-world-module.yaml -n fybrik-system| Fybrik | HWM | Command |
|---|---|---|
| 0.5.x | 0.5.x | https://github.com/fybrik/hello-world-module/releases/download/v0.5.0/hello-world-module.yaml |
| 0.6.x | 0.6.x | https://github.com/fybrik/hello-world-module/releases/download/v0.6.0/hello-world-module.yaml |
| master | main | https://raw.githubusercontent.com/fybrik/hello-world-module/main/hello-world-module.yaml |
make helm-loginmake helm-verifymake helm-chart-pushmake helm-uninstallFollow this section to deploy and test the module on a single cluster.
Install Fybrik using the Quick Start guide. This sample assumes the use of the built-in catalog, Open Policy Agent (OPA) and flight module.
Notice: Please follow
version compatbility matrixsection above for deploying the correct version of Fybrik and this module. For deploying older versions of hello-world-module please refer to theREADME.mdfile in the relevant release. For older version of Fybrik please follow the instructions in Fybrik site which match the release.
Deploy datashim on the cluster. For deployment options based on your environment please refer to the datashim site.
Deploy FybrikModule in fybrik-system namespace:
kubectl create -f hello-world-module.yaml -n fybrik-system-
Execute all the sections in Fybrik Notebook sample until
Define data access policiessection (excluded). -
Deploy the follwing secret resource and
FybrikStorageAccountresource fromhack/test-moduledirectory. Note that the module version should match the latter version. These resources are used by the Fybrik to allocate a new bucket for the copied resource.
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: bucket-creds
namespace: fybrik-system
type: Opaque
stringData:
access_key: "${ACCESS_KEY}"
accessKeyID: "${ACCESS_KEY}"
secret_key: "${SECRET_KEY}"
secretAccessKey: "${SECRET_KEY}"
EOFDefine the following OpenPolicyAgent policy to allow the write operation:
package dataapi.authz
description := "allow the write operation"
rule[{}] {
input.action.actionType == "write"
true
}In this sample only the policy above is applied. Copy the policy to a file named sample-policy.rego and then run:
kubectl -n fybrik-system create configmap sample-policy --from-file=sample-policy.rego
kubectl -n fybrik-system label configmap sample-policy openpolicyagent.org/policy=rego
while [[ $(kubectl get cm sample-policy -n fybrik-system -o 'jsonpath={.metadata.annotations.openpolicyagent\.org/policy-status}') != '{"status":"ok"}' ]]; do echo "waiting for policy to be applied" && sleep 5; doneDeploy FybrikApplication in default namespace. the resource should be taken from hack/test-module directory. Note that the module version should match the fybrikapplication version.
- Run the following command to wait until the
statusof theFybrikApplicationisready:
while [[ $(kubectl get fybrikapplication my-notebook -n default -o 'jsonpath={.status.ready}') != "true" ]]; do echo "waiting for FybrikApplication" && sleep 5; done- Check if module was triggered:
kubectl get blueprint -n fybrik-system
kubectl describe blueprint my-notebook-default -n fybrik-system
kubectl get job -n fybrik-blueprints
kubectl get pods -n fybrik-blueprintsIf you are using the hello-world-module image, you should see this in the kubectl logs of your completed Pod:
$ kubectl logs my-notebook-default-copy-hello-world-module-chart-xxxx -n fybrik-blueprints
Hello World Module!
Connection name is paysim-csv
Connection format is csv
Vault credential address is http://vault.fybrik-system:8200
Vault credential role is module
Vault credential secret path is /v1/kubernetes-secrets/paysim-csv?namespace=fybrik-notebook-sample
S3 bucket is demo
S3 endpoint is http://localstack.fybrik-notebook-sample.svc.cluster.local:4566
COPY SUCCEEDED
Run the following command to delete the fybrik application:
kubectl delete FybrikApplication my-notebook -n defaultRun the following command to delete the fybrik module:
kubectl delete fybrikmodule hello-world-module -n fybrik-systemPlease execute the Cleanup section from Fybrik notebook sample