Skip to content

Commit

Permalink
Merge pull request #1437 from linode/dev
Browse files Browse the repository at this point in the history
v2.21.0
  • Loading branch information
zliang-akamai authored May 28, 2024
2 parents 7945c4e + 93631e9 commit abb9e80
Show file tree
Hide file tree
Showing 72 changed files with 789 additions and 508 deletions.
131 changes: 86 additions & 45 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Integration tests
name: Integration Tests

on:
workflow_dispatch: null
push:
branches:
- main
- dev

jobs:
integration_tests:
name: Run integration tests
runs-on: ubuntu-latest
env:
EXIT_STATUS: 0
strategy:
fail-fast: false
matrix:
user: ["USER_1", "USER_2", "USER_3", "USER_4"]

steps:
- name: Clone Repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -21,60 +26,96 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- run: go version
- run: make deps
go-version: '1.x'

- name: Install Dependencies
run: |
make deps
sudo apt-get update -y
sudo apt-get install -y build-essential
- name: Update system packages
run: sudo apt-get update -y
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@latest

# Note: test tags are not in alphabetical order, it was divided to optimize test execution time
- name: Set Test Scope for each Account
run: |
case "${{ matrix.user }}" in
"USER_1")
echo "TEST_TAGS=acceptance,backup,domain,domainrecord,domains,domainzonefile,helper,instance" >> $GITHUB_ENV
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_1 }}" >> $GITHUB_ENV
;;
"USER_2")
echo "TEST_TAGS=instancenetworking,instancesharedips,instancetype,instancetypes,ipv6range,ipv6ranges,kernel,kernels,lke,nb,nbconfig,nbconfigs,nbnode,nbs,sshkey,sshkeys" >> $GITHUB_ENV
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_2 }}" >> $GITHUB_ENV
;;
"USER_3")
echo "TEST_TAGS=instanceconfig,instancedisk,instanceip,networkingip,objcluster,objkey,profile,rdns,region,regions,stackscript,stackscripts" >> $GITHUB_ENV
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_3 }}" >> $GITHUB_ENV
;;
"USER_4")
echo "TEST_TAGS=firewall,firewalldevice,firewalls,image,images,lkeclusters,lkenodepool,lkeversions,obj,objbucket,token,user,users,vlan,volume,volumes,vpc,vpcs" >> $GITHUB_ENV
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_4 }}" >> $GITHUB_ENV
;;
esac
- name: Install system deps
run: sudo apt-get install -y build-essential
- name: Set report filename
run: echo "REPORT_FILENAME=$(date +'%Y%m%d%H%M')_terraform_test_report_${{ matrix.user }}.xml" >> $GITHUB_ENV

- name: Setup Python
- name: Run Integration Tests
run: |
make TEST_TAGS="${{ env.TEST_TAGS }}" int-test | go-junit-report -set-exit-code -iocopy -out $REPORT_FILENAME
env:
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}

- name: Upload Test Report as Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-${{ matrix.user }}
if-no-files-found: ignore
path: '*.xml'
retention-days: 1


process-upload-report:
runs-on: ubuntu-latest
needs: [integration_tests]
if: always() # Run even if previous job fails

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Python deps
- name: Install Python dependencies
run: pip3 install requests wheel boto3

- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@latest
- name: Download test report
uses: actions/download-artifact@v4

- name: Run Integration Tests
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_terraform_test_report.xml"
if ! make int-test | go-junit-report -set-exit-code > "$report_filename"; then
echo "EXIT_STATUS=1" >> $GITHUB_ENV
fi
cat "$report_filename"
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
- name: Get .xml reports from separate Artifacts into root folder
run: rsync -av test-report-USER_*/* .

- name: Add additional information to XML report
- name: Merge Test Reports
run: python tod_scripts/merge_terraform_results.py

- name: Add Information to XML Report
run: |
filename=$(ls | grep -E '^[0-9]{12}_terraform_test_report\.xml$')
python tod_scripts/add_to_xml_test_report.py \
--branch_name "${GITHUB_REF#refs/*/}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
--xmlfile "${filename}"
- name: Upload test results to bucket
filename=$(ls | grep -E '^[0-9]{12}_terraform_merged_report.xml$')
python tod_scripts/add_to_xml_test_report.py --branch_name "${GITHUB_REF#refs/*/}" --gha_run_id "${GITHUB_RUN_ID}" --gha_run_number "${GITHUB_RUN_NUMBER}" --xmlfile "${filename}"
- name: Upload Test Results
run: |
report_filename=$(ls | grep -E '^[0-9]{12}_terraform_test_report\.xml$')
python3 tod_scripts/test_report_upload_script.py "${report_filename}"
filename=$(ls | grep -E '^[0-9]{12}_terraform_merged_report.xml$')
python3 tod_scripts/test_report_upload_script.py "${filename}"
env:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}

