Skip to content

Commit

Permalink
Related to magda-io/magda#3229, Use magda-common for docker image rel…
Browse files Browse the repository at this point in the history
…ated logic
  • Loading branch information
t83714 committed Oct 12, 2021
1 parent d8f3246 commit ba6fb7e
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ dist
.vscode

ckanApiKeysMap.json

deploy/*/charts
1 change: 1 addition & 0 deletions .helmdocsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy/*/charts
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 1.0.0

- Upgrade dependencies
- Upgrade CI scripts
- Related to https://github.com/magda-io/magda/issues/3229, Use magda-common for docker image related logic
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,27 @@ For instructions on working on this minion, refer to [local-dev.md](./local-dev.
If you would like to build a connector or a minion for MAGDA,
here is a handy
[guide](https://github.com/magda-io/magda/blob/master/docs/docs/how-to-build-your-own-connectors-minions.md).

## Requirements

Kubernetes: `>= 1.14.0-0`

| Repository | Name | Version |
|------------|------|---------|
| https://charts.magda.io | magda-common | 1.0.0-alpha.4 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| defaultAdminUserId | string | `"00000000-0000-4000-8000-000000000000"` | |
| defaultImage.imagePullSecret | bool | `false` | |
| defaultImage.pullPolicy | string | `"IfNotPresent"` | |
| defaultImage.repository | string | `"docker.io/data61"` | |
| global.image | object | `{}` | |
| global.minions.image | object | `{}` | |
| global.rollingUpdate.maxUnavailable | int | `0` | |
| image.name | string | `"magda-minion-ckan-exporter"` | |
| resources.limits.cpu | string | `"100m"` | |
| resources.requests.cpu | string | `"10m"` | |
| resources.requests.memory | string | `"30Mi"` | |
39 changes: 39 additions & 0 deletions README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# magda-minion-ckan-exporter

MAGDA Minion for exporting datasets to CKAN

## Description

TLDR: This minion exports datasets as open data to a CKAN instance (e.g, data.gov.au)

During the add dataset flow, in the `Access and User` section,
the user can choose whether or not to publish the dataset as open data (`No` by default).

At the moment, it only exports the dataset to data.gov.au.

## How it works

On publishing of the dataset to MAGDA, the minion will create an equivalent CKAN package
and upload it to CKAN via the [CKAN Api](https://docs.ckan.org/en/ckan-2.7.3/api/) and
store the `CkanId` returned by CKAN.

If the dataset is edited, the entire dataset is uploaded again, but as an update.

If the user chooses to not have the dataset available as open data anymore, the dataset
is deleted from the CKAN instance.

### Local Dev

For instructions on working on this minion, refer to [local-dev.md](./local-dev.md).

If you would like to build a connector or a minion for MAGDA,
here is a handy
[guide](https://github.com/magda-io/magda/blob/master/docs/docs/how-to-build-your-own-connectors-minions.md).

{{ template "chart.maintainersSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesHeader" . }}

{{ template "chart.valuesTable" . }}
7 changes: 6 additions & 1 deletion deploy/magda-minion-ckan-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
apiVersion: v2
description: A Helm chart for Kubernetes
name: magda-minion-ckan-exporter
description: A Helm chart for Magda CKAN Exporter Minion
version: "0.0.57-0"
kubeVersion: ">= 1.14.0-0"
home: "https://github.com/magda-io/magda-minion-ckan-exporter"
sources: ["https://github.com/magda-io/magda-minion-ckan-exporter"]
annotations:
magdaModuleType: "minion"
dependencies:
- name: magda-common
version: "1.0.0-alpha.4"
repository: "https://charts.magda.io"
10 changes: 3 additions & 7 deletions deploy/magda-minion-ckan-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,19 @@ spec:
labels:
service: magda-minion-ckan-exporter
spec:
{{- $imagePullSecret := (ne (.Values.image.imagePullSecret | typeOf) "<nil>") | ternary .Values.image.imagePullSecret ( (ne (.Values.global.minions.image.imagePullSecret | typeOf) "<nil>") | ternary .Values.global.minions.image.imagePullSecret ( (ne (.Values.global.image.imagePullSecret | typeOf) "<nil>") | ternary .Values.global.image.imagePullSecret .Values.defaultImage.imagePullSecret ) ) -}}
{{- if ne ($imagePullSecret | toString) "false" }}
imagePullSecrets:
- name: {{ $imagePullSecret }}
{{- end }}
{{- include "magda.imagePullSecrets" . | indent 6 }}
volumes:
- name: ckan-server-api-key-map
secret:
secretName: ckan-exporter-secrets
containers:
- name: magda-minion-ckan-exporter
image: "{{ .Values.image.repository | default .Values.global.minions.image.repository | default .Values.global.image.repository | default .Values.defaultImage.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Values.global.minions.image.tag | default .Values.global.image.tag | default .Values.defaultImage.tag }}"
image: {{ include "magda.image" . | quote }}
imagePullPolicy: {{ include "magda.imagePullPolicy" . | quote }}
volumeMounts:
- name: ckan-server-api-key-map
mountPath: "/etc/config"
readOnly: true
imagePullPolicy: {{ .Values.image.pullPolicy | default .Values.global.minions.image.pullPolicy | default .Values.global.image.pullPolicy | default .Values.defaultImage.pullPolicy }}
{{- if .Values.global.enableLivenessProbes }}
livenessProbe:
httpGet:
Expand Down
2 changes: 0 additions & 2 deletions deploy/magda-minion-ckan-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
image:
name: "magda-minion-ckan-exporter"
# repository:
# tag:
# pullPolicy:
# imagePullSecret:

Expand All @@ -21,7 +20,6 @@ resources:

defaultImage:
repository: docker.io/data61
tag: 0.0.57-0
pullPolicy: IfNotPresent
imagePullSecret: false

Expand Down

0 comments on commit ba6fb7e

Please sign in to comment.