Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Refactor for terraform-plugin-go SDK and introduce OpenAPI planner #151

Merged
merged 60 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a150efe
Update client-go and apimachinery to v0.20.0
alexsomesan Feb 8, 2021
b8792f8
Move OpenAPI foundry package internally
alexsomesan Feb 8, 2021
2a4e1d8
Remove mentions of
alexsomesan Feb 8, 2021
e1e11cc
WIP: refactor provider to use github.com/hashicorp/terraform-plugin-g…
alexsomesan Feb 8, 2021
8d52efa
Temporarily fork SDK to incorporate PRs needed for this provider to work
alexsomesan Feb 8, 2021
11cbc6e
* Cleanup some unused code.
alexsomesan Feb 9, 2021
8174bfd
Explicitly set all attributes of provider config schema blocks.
alexsomesan Feb 9, 2021
32034c0
Cleanup error message from API response
alexsomesan Feb 9, 2021
80e153f
Break type recursion for io.k8s.apiextensions-apiserver.pkg.apis.apie…
alexsomesan Feb 9, 2021
1d3c7f3
Update go-hclog to v0.15.0
alexsomesan Feb 10, 2021
afb77ef
Fix issue with CRD version v1beta1 going into infinite recursion
alexsomesan Feb 10, 2021
66a1c50
git ignore TF lock files
alexsomesan Feb 10, 2021
766c93c
Add exceptions for apiextensions.v1.CustomResourceSubresourceStatus and
alexsomesan Feb 11, 2021
1d21045
Add horrible workaround for CustomResourceSubresourceStatus
alexsomesan Feb 11, 2021
ddbeb79
Make returned errors and logging messages more consistent
alexsomesan Feb 11, 2021
e352a0e
WIP: SSA dry-run validation
alexsomesan Feb 11, 2021
21150d9
WIP: extract manifest for validation
alexsomesan Feb 12, 2021
0516a33
Simplistic validation for absent / unexpected manifest attributes
alexsomesan Feb 12, 2021
a6a7362
Render CustomResourceSubresourceStatus as empty tftypes.Map
alexsomesan Feb 14, 2021
888d915
* Nicer error reporting for apply results, based on Terraform diagnos…
alexsomesan Feb 14, 2021
0bc576a
Corrections to scaffolding and Unstructured decoding logic to fix CRDs
alexsomesan Feb 14, 2021
4298d29
Split code out into smaller packages
alexsomesan Feb 14, 2021
2259e1e
Break out unstructured to tfvalue convertor in smaller functions and …
alexsomesan Feb 15, 2021
58e6166
Fix example for deploying terraform-operator
alexsomesan Feb 16, 2021
a484258
Remove unused code
alexsomesan Feb 16, 2021
8912f50
* Update setup-kind to v0.5.0
alexsomesan Feb 16, 2021
27073ee
* Trigger github actions only on PRs, not every branch push
alexsomesan Feb 16, 2021
ce48fd2
Add 'acceptance' build tag to acceptance tests files
alexsomesan Feb 16, 2021
136be18
Fix foundry unit test for CRD (after foundry fixes)
alexsomesan Feb 16, 2021
961a1e1
Separate units and acceptance tests using build tags. Update Go version
alexsomesan Feb 16, 2021
04030db
WIP: resource update
alexsomesan Feb 18, 2021
c3ba639
Implement resource updates
alexsomesan Feb 19, 2021
ad49589
Update vendored terraform-plugin-go from integration fork
alexsomesan Feb 23, 2021
490785b
Update go-cty and hcl2 modules
alexsomesan Feb 23, 2021
3e569be
Port wait_for to tftypes
alexsomesan Feb 23, 2021
b613f04
Validate if namespace is needed but not supplied
alexsomesan Feb 24, 2021
085284e
Fix spelling in comment
alexsomesan Feb 24, 2021
69203ac
Fix reconstruction of objects from API response to not miss unset att…
alexsomesan Feb 24, 2021
bd3f640
Implement type cache with synchronized map to fix concurent apply issues
alexsomesan Feb 24, 2021
9af44a6
Fix diagnostic generation from API Status when .Details are missing
alexsomesan Feb 25, 2021
8735d6d
Validate when namespace is set on cluster level resources
alexsomesan Feb 25, 2021
24c3f22
Implement reverse lookup index from GVK to OpenAPI definition ID
alexsomesan Feb 26, 2021
86b1733
Refresh OpenAPI schema after each apply to incorporate new CRDs. This…
alexsomesan Feb 26, 2021
75bf99f
Trigger OpenAPI refresh by deleting the client instance
alexsomesan Feb 26, 2021
e8fc002
Override type generator for CustomResourceDefinitionVersion
alexsomesan Feb 28, 2021
3f9810a
Plan multi-version CRDs
alexsomesan Mar 1, 2021
8607a6e
Correct response conversion for multi-version CRDs
alexsomesan Mar 1, 2021
c0c58e5
Mutex-protect OpenAPI type generator
alexsomesan Mar 2, 2021
b6c90ed
Adapt unit tests for openapi to latest changes
alexsomesan Mar 2, 2021
787d278
Update 'TestOpenAPIPathFromGVK' test
alexsomesan Mar 2, 2021
b540888
Fix acctest dependencies
alexsomesan Mar 2, 2021
afe024d
Carve out plan-time namespace validation into separate function
alexsomesan Mar 4, 2021
c0b54ae
Enable CI on the Vault example
alexsomesan Mar 4, 2021
0c6213a
Disable logging of OpenAPI spec response - too big
alexsomesan Mar 5, 2021
3983536
Update minimum Terraform version to 0.14.8
alexsomesan Mar 8, 2021
01829b6
Update setup-kind in examples runner
alexsomesan Mar 8, 2021
48482a2
Add hashicorp/setup-terraform github action to control Terraform vers…
alexsomesan Mar 8, 2021
cd41c74
Don't use on init to allow downloading other registry plugins
alexsomesan Mar 8, 2021
ecf2479
Don't run ckecks on the terraform-operator example - it requires AWS …
alexsomesan Mar 8, 2021
490e1d6
Fix wait_for unmarshaling error
alexsomesan Mar 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
50 changes: 28 additions & 22 deletions .github/workflows/acceptance_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
name: Acceptance tests
on:
push:
branches:
- master
- main
paths:
- '**.go'
- "**.go"
pull_request:
branches:
- master
- master
paths:
- '**.go'
- "**.go"
jobs:
acceptance_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Read go-version
id: go-version
uses: juliangruber/read-file-action@v1
with:
path: ./go-version
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.content }}
- uses: engineerd/[email protected]
- name: test (server side plan enabled)
run: |
make testacc KUBE_CONFIG_PATH="${HOME}/.kube/config"
- name: test (server side plan disabled)
env:
TESTARGS: "-server-side-plan=false"
run: |
make testacc KUBE_CONFIG_PATH="${HOME}/.kube/config"
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.15.0-beta1
- uses: actions/checkout@v2
- name: Read go-version
id: go-version
uses: juliangruber/read-file-action@v1
with:
path: ./go-version
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.content }}
- uses: engineerd/[email protected]
- name: test (server side plan enabled)
run: |
make testacc KUBE_CONFIG_PATH="${HOME}/.kube/config"
- name: test (server side plan disabled)
env:
TESTARGS: "-server-side-plan=false"
run: |
make testacc KUBE_CONFIG_PATH="${HOME}/.kube/config"
46 changes: 26 additions & 20 deletions .github/workflows/check_examples.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
name: Check examples
on:
push:
branches:
- master
- main
paths:
- 'examples/**'
- '**.go'
- "examples/**"
- "**.go"
pull_request:
branches:
- master
- master
paths:
- 'examples/**'
- '**.go'
- "examples/**"
- "**.go"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Read go-version
id: go-version
uses: juliangruber/read-file-action@v1
with:
path: ./go-version
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.content }}
- uses: engineerd/[email protected]
- name: Check examples run
run: make check-examples
env:
TERM: xterm-256color
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.15.0-beta1
- uses: actions/checkout@v2
- name: Read go-version
id: go-version
uses: juliangruber/read-file-action@v1
with:
path: ./go-version
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.content }}
- uses: engineerd/[email protected]
- name: Check examples run
run: make check-examples
env:
TERM: xterm-256color
15 changes: 9 additions & 6 deletions .github/workflows/tfprovider-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: Terraform provider lint
on:
push:
branches:
- master
- main
paths:
- '**.go'
- "**.go"
pull_request:
branches:
- master
paths:
- '**.go'
- "**.go"
jobs:
tfproviderlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bflad/tfproviderlint-github-action@master
with:
args: ./...
- uses: actions/checkout@v2
- uses: bflad/tfproviderlint-github-action@master
with:
args: ./...
8 changes: 5 additions & 3 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Unit tests

