Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Clean up test-infra and tools #2313

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/acceptance_tests_aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:
- cron: '0 22 * * *'

env:
KUBE_CONFIG_PATH: ${{ github.workspace }}/kubernetes/test-infra/aks-new/kubeconfig
KUBE_CONFIG_PATH: ${{ github.workspace }}/kubernetes/test-infra/aks/kubeconfig
TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || vars.TERRAFORM_VERSION }}
PARALLEL_RUNS: ${{ github.event.inputs.parallelRuns || vars.PARALLEL_RUNS }}
TF_VAR_location: ${{ github.event.inputs.location || vars.AZURE_LOCATION }}
Expand All @@ -37,7 +37,7 @@ env:
TF_VAR_cluster_version: ${{ github.event.inputs.clusterVersion || vars.CLUSTER_VERSION}}

jobs:
acceptanceTests:
acceptance_tests_aks:
runs-on: [custom, linux, medium]
steps:
- name: Checkout repository
Expand All @@ -56,7 +56,7 @@ jobs:
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Provision AKS
working-directory: ${{ github.workspace }}/kubernetes/test-infra/aks-new
working-directory: ${{ github.workspace }}/kubernetes/test-infra/aks
run: |
terraform init
terraform apply -auto-approve
Expand All @@ -68,6 +68,6 @@ jobs:
make testacc
- name: Destroy AKS
if: always()
working-directory: ${{ github.workspace }}/kubernetes/test-infra/aks-new
working-directory: ${{ github.workspace }}/kubernetes/test-infra/aks
run: |
terraform destroy -auto-approve
2 changes: 1 addition & 1 deletion .github/workflows/acceptance_tests_eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ env:
TF_VAR_instance_type: ${{ github.event.inputs.instanceType || vars.AWS_INSTANCE_TYPE }}

jobs:
acceptance_tests:
acceptance_tests_eks:
runs-on: [custom, linux, medium]
steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/acceptance_tests_gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ env:
TF_VAR_instance_type: ${{ github.event.inputs.instanceType || vars.GOOGLE_INSTANCE_TYPE }}

jobs:
acceptance_tests:
acceptance_tests_gke:
runs-on: [custom, linux, medium]
steps:
- name: Checkout repository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/acceptance_tests_kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
default: ".*"
terraformVersion:
description: Terraform version
default: 1.5.3
default: 1.5.6
parallelRuns:
description: The maximum number of tests to run simultaneously
default: 8
Expand All @@ -31,7 +31,7 @@ env:
TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || vars.TERRAFORM_VERSION }}

jobs:
acceptance_tests:
acceptance_tests_kind:
runs-on: [custom, linux, medium]
steps:
- name: Checkout repository
Expand Down
1 change: 0 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ test: fmtcheck
go test $(TEST) || exit 1
echo $(TEST) | \
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
go test ./tools

testacc: fmtcheck vet
TF_ACC=1 go test $(TEST) -v -vet=off $(TESTARGS) -parallel $(PARALLEL_RUNS) -timeout 3h
Expand Down
5 changes: 0 additions & 5 deletions kubernetes/test-infra/aks-new/.gitignore

This file was deleted.

46 changes: 0 additions & 46 deletions kubernetes/test-infra/aks-new/main.tf

This file was deleted.

22 changes: 0 additions & 22 deletions kubernetes/test-infra/aks-new/variables.tf

This file was deleted.

92 changes: 15 additions & 77 deletions kubernetes/test-infra/aks/main.tf
Original file line number Diff line number Diff line change
@@ -1,98 +1,36 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

locals {
random_prefix = "${var.prefix}-${random_id.tf-k8s-acc.hex}"
}
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

provider "azurerm" {
features {}
}

data "azurerm_kubernetes_service_versions" "current" {
location = var.location
version_prefix = var.kubernetes_version
}

resource "random_id" "tf-k8s-acc" {
byte_length = 3
}
resource "random_pet" "name" {}