- name: Test Execution Status Handler
run: |
if [[ "$EXIT_STATUS" != 0 ]]; then
echo "Test execution contains failure(s)"
exit $EXIT_STATUS
else
echo "Tests passed!"
fi
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
terraform-provider-release:
name: 'Terraform Provider Release'
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/community.yml@v3
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/community.yml@v4
secrets:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-private-key-passphrase: ${{ secrets.PASSPHRASE }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int-test: fmt-check
TF_ACC=1 \
LINODE_API_VERSION="v4beta" \
RUN_LONG_TESTS=$(RUN_LONG_TESTS) \
go test --tags="$(TEST_TAGS)" -v ./$(PKG_NAME) -count $(COUNT) -timeout $(TIMEOUT) -parallel=$(PARALLEL) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" $(ARGS) | grep -v "\[no test files\]"
go test --tags="$(TEST_TAGS)" -v ./$(PKG_NAME) -count $(COUNT) -timeout $(TIMEOUT) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" $(ARGS) | grep -v "\[no test files\]"

.PHONY: smoke-test
smoke-test: fmt-check
Expand Down
14 changes: 13 additions & 1 deletion docs/data-sources/lke_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,16 @@ In addition to all arguments above, the following attributes are exported:

* `type` - This custom disk partition’s filesystem type.

* `control_plane.0.high_availability` - Whether High Availability is enabled for the cluster Control Plane.
* `control_plane` - The settings for the Kubernetes Control Plane.

* `high_availability` - Whether High Availability is enabled for the cluster Control Plane.

* `acl` - The ACL configuration for an LKE cluster's control plane.

* `enabled` - The default policy. A value of true means a default policy of DENY. A value of false means a default policy of ALLOW.

* `addresses` - A list of ip addresses to allow.

* `ipv4` - A set of individual ipv4 addresses or CIDRs to ALLOW.

* `ipv6` - A set of individual ipv6 addresses or CIDRs to ALLOW.
45 changes: 45 additions & 0 deletions docs/resources/lke_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,33 @@ resource "linode_lke_cluster" "my-cluster" {
}
```

Creating an LKE cluster with control plane:

```terraform
resource "linode_lke_cluster" "test" {
label = "my-cluster"
k8s_version = "1.28"
region = "us-central"
tags = ["prod"]
control_plane {
high_availability = true
acl {
enabled = true
addresses {
ipv4 = "0.0.0.0/0"
ipv6 = "2001:db8::/32"
}
}
}
pool {
type = "g6-standard-2"
count = 1
}
}
```

## Argument Reference

The following arguments are supported:
Expand Down Expand Up @@ -94,6 +121,24 @@ The following arguments are supported in the `control_plane` specification block

* `high_availability` - (Optional) Defines whether High Availability is enabled for the cluster Control Plane. This is an **irreversible** change.

* [`acl`](#acl) - (Optional) Defines the ACL configuration for an LKE cluster's control plane.

### acl

The following arguments are supported in the `acl` specification block:

* `enabled` - (Optional) Defines default policy. A value of true results in a default policy of DENY. A value of false results in default policy of ALLOW, and has the same effect as delete the ACL configuration.

* [`addresses`](#addresses) - (Optional) A list of ip addresses to allow.

### addresses

The following arguments are supported in the `addresses` specification block:

* `ipv4` - (Optional) A set of individual ipv4 addresses or CIDRs to ALLOW.

* `ipv6` - (Optional) A set of individual ipv6 addresses or CIDRs to ALLOW.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:
Expand Down
66 changes: 33 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@ module github.com/linode/terraform-provider-linode/v2
go 1.21

require (
github.com/aws/aws-sdk-go-v2 v1.26.0
github.com/aws/aws-sdk-go-v2 v1.27.0
github.com/aws/aws-sdk-go-v2/config v1.27.1
github.com/aws/aws-sdk-go-v2/credentials v1.17.1
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.2
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.0
github.com/aws/smithy-go v1.20.1
github.com/go-resty/resty/v2 v2.12.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3
github.com/aws/smithy-go v1.20.2
github.com/go-resty/resty/v2 v2.13.1
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/go-hclog v1.6.2
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/terraform-plugin-framework v1.8.0
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1
github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-go v0.22.2
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.15.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-plugin-testing v1.7.0
github.com/linode/linodego v1.33.0
github.com/hashicorp/terraform-plugin-mux v0.16.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/hashicorp/terraform-plugin-testing v1.8.0
github.com/linode/linodego v1.34.0
github.com/linode/linodego/k8s v1.25.2
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
golang.org/x/crypto v0.23.0
golang.org/x/net v0.25.0
golang.org/x/sync v0.7.0
)

require (
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.19.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.22.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.27.1 // indirect
Expand All @@ -67,11 +67,11 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hc-install v0.6.3 // indirect
github.com/hashicorp/hcl/v2 v2.20.0 // indirect
github.com/hashicorp/hc-install v0.6.4 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.20.0 // indirect
github.com/hashicorp/terraform-json v0.21.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.22.1 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand All @@ -96,18 +96,18 @@ require (
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.3 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/oauth2 v0.19.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit abb9e80

Please sign in to comment.