on:
push:
branches:
- master
- main
paths:
- '**.go'
- "**.go"
pull_request:
branches:
- master
paths:
- '**.go'
- "**.go"
jobs:
unit_tests:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.terraform/
*.tfstate
*.tfstate.backup
.terraform.lock.hcl
*.log
**/terraform-provider-kubernetes*
/terraform-provider-kubernetes*
9 changes: 3 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TEST?="./provider"
TEST?="./..."
ACCTEST?="./test/acceptance"
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
WEBSITE_REPO=github.com/hashicorp/terraform-website
Expand All @@ -22,12 +22,10 @@ install: build
@cp ./terraform-provider-kubernetes-alpha $(DESTINATION)

test: fmtcheck
go test $(TEST) -v || exit 1
echo $(TEST) | \
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
go test -v $(TESTARGS) -timeout=30s -parallel=4 $(TEST)

testacc: fmtcheck
go test -count=1 $(ACCTEST) -v $(TESTARGS) -timeout 120m
go test -count=1 -tags acceptance $(ACCTEST) -v $(TESTARGS) -timeout 120m

vet:
@echo "go vet ."
Expand Down Expand Up @@ -59,7 +57,6 @@ test-compile:
go test -c $(TEST) $(TESTARGS)



website:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Our eventual goal is for this generic resource to become a part of our [official

## Requirements

* [Terraform](https://www.terraform.io/downloads.html) version 0.12.x +
* [Terraform](https://www.terraform.io/downloads.html) version 0.14.8 +
* [Kubernetes](https://kubernetes.io/docs/reference) version 1.17.x +
* [Go](https://golang.org/doc/install) version 1.14.x

Expand Down
1 change: 0 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Our eventual goal is for this generic resource to become a part of our [official
- **host** (String, Optional) (env-var: `KUBE_HOST`) URL to the base of the API server.
- **insecure** (Boolean, Optional) (env-var: `KUBE_INSECURE`) Disregard invalid TLS certificates _(default false)_.
- **password** (String, Optional) (env-var: `KUBE_PASSWORD`) Basic authentication password.
- **server_side_planning** (Boolean, Optional) Enable usage of dry-run API calls at planning time _(default true)_.
- **token** (String, Optional) (env-var: `KUBE_TOKEN`) Token is a bearer token used by the client for request authentication.
- **username** (String, Optional) (env-var: `KUBE_USERNAME`) Basic authentication username.

Expand Down
1 change: 0 additions & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

The provider accepts the following configuration attributes under the `provider` block.

* `server_side_planning` - (boolean) Enable usage of dry-run API calls at planning time _(default true)_.
* `config_path` - (string) (env-var: `KUBE_CONFIG_PATH`) Path to a `kubeconfig` file.
* `host` - (string) (env-var: `KUBE_HOST`) URL to the base of the API server.
* `cluster_ca_certificate` - (string) (env-var: `KUBE_CLUSTER_CA_CERT_DATA`) PEM-encoded CA TLS certificate (including intermediates, if any).
Expand Down
Loading