resource "azurerm_resource_group" "tf-k8s-acc" {
name = "${local.random_prefix}-rsg"
resource "azurerm_resource_group" "test_group" {
name = "test-aks-${random_pet.name.id}"
location = var.location
}

resource "azurerm_route_table" "tf-k8s-acc" {
name = "${local.random_prefix}-rt"
location = azurerm_resource_group.tf-k8s-acc.location
resource_group_name = azurerm_resource_group.tf-k8s-acc.name

route {
name = "default"
address_prefix = "10.100.0.0/14"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.10.1.1"
}
}

resource "azurerm_virtual_network" "tf-k8s-acc" {
name = "${local.random_prefix}-network"
location = azurerm_resource_group.tf-k8s-acc.location
resource_group_name = azurerm_resource_group.tf-k8s-acc.name
address_space = ["10.1.0.0/16"]
}

resource "azurerm_subnet" "tf-k8s-acc" {
name = "${local.random_prefix}-internal"
resource_group_name = azurerm_resource_group.tf-k8s-acc.name
address_prefixes = ["10.1.0.0/24"]
virtual_network_name = azurerm_virtual_network.tf-k8s-acc.name
}

resource "azurerm_subnet_route_table_association" "tf-k8s-acc" {
subnet_id = azurerm_subnet.tf-k8s-acc.id
route_table_id = azurerm_route_table.tf-k8s-acc.id
}

resource "azurerm_kubernetes_cluster" "tf-k8s-acc" {
name = "${local.random_prefix}-cluster"
resource_group_name = azurerm_resource_group.tf-k8s-acc.name
location = azurerm_resource_group.tf-k8s-acc.location
dns_prefix = "${local.random_prefix}-cluster"
kubernetes_version = data.azurerm_kubernetes_service_versions.current.latest_version

# Uncomment to enable SSH access to nodes
#
# linux_profile {
# admin_username = "acctestuser1"
# ssh_key {
# key_data = "${file(var.public_ssh_key_path)}"
# }
# }
resource "azurerm_kubernetes_cluster" "test" {
name = "test-aks-${random_pet.name.id}"
location = azurerm_resource_group.test_group.location
resource_group_name = azurerm_resource_group.test_group.name
dns_prefix = "test"
kubernetes_version = var.cluster_version

default_node_pool {
name = "agentpool"
node_count = var.workers_count
vm_size = var.workers_type
os_disk_size_gb = 30

# Required for advanced networking
vnet_subnet_id = azurerm_subnet.tf-k8s-acc.id
name = "default"
node_count = var.node_count
vm_size = var.vm_size
}


identity {
type = "SystemAssigned"
}

network_profile {
network_plugin = "azure"
}
}

resource "local_file" "kubeconfig" {
content = azurerm_kubernetes_cluster.tf-k8s-acc.kube_config_raw
content = azurerm_kubernetes_cluster.test.kube_config_raw
filename = "${path.module}/kubeconfig"
}

7 changes: 4 additions & 3 deletions kubernetes/test-infra/aks/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

output "kubeconfig_path" {
value = local_file.kubeconfig.filename
output "kubeconfig" {
value = azurerm_kubernetes_cluster.test.kube_config_raw
sensitive = true
}

output "cluster_name" {
value = azurerm_kubernetes_cluster.tf-k8s-acc.name
value = "test-aks-${random_pet.name.id}"
}
14 changes: 14 additions & 0 deletions kubernetes/test-infra/aks/terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0


terraform {
required_version = ">= 1.0"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.0.0, < 4.0.0"
}
}
}
35 changes: 12 additions & 23 deletions kubernetes/test-infra/aks/variables.tf
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "prefix" {
description = "A prefix used for all resources in this example"
default = "tf-k8s-acc"
}
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

variable "location" {
default = "West Europe"
description = "The Azure Region in which all resources in this example should be provisioned"
}

variable "kubernetes_version" {
type = string
type = string
default = "West Europe"
}

variable "workers_count" {
type = string
variable "node_count" {
type = number
default = 2
}

variable "workers_type" {
variable "vm_size" {
type = string
default = "Standard_DS4_v2"
default = "Standard_A4_v2"
}

# Uncomment to enable SSH access to nodes
#
# variable "public_ssh_key_path" {
# description = "The Path at which your Public SSH Key is located. Defaults to ~/.ssh/id_rsa.pub"
# default = "~/.ssh/id_rsa.pub"
#}
variable "cluster_version" {
type = string
default = "1.27"
}
7 changes: 0 additions & 7 deletions kubernetes/test-infra/aks/versions.tf

This file was deleted.

14 changes: 14 additions & 0 deletions kubernetes/test-infra/aws-ebs-csi-driver/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0


terraform {
required_version = ">= 1.0"

required_providers {
google = {
source = "hashicorp/aws"
version = ">= 5.0.0, < 6.0.0"
}
}
}
Loading
Loading