From e499ec8b59586343b6110b29133318daca669016 Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Thu, 11 May 2023 00:01:20 +0300 Subject: [PATCH 1/9] First code dump of the Go-module, including all the code, helm chart and README Signed-off-by: Arad Halevy --- Dockerfile | 16 +++ Makefile | 62 ++++++++ README.md | 217 +++++++++++++++++++++++++++- conf.sample.yaml | 14 ++ fybrikapplication.yaml | 18 +++ go.mod | 48 +++++++ go.sum | 129 +++++++++++++++++ helm/Chart.yaml | 4 + helm/files/conf.yaml | 39 ++++++ helm/templates/_helpers.tpl | 64 +++++++++ helm/templates/configmap.yaml | 11 ++ helm/templates/deployment.yaml | 95 +++++++++++++ helm/templates/service.yaml | 19 +++ helm/templates/serviceaccount.yaml | 8 ++ helm/values.yaml | 78 +++++++++++ main.go | 218 +++++++++++++++++++++++++++++ module.yaml | 32 +++++ 17 files changed, 1071 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 conf.sample.yaml create mode 100644 fybrikapplication.yaml create mode 100644 go.mod create mode 100644 go.sum create mode 100644 helm/Chart.yaml create mode 100644 helm/files/conf.yaml create mode 100644 helm/templates/_helpers.tpl create mode 100644 helm/templates/configmap.yaml create mode 100644 helm/templates/deployment.yaml create mode 100644 helm/templates/service.yaml create mode 100644 helm/templates/serviceaccount.yaml create mode 100644 helm/values.yaml create mode 100644 main.go create mode 100644 module.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e2d3bee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.18-alpine + +WORKDIR / +COPY go.mod ./ +COPY go.sum ./ +RUN go mod download + +COPY main.go ./ + +RUN chmod +rwx ./tmp + +EXPOSE 8080 + +RUN go build -o go-module-server main.go + +CMD [ "/go-module-server" ] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c817325 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +DOCKER_NAME = go-module +DOCKER_HOSTNAME = ghcr.io +DOCKER_NAMESPACE = aradhalevy +DOCKER_TAG ?= master + +TEMP := /tmp +CHART_LOCAL_PATH ?= helm +CHART_NAME ?= go-module-chart +HELM_RELEASE ?= rel1-${DOCKER_NAME} +HELM_TAG ?= 0.0.0 + +FYBRIKAPPLICATION_NAME ?= my-notebook +FYBRIKAPPLICATION_YAML ?= fybrikapplication.yaml +FYBRIK_NAMESPACE ?= fybrik-notebook-sample + + +IMG := ${DOCKER_HOSTNAME}/${DOCKER_NAMESPACE}/${DOCKER_NAME}:${DOCKER_TAG} + + +CHART_REGISTRY_PATH := oci://${DOCKER_HOSTNAME}/${DOCKER_NAMESPACE} + +# To enable OCI experimental support for Helm versions prior to v3.8.0, HELM_EXPERIMENTAL_OCI is set +export HELM_EXPERIMENTAL_OCI=1 +export GODEBUG=x509ignoreCN=0 + +.PHONY: helm-verify +helm-verify: + helm lint ${CHART_LOCAL_PATH} + helm install --dry-run ${HELM_RELEASE} ${CHART_LOCAL_PATH} ${HELM_VALUES} + +.PHONY: helm-uninstall +helm-uninstall: + helm uninstall ${HELM_RELEASE} || true + +.PHONY: helm-install +helm-install: helm + helm install ${HELM_RELEASE} ${CHART_LOCAL_PATH} ${HELM_VALUES} + +.PHONY: helm-chart-push +helm-chart-push: + helm package ${CHART_LOCAL_PATH} --version=${HELM_TAG} --destination=${TEMP} + helm push ${TEMP}/${CHART_NAME}-${HELM_TAG}.tgz ${CHART_REGISTRY_PATH} + rm -rf ${TEMP}/${CHART_NAME}-${HELM_TAG}.tgz + +.PHONY: docker-build +docker-build: + docker build . -t ${IMG} + +.PHONY: docker-push +docker-push: docker-build + docker push ${IMG} + +.PHONY: run-fybrikapp +run-fybrikapp: + -kubectl delete fybrikapplication ${FYBRIKAPPLICATION_NAME} -n ${FYBRIK_NAMESPACE} + kubectl apply -f ${FYBRIKAPPLICATION_YAML} -n ${FYBRIK_NAMESPACE} + +.PHONY: module-logs +module-logs : + FIRST_POD=$$(kubectl get pods -n fybrik-blueprints -o jsonpath='{.items[0].metadata.name}'); \ + kubectl logs $$FIRST_POD -n fybrik-blueprints; + diff --git a/README.md b/README.md index ac303d5..407a792 100644 --- a/README.md +++ b/README.md @@ -1 +1,216 @@ -# go-module \ No newline at end of file +# Go-module + +This Go-module is intended as a template module for Fybrik written in [Go](https://go.dev/). + +This module features a read capability of data assets, using a generic server implementation written with [Gin Web Framework](https://pkg.go.dev/github.com/gin-gonic/gin) for Go. + +# How a Fybrik Application can access a dataset, using a Go module for Fybrik +To see the Go module for Fybrik in action, you need to take these steps: +1. Install Fybrik +2. Register the Go-module to Fybrik +3. Prepare a data asset and register it in a data catalog +4. Define data access policy +5. Deploy a Fybrik application +6. Access the data asset using the Go-module + +### Install fybrik +Install Fybrik v1.3 using the [Quick Start](https://fybrik.io/v1.3/get-started/quickstart/), without the section of `Install modules`, and make sure to install Fybrik with Katalog as the data catalog. + +### Register the Go-module to Fybrik + +To register The Go-module as a Fybrik module apply `module.yaml` to the fybrik-system namespace of your cluster. + +To install the module, download the `module.yaml` from the repository and run: + +```bash +kubectl apply -f module.yaml -n fybrik-system +``` + +### Register a data asset + +First, you should create a new Kubernetes namespace and set it as the active namespace: + +```bash +kubectl create namespace fybrik-notebook-sample +kubectl config set-context --current --namespace=fybrik-notebook-sample +``` + +### Prepare a data asset and register it in a data catalog + +This example uses a sample of 100 lines of the [Synthetic Financial Datasets For Fraud Detection](https://www.kaggle.com/ealaxi/paysim1) dataset. Download [`PS_20174392719_1491204439457_log.csv`](https://raw.githubusercontent.com/fybrik/fybrik/master/samples/notebook/PS_20174392719_1491204439457_log.csv) from GitHub. + +Upload the CSV file to an object storage of your choice such as AWS S3. For experimentation you can install localstack to your cluster instead of using a cloud service: + +1. Define variables for access key and secret key + ```bash + export ACCESS_KEY="myaccesskey" + export SECRET_KEY="mysecretkey" + ``` +2. Install localstack to the currently active namespace and wait for it to be ready: + ```bash + helm repo add localstack-charts https://localstack.github.io/helm-charts + helm install localstack localstack-charts/localstack \ + --version 0.4.3 \ + --set image.tag="1.2.0" \ + --set startServices="s3" \ + --set service.type=ClusterIP \ + --set livenessProbe.initialDelaySeconds=25 + kubectl wait --for=condition=ready --all pod -n fybrik-notebook-sample --timeout=120s + ``` + +3. Create a port-forward to communicate with localstack server: + ```bash + kubectl port-forward svc/localstack 4566:4566 & + ``` +4. Use [AWS CLI](https://aws.amazon.com/cli/) to upload the dataset to a new created bucket in the localstack server (make sure to replace /path/to/PS... with the directory you downloaded the data set to): + ```bash + export ENDPOINT="http://127.0.0.1:4566" + export BUCKET="demo" + export OBJECT_KEY="PS_20174392719_1491204439457_log.csv" + export FILEPATH="/path/to/PS_20174392719_1491204439457_log.csv" + export REGION=theshire + aws configure set aws_access_key_id ${ACCESS_KEY} && aws configure set aws_secret_access_key ${SECRET_KEY} + aws configure set region ${REGION} + aws --endpoint-url=${ENDPOINT} s3api create-bucket --bucket ${BUCKET} --region ${REGION} --create-bucket-configuration LocationConstraint=${REGION} + aws --endpoint-url=${ENDPOINT} s3api put-object --bucket ${BUCKET} --key ${OBJECT_KEY} --body ${FILEPATH} + ``` + +In this step you are performing the role of the data owner, registering his data in the data catalog and registering the credentials for accessing the data in the credential manager. + +We now explain how to register a dataset in the Katalog data catalog. + +Begin by registering the credentials required for accessing the dataset as a kubernetes secret. Replace the values for `access_key` and `secret_key` with the values from the object storage service that you used and run: + + ```yaml + cat << EOF | kubectl apply -f - + apiVersion: v1 + kind: Secret + metadata: + name: paysim-csv + type: Opaque + stringData: + access_key: "${ACCESS_KEY}" + secret_key: "${SECRET_KEY}" + EOF + ``` + +Next, register the data asset itself in the data catalog. +We use port-forwarding to send asset creation requests to the Katalog connector. + ```bash + cat << EOF | kubectl apply -f - + apiVersion: katalog.fybrik.io/v1alpha1 + kind: Asset + metadata: + name: paysim-csv + spec: + secretRef: + name: paysim-csv + details: + dataFormat: csv + connection: + name: s3 + s3: + endpoint: "http://localstack.fybrik-notebook-sample.svc.cluster.local:4566" + bucket: "demo" + object_key: "PS_20174392719_1491204439457_log.csv" + metadata: + name: Synthetic Financial Datasets For Fraud Detection + geography: theshire + tags: + finance: true + EOF + ``` + +### Define data access policy + +Acting as the data steward, define an [OpenPolicyAgent](https://www.openpolicyagent.org/). In this example we just access the data asset without redacting columns. Below is the policy (written in [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/#what-is-rego) language): + +```rego +package dataapi.authz +rule[{}] { true } +``` +In this sample only the policy above is applied. Copy the policy to a file named `sample-policy.rego` and then run: + +```bash +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; done +``` + +### Deploy a Fybrik application + +Create a `FybrikApplication` resource to register the notebook workload to the control plane of Fybrik. The value you place in the `dataSetID` field is your asset ID, as explained above. you can run the following to Create a `FybrikApplication` resource for this example: + +```yaml +cat < Date: Thu, 11 May 2023 00:08:28 +0300 Subject: [PATCH 2/9] added white spaces at the end of the files so Alexey won't be mad at me Signed-off-by: Arad Halevy --- Dockerfile | 2 +- conf.sample.yaml | 2 +- fybrikapplication.yaml | 2 +- helm/files/conf.yaml | 2 +- helm/templates/_helpers.tpl | 2 +- helm/templates/configmap.yaml | 2 +- helm/templates/deployment.yaml | 2 +- helm/templates/serviceaccount.yaml | 2 +- helm/values.yaml | 2 +- main.go | 2 +- module.yaml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index e2d3bee..f28ff5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ EXPOSE 8080 RUN go build -o go-module-server main.go -CMD [ "/go-module-server" ] \ No newline at end of file +CMD [ "/go-module-server" ] diff --git a/conf.sample.yaml b/conf.sample.yaml index 305f51a..82f5514 100644 --- a/conf.sample.yaml +++ b/conf.sample.yaml @@ -11,4 +11,4 @@ data: address: http://vault.fybrik-system:8200 authPath: /v1/auth/kubernetes/login role: module - secretPath: /v1/kubernetes-secrets/paysim-csv?namespace=fybrik-notebook-sample \ No newline at end of file + secretPath: /v1/kubernetes-secrets/paysim-csv?namespace=fybrik-notebook-sample diff --git a/fybrikapplication.yaml b/fybrikapplication.yaml index d6d30b5..3c9b49d 100644 --- a/fybrikapplication.yaml +++ b/fybrikapplication.yaml @@ -15,4 +15,4 @@ spec: - dataSetID: "fybrik-notebook-sample/paysim-csv" requirements: interface: - protocol: fybrik-go \ No newline at end of file + protocol: fybrik-go diff --git a/helm/files/conf.yaml b/helm/files/conf.yaml index fa5bb11..065d6c8 100644 --- a/helm/files/conf.yaml +++ b/helm/files/conf.yaml @@ -36,4 +36,4 @@ data: {{- end -}} {{- else -}} data: [] -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index 4cd930d..cea354f 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -61,4 +61,4 @@ passed as parameter to the function. {{- define "fybrik.getDataSubdir" -}} {{- $dir := toString (first .) -}} {{- printf "%s/%s" (include "fybrik.getDataDir" .) $dir }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 768c98a..a65cae2 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -8,4 +8,4 @@ data: {{ .Values.config_override | indent 4}} {{- else }} {{ tpl ( .Files.Get "files/conf.yaml" ) . | indent 4 }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index f11ab96..322b868 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -92,4 +92,4 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/helm/templates/serviceaccount.yaml b/helm/templates/serviceaccount.yaml index ff7e781..ff0c473 100644 --- a/helm/templates/serviceaccount.yaml +++ b/helm/templates/serviceaccount.yaml @@ -5,4 +5,4 @@ metadata: {{- if .Values.image.pullSecret }} imagePullSecrets: - name: {{ .Values.image.pullSecret }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 160b274..038bf1f 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -75,4 +75,4 @@ tls: # If the secret is not provided then the CA certificates are taken from the system # CA certificate store, for example `/etc/ssl/certs/`. # cacertSecretName: "test-tls-ca-certs" - cacertSecretName: "" \ No newline at end of file + cacertSecretName: "" diff --git a/main.go b/main.go index c580fc6..d652e36 100644 --- a/main.go +++ b/main.go @@ -215,4 +215,4 @@ func main() { if err != nil { fmt.Println(err) } -} \ No newline at end of file +} diff --git a/module.yaml b/module.yaml index e809c4e..a8d6971 100644 --- a/module.yaml +++ b/module.yaml @@ -29,4 +29,4 @@ spec: protocol: s3 dataformat: csv - source: - protocol: fybrik-go \ No newline at end of file + protocol: fybrik-go From 671df30d87630d575b0474e41eaa00e48688b630 Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Thu, 11 May 2023 11:03:18 +0300 Subject: [PATCH 3/9] some fixes to formatting in readme Signed-off-by: Arad Halevy --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 407a792..91a3072 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To install the module, download the `module.yaml` from the repository and run: kubectl apply -f module.yaml -n fybrik-system ``` -### Register a data asset +### Prepare a data asset and register it in a data catalog First, you should create a new Kubernetes namespace and set it as the active namespace: @@ -35,8 +35,6 @@ kubectl create namespace fybrik-notebook-sample kubectl config set-context --current --namespace=fybrik-notebook-sample ``` -### Prepare a data asset and register it in a data catalog - This example uses a sample of 100 lines of the [Synthetic Financial Datasets For Fraud Detection](https://www.kaggle.com/ealaxi/paysim1) dataset. Download [`PS_20174392719_1491204439457_log.csv`](https://raw.githubusercontent.com/fybrik/fybrik/master/samples/notebook/PS_20174392719_1491204439457_log.csv) from GitHub. Upload the CSV file to an object storage of your choice such as AWS S3. For experimentation you can install localstack to your cluster instead of using a cloud service: @@ -80,8 +78,7 @@ In this step you are performing the role of the data owner, registering his data We now explain how to register a dataset in the Katalog data catalog. Begin by registering the credentials required for accessing the dataset as a kubernetes secret. Replace the values for `access_key` and `secret_key` with the values from the object storage service that you used and run: - - ```yaml + ```bash cat << EOF | kubectl apply -f - apiVersion: v1 kind: Secret @@ -96,6 +93,7 @@ Begin by registering the credentials required for accessing the dataset as a kub Next, register the data asset itself in the data catalog. We use port-forwarding to send asset creation requests to the Katalog connector. + ```bash cat << EOF | kubectl apply -f - apiVersion: katalog.fybrik.io/v1alpha1 From c12152cfa922f7f9eafedc48d79fc4a0ae8279c1 Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Thu, 11 May 2023 11:15:43 +0300 Subject: [PATCH 4/9] some more fixes to formatting in readme Signed-off-by: Arad Halevy --- README.md | 73 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 91a3072..ccc4ded 100644 --- a/README.md +++ b/README.md @@ -78,46 +78,47 @@ In this step you are performing the role of the data owner, registering his data We now explain how to register a dataset in the Katalog data catalog. Begin by registering the credentials required for accessing the dataset as a kubernetes secret. Replace the values for `access_key` and `secret_key` with the values from the object storage service that you used and run: - ```bash - cat << EOF | kubectl apply -f - - apiVersion: v1 - kind: Secret - metadata: - name: paysim-csv - type: Opaque - stringData: - access_key: "${ACCESS_KEY}" - secret_key: "${SECRET_KEY}" - EOF - ``` + +```bash +cat << EOF | kubectl apply -f - +apiVersion: v1 +kind: Secret +metadata: + name: paysim-csv +type: Opaque +stringData: + access_key: "${ACCESS_KEY}" + secret_key: "${SECRET_KEY}" +EOF +``` Next, register the data asset itself in the data catalog. We use port-forwarding to send asset creation requests to the Katalog connector. - ```bash - cat << EOF | kubectl apply -f - - apiVersion: katalog.fybrik.io/v1alpha1 - kind: Asset - metadata: - name: paysim-csv - spec: - secretRef: - name: paysim-csv - details: - dataFormat: csv - connection: - name: s3 - s3: - endpoint: "http://localstack.fybrik-notebook-sample.svc.cluster.local:4566" - bucket: "demo" - object_key: "PS_20174392719_1491204439457_log.csv" - metadata: - name: Synthetic Financial Datasets For Fraud Detection - geography: theshire - tags: - finance: true - EOF - ``` +```bash +cat << EOF | kubectl apply -f - +apiVersion: katalog.fybrik.io/v1alpha1 +kind: Asset +metadata: + name: paysim-csv +spec: + secretRef: + name: paysim-csv + details: + dataFormat: csv + connection: + name: s3 + s3: + endpoint: "http://localstack.fybrik-notebook-sample.svc.cluster.local:4566" + bucket: "demo" + object_key: "PS_20174392719_1491204439457_log.csv" + metadata: + name: Synthetic Financial Datasets For Fraud Detection + geography: theshire + tags: + finance: true +EOF +``` ### Define data access policy From b5e87a04a89ccbd1e22e21bd76994d69aca023b6 Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Tue, 16 May 2023 10:36:45 +0300 Subject: [PATCH 5/9] adressed review comments, mainly took down unrelevant makefile targets, and fixed some ReadMe issues Signed-off-by: Arad Halevy --- Makefile | 14 -------------- README.md | 25 ++++--------------------- helm/templates/deployment.yaml | 2 +- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index c817325..a55f4a2 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,6 @@ CHART_NAME ?= go-module-chart HELM_RELEASE ?= rel1-${DOCKER_NAME} HELM_TAG ?= 0.0.0 -FYBRIKAPPLICATION_NAME ?= my-notebook -FYBRIKAPPLICATION_YAML ?= fybrikapplication.yaml -FYBRIK_NAMESPACE ?= fybrik-notebook-sample - IMG := ${DOCKER_HOSTNAME}/${DOCKER_NAMESPACE}/${DOCKER_NAME}:${DOCKER_TAG} @@ -50,13 +46,3 @@ docker-build: docker-push: docker-build docker push ${IMG} -.PHONY: run-fybrikapp -run-fybrikapp: - -kubectl delete fybrikapplication ${FYBRIKAPPLICATION_NAME} -n ${FYBRIK_NAMESPACE} - kubectl apply -f ${FYBRIKAPPLICATION_YAML} -n ${FYBRIK_NAMESPACE} - -.PHONY: module-logs -module-logs : - FIRST_POD=$$(kubectl get pods -n fybrik-blueprints -o jsonpath='{.items[0].metadata.name}'); \ - kubectl logs $$FIRST_POD -n fybrik-blueprints; - diff --git a/README.md b/README.md index 91a3072..de3c141 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,8 @@ To see the Go module for Fybrik in action, you need to take these steps: 1. Install Fybrik 2. Register the Go-module to Fybrik 3. Prepare a data asset and register it in a data catalog -4. Define data access policy -5. Deploy a Fybrik application -6. Access the data asset using the Go-module +4. Deploy a Fybrik application +5. Access the data asset using the Go-module ### Install fybrik Install Fybrik v1.3 using the [Quick Start](https://fybrik.io/v1.3/get-started/quickstart/), without the section of `Install modules`, and make sure to install Fybrik with Katalog as the data catalog. @@ -20,10 +19,10 @@ Install Fybrik v1.3 using the [Quick Start](https://fybrik.io/v1.3/get-started/q To register The Go-module as a Fybrik module apply `module.yaml` to the fybrik-system namespace of your cluster. -To install the module, download the `module.yaml` from the repository and run: +To install the module: ```bash -kubectl apply -f module.yaml -n fybrik-system +kubectl apply -f https://raw.githubusercontent.com/aradhalevy/go-module/go-module-setup/module.yaml -n fybrik-system ``` ### Prepare a data asset and register it in a data catalog @@ -119,22 +118,6 @@ We use port-forwarding to send asset creation requests to the Katalog connector. EOF ``` -### Define data access policy - -Acting as the data steward, define an [OpenPolicyAgent](https://www.openpolicyagent.org/). In this example we just access the data asset without redacting columns. Below is the policy (written in [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/#what-is-rego) language): - -```rego -package dataapi.authz -rule[{}] { true } -``` -In this sample only the policy above is applied. Copy the policy to a file named `sample-policy.rego` and then run: - -```bash -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; done -``` - ### Deploy a Fybrik application Create a `FybrikApplication` resource to register the notebook workload to the control plane of Fybrik. The value you place in the `dataSetID` field is your asset ID, as explained above. you can run the following to Create a `FybrikApplication` resource for this example: diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 322b868..86d5bca 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -34,7 +34,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} {{- end }} ports: - - name: grpc + - name: http containerPort: 8080 protocol: TCP securityContext: From 28874e3afe5990e4468bead361fdf22868e0b1f4 Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Wed, 17 May 2023 16:47:24 +0300 Subject: [PATCH 6/9] added values.sample.yaml for testing and changed ReadMe a bit according to review Signed-off-by: Arad Halevy --- README.md | 1 + values.sample.yaml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 values.sample.yaml diff --git a/README.md b/README.md index 31919f3..144a351 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,7 @@ spec: intent: Fraud Detection data: - dataSetID: "fybrik-notebook-sample/paysim-csv" + flow: read requirements: interface: protocol: fybrik-go diff --git a/values.sample.yaml b/values.sample.yaml new file mode 100644 index 0000000..dd97ff3 --- /dev/null +++ b/values.sample.yaml @@ -0,0 +1,21 @@ +labels: + app.fybrik.io/app-name: fybrik-flight-read +uuid: 12345678 +assets: +- args: + - connection: + name: s3 + s3: + bucket: fybrik-test-bucket + endpoint: s3.eu-gb.cloud-object-storage.appdomain.cloud + object_key: test1.parquet + format: parquet + vault: + read: + address: http://vault.fybrik-system:8200 + authPath: /v1/auth/kubernetes/login + role: module + secretPath: /v1/kubernetes-secrets/data-creds?namespace=fybrik-notebook-sample + assetID: "test1" + capability: read + \ No newline at end of file From ce2cde53ab6326ea553dff7f4d9127199529bbda Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Wed, 17 May 2023 16:51:21 +0300 Subject: [PATCH 7/9] white space at end of file Signed-off-by: Arad Halevy --- values.sample.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/values.sample.yaml b/values.sample.yaml index dd97ff3..b0f8457 100644 --- a/values.sample.yaml +++ b/values.sample.yaml @@ -18,4 +18,3 @@ assets: secretPath: /v1/kubernetes-secrets/data-creds?namespace=fybrik-notebook-sample assetID: "test1" capability: read - \ No newline at end of file From 08482dcb7090ad4b9003e8d273dbda6b8e465f9e Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Wed, 17 May 2023 17:24:41 +0300 Subject: [PATCH 8/9] simplified the supported interface of the module yaml, added option to helm un/install in the makefile Signed-off-by: Arad Halevy --- Makefile | 2 ++ module.yaml | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a55f4a2..dea3283 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ CHART_LOCAL_PATH ?= helm CHART_NAME ?= go-module-chart HELM_RELEASE ?= rel1-${DOCKER_NAME} HELM_TAG ?= 0.0.0 +HELM_VALUES ?= \ + --set hello=world1 IMG := ${DOCKER_HOSTNAME}/${DOCKER_NAMESPACE}/${DOCKER_NAME}:${DOCKER_TAG} diff --git a/module.yaml b/module.yaml index a8d6971..ae6690e 100644 --- a/module.yaml +++ b/module.yaml @@ -24,9 +24,4 @@ spec: supportedInterfaces: - source: protocol: s3 - dataformat: parquet - - source: - protocol: s3 - dataformat: csv - - source: - protocol: fybrik-go + From 325bad166c6ae3c2eef44547b0e325ae18550137 Mon Sep 17 00:00:00 2001 From: Arad Halevy Date: Wed, 24 May 2023 13:48:52 +0300 Subject: [PATCH 9/9] removed the cleanup of policies because in this readme we dont use policies Signed-off-by: Arad Halevy --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 144a351..0c3bfbf 100644 --- a/README.md +++ b/README.md @@ -191,9 +191,3 @@ When you're finished experimenting with a sample, you may clean up as follows: ```bash kubectl delete namespace fybrik-notebook-sample ``` - -3. Delete the policy created in the fybrik-system namespace: - -```bash -NS="fybrik-system"; kubectl -n $NS get configmap | awk '/sample/{print $1}' | xargs kubectl delete -n $NS configmap -``` \ No newline at end of file