Skip to content

Commit f2f07bc

Browse files
authored
Adding resources doc for TF registry (#30)
* Adding the proper env var for tests * Adding the full documentation * Fixing the formatting * Fixing the required * Adding the conflicts * Adding the proper doc
1 parent 9bf9421 commit f2f07bc

File tree

10 files changed

+215
-22
lines changed

10 files changed

+215
-22
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
# vendor/
1616
.terraform
1717
*tfstate*
18-
crash.log
18+
crash.log
19+
coverage.out

GNUmakefile

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WEBSITE_REPO=github.com/hashicorp/terraform-website
21
PKG_NAME=kubeflowpipelines
32
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
43

@@ -14,18 +13,4 @@ testacc:
1413
TF_ACC=1 KUBEFLOWPIPELINES_HOST=http://localhost:8080 go test -v ./... -timeout 120m -covermode=count -coverprofile=coverage.out
1514

1615
fmt:
17-
gofmt -w $(GOFMT_FILES)
18-
19-
website:
20-
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
21-
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
22-
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
23-
endif
24-
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
25-
26-
website-test:
27-
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
28-
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
29-
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
30-
endif
31-
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
16+
gofmt -w $(GOFMT_FILES)

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,20 @@ Terraform provider for Kubeflow Pipelines API
1010

1111
## Usage
1212

13-
[Documentation available on the Terraform Registry](https://registry.terraform.io/providers/datarootsio/kubeflowpipelines/latest/docs)
13+
[Documentation available on the Terraform Registry](https://registry.terraform.io/providers/datarootsio/kubeflowpipelines/latest/docs)
14+
15+
Developed and validated against kubeflow 1.0.2
16+
17+
## Contributing
18+
19+
Contributions to this repository are very welcome! Found a bug or do you have a suggestion? Please open an issue. Do you know how to fix it? Pull requests are welcome as well! To get you started faster, a Makefile is provided.
20+
21+
Make sure to install [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html), [Go](https://golang.org/doc/install) (for automated testing) and Make (optional, if you want to use the Makefile) on your computer. Install [tflint](https://github.com/terraform-linters/tflint) to be able to run the linting.
22+
23+
* Format your code: `make fmt`
24+
* Run tests: `make test`
25+
* Run acceptance tests: `make testacc`. This creates resources on your Kubernetes cluster, use with caution. We use [k3s](https://k3s.io/) in the CICD pipelines, to start from a fresh environment each time.
26+
27+
## License
28+
29+
MIT license. Please see [LICENSE](LICENSE) for details.

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Kubeflow Pipelines Provider
22

33
Terraform provider for [Kubeflow Pipelines API](https://www.kubeflow.org/docs/pipelines/pipelines-quickstart/).
4+
5+
Developed and validated against kubeflow 1.0.2
6+
47
## Example Usage
58

69
```hcl-terraform

docs/resources/experiment.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# kubeflowpipelines_experiment
2+
3+
The `kubeflowpipelines_experiment` creates a kubeflow pipelines experiment.
4+
5+
## Example Usage
6+
7+
```hcl-terraform
8+
resource "kubeflowpipelines_experiment" "example" {
9+
name = "example-experiment"
10+
description = "Some description"
11+
}
12+
```
13+
14+
## Argument Reference
15+
16+
The following arguments are supported:
17+
### Required arguments
18+
* `name` — (Required) Name of the experiment.
19+
### Optional arguments
20+
* `description` — (Optional) Description of the experiment.
21+
22+
## Attributes Reference
23+
24+
The following attribute is exported:
25+
26+
* `created_at` — The date and time of creation, formatted with RFC3339.

docs/resources/job.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# kubeflowpipelines_job
2+
3+
The `kubeflowpipelines_job` creates a kubeflow pipelines job
4+
5+
## Example Usage
6+
7+
```hcl-terraform
8+
resource "kubeflowpipelines_job" "example" {
9+
name = "example"
10+
description = "Description"
11+
service_account = "pipeline-runner"
12+
enabled = true
13+
max_concurrency = 2
14+
no_catchup = true
15+
experiment_id = kubeflowpipelines_experiment.example.id
16+
pipeline_spec {
17+
pipeline_version_id = kubeflowpipelines_pipeline.example.version_id
18+
parameters = {
19+
"key" = "value"
20+
}
21+
}
22+
trigger {
23+
cron_schedule {
24+
start_time = "2020-06-23T00:00:00Z"
25+
end_time = "2030-06-23T00:00:00Z"
26+
cron = "0 0/10 * * * ?"
27+
28+
}
29+
}
30+
}
31+
```
32+
33+
## Argument Reference
34+
35+
The following arguments are supported:
36+
37+
### Required arguments
38+
* `name` — (Required).
39+
* `max_concurrency` — (Required). Maximum number of concurrent runs for this job. Value must be between `1` and `10` included.
40+
* `pipeline_spec` — (Required). The pipeline specifications of this job.
41+
* `trigger` — (Required). The trigger rules for this job. Contains either `cron_schedule` or `periodic_schedule` block.
42+
43+
### Optional arguments
44+
* `description` — (Optional). A description for the run.
45+
* `enabled` — (Optional, defaults to `true`). Is the job enabled ?
46+
* `service_account` — (Optional). The service account to attach this job to.
47+
* `experiment_id` — (Optional). The experiment that will store this jon.
48+
* `no_catchup` — (Optional, defaults to `true`). Whether the job should catch up if behind schedule. If true, the job will only schedule the latest interval if behind schedule. If false, the job will catch up on each past interval.
49+
50+
### Nested Blocks
51+
52+
#### pipeline_spec
53+
54+
* `pipeline_version_id` — (Required). The pipeline version ID associated to this run.
55+
* `parameters` — (Optional). A map of key values of parameters.
56+
57+
#### cron_schedule
58+
59+
* `start_time` — (Required). The start time in RFC3339 format.
60+
* `end_time` — (Required). The end time in RFC3339 format.
61+
* `cron` — (Required). A schedule represented with the cron format, with the [quartz format](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-06.html). Must include seconds.
62+
63+
#### periodic_schedule
64+
65+
* `start_time` — (Required). The start time in RFC3339 format.
66+
* `end_time` — (Required). The end time in RFC3339 format.
67+
* `interval_seconds` — (Required). The interval between each run, in seconds.
68+
69+
## Attributes Reference
70+
71+
The following attribute is exported:
72+
73+
* `created_at` — The date and time of creation, formatted with RFC3339.

docs/resources/pipeline.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# kubeflowpipelines_pipeline
2+
3+
The `kubeflowpipelines_pipeline` creates a kubeflow pipelines pipeline.
4+
5+
To avoid deleting old related objects (runs, jobs, etc), changes in the pipeline version will upload a new version, not recreate a new pipeline object.
6+
7+
## Example Usage
8+
9+
```hcl-terraform
10+
resource "kubeflowpipelines_pipeline" "example" {
11+
name = "example"
12+
description = "Description"
13+
file_base64 = base64encode(file("${path.module}/pipeline.yaml"))
14+
file_format = "yaml"
15+
version = "v0.0.1"
16+
}
17+
18+
resource "kubeflowpipelines_pipeline" "example_url" {
19+
name = "example-with-url"
20+
url = "https://raw.githubusercontent.com/datarootsio/terraform-provider-kubeflowpipelines/master/tests/kubeflow_setup/pipeline.yaml"
21+
version = "v0.0.1"
22+
}
23+
```
24+
25+
## Argument Reference
26+
27+
The following arguments are supported:
28+
### Required arguments
29+
* `name` — (Required).
30+
31+
### Optional arguments
32+
33+
* `description` — (Optional, conflicts with `url`). A description for the pipeline. Descriptions are ignored by the API for URL based pipelines so it's currently conflicting
34+
* `url` — (Optional, conflicts with `file_base64`). The URL containing a pipeline definition
35+
* `file_base64` — (Optional, conflicts with `url`). A base64 encoded pipeline.
36+
* `file_format` — (Optional, required with `file_base64`). The format of the pipeline. One of `zip`,`tar.gz`,`yaml`
37+
* `version` — (Optional). The version of the pipeline.
38+
39+
## Attributes Reference
40+
41+
The following attribute is exported:
42+
43+
* `version_id` — The pipeline's version ID.

docs/resources/run.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# kubeflowpipelines_run
2+
3+
The `kubeflowpipelines_run` creates a kubeflow pipelines run
4+
5+
## Example Usage
6+
7+
```hcl-terraform
8+
resource "kubeflowpipelines_run" "example" {
9+
name = "example"
10+
description = "Description"
11+
service_account = "pipeline-runner"
12+
experiment_id = kubeflowpipelines_experiment.example.id
13+
pipeline_spec {
14+
pipeline_version_id = kubeflowpipelines_pipeline.example.version_id
15+
parameters = {
16+
"key" = "value"
17+
}
18+
}
19+
}
20+
```
21+
22+
## Argument Reference
23+
24+
The following arguments are supported:
25+
### Required arguments
26+
* `name` — (Required).
27+
* `pipeline_spec` — (Required). The pipeline specification of this run.
28+
29+
### Optional arguments
30+
31+
* `description` — (Optional). A description for the run.
32+
* `service_account` — (Optional). The service account to attach this run to.
33+
* `experiment_id` — (Optional). The experiment that will store this run.
34+
35+
### Nested Blocks
36+
37+
#### pipeline_spec
38+
39+
* `pipeline_version_id` — (Required). The pipeline version ID associated to this run.
40+
* `parameters` — (Optional). A map of key values of parameters.
41+
42+
## Attributes Reference
43+
44+
The following attribute is exported:
45+
46+
* `created_at` — The date and time of creation, formatted with RFC3339.

kubeflowpipelines/resource_job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func resourceKubeflowPipelinesJob() *schema.Resource {
6363
"no_catchup": {
6464
Type: schema.TypeBool,
6565
Optional: true,
66-
Default: false,
66+
Default: true,
6767
ForceNew: true,
6868
},
6969
"pipeline_spec": {

kubeflowpipelines/resource_job_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ resource "kubeflowpipelines_job" "test" {
9191
}
9292
trigger {
9393
cron_schedule {
94-
start_time = "2020-06-23T00:00:00Z"
95-
end_time = "2030-06-23T00:00:00Z"
96-
cron = "0 10 * * *"
94+
start_time = "2020-06-23T00:00:00Z"
95+
end_time = "2030-06-23T00:00:00Z"
96+
cron = "0 10 * * *"
9797
}
9898
}
9999
}

0 commit comments

Comments
 (0)