Skip to content

[installer-tests] Adding test support for s3 registry backend #12252

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

Merged
merged 1 commit into from
Sep 1, 2022
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
2 changes: 1 addition & 1 deletion .werft/installer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ function randK8sVersion(config: string): string {
break;
}
case "STANDARD_EKS_TEST": {
options = ["1.21", "1.22", "1.23"]
options = ["1.21", "1.22"] // we will start 1.23 when official Ubuntu image is out
break;
}
case "STANDARD_K3S_TEST": {
Expand Down
22 changes: 15 additions & 7 deletions install/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,12 @@ gke-standard-cluster: check-env-cluster-version
terraform apply -target=module.gke -var kubeconfig=${KUBECONFIG} --auto-approve
@echo "Done creating GKE cluster"

ami_id_120 := "ami-0ecb917eb4fbf4387"

ami_id_121 := "ami-0d57fb01036fac543"

ami_id_122 := "ami-0b306cb7e98db98e4"

ami_id_120 := "ami-0ecb917eb4fbf4387"

ami_id_121 := "ami-0d57fb01036fac543"

ami_id_122 := "ami-0b306cb7e98db98e4"
ami_id_123 := "ami-0eba9c07a41b01c3b" # since there is no official ubuntu image, we do not support this

.PHONY:
## eks-standard-cluster: Creates an EKS cluster
Expand Down Expand Up @@ -226,6 +221,15 @@ storage-config-aws:
envsubst < ./manifests/kots-config-aws-storage.yaml > tmp_2_config.yml
yq m -i tmp_config.yml tmp_2_config.yml

s3-registry-backend-config-aws: # this registry config involves using s3 backend for incluster registry
export REGION=$$(terraform output -json aws_s3_registry_backend | yq r - 'region') && \
export ENDPOINT=$$(terraform output -json aws_s3_registry_backend | yq r - 'endpoint') && \
export BUCKET=$$(terraform output -json aws_s3_registry_backend | yq r - 'bucket_name') && \
export S3_ACCESS_KEY_ID=$$(terraform output -json aws_s3_registry_backend | yq r - 'access_key_id') && \
export S3_SECRET_ACCESS_KEY=$$(terraform output -json aws_s3_registry_backend | yq r - 'secret_access_key') && \
envsubst < ./manifests/kots-config-aws-s3-backend.yaml > tmp_2_config.yml
yq m -i tmp_config.yml tmp_2_config.yml

registry-config-aws:
export SERVER=$$(terraform output -json aws_registry | yq r - 'server' | cut -d / -f 1) && \
export PASSWORD=$$(terraform output -json aws_registry | yq r - 'password') && \
Expand All @@ -240,9 +244,13 @@ db-config-incluster:
@echo "Nothing to do"

registry-config-incluster:
ifeq ($(cloud), aws)
$(MAKE) s3-registry-backend-config-aws
else
@echo "Nothing to do"
endif

torage ?= incluster
storage ?= incluster
registry ?= incluster
db ?= incluster
.PHONY:
Expand Down
2 changes: 2 additions & 0 deletions install/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ module "eks" {
create_external_registry = true
create_external_database = true
create_external_storage = true
# we test against a separate bucket for registry backend
create_external_storage_for_registry_backend = true
}

module "certmanager" {
Expand Down
25 changes: 25 additions & 0 deletions install/tests/manifests/kots-config-aws-s3-backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: kots.io/v1beta1
kind: ConfigValues
spec:
values:
reg_incluster:
value: "1"
data: "reg_incluster"
reg_incluster_storage:
value: "s3"
data: "reg_incluster_storage"
reg_incluster_storage_s3_region:
value: ${REGION}
data: "reg_incluster_storage_s3_region"
reg_incluster_storage_s3_endpoint:
value: "${ENDPOINT}"
data: "reg_incluster_storage_s3_endpoint"
reg_incluster_storage_s3_bucketname:
value: "${BUCKET}"
data: "reg_incluster_storage_s3_bucketname"
reg_incluster_storage_s3_accesskey:
value: "${S3_ACCESS_KEY_ID}"
data: "reg_incluster_storage_s3_accesskey"
reg_incluster_storage_s3_secretkey:
value: "${S3_SECRET_ACCESS_KEY}"
data: "reg_incluster_storage_s3_secretkey"
5 changes: 5 additions & 0 deletions install/tests/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ output "aws_database" {
value = try(module.eks.database, null)
}

output "aws_s3_registry_backend" {
sensitive = true
value = try(module.eks.registry_backend, null)
}

output "azure_database" {
sensitive = true
value = try(module.aks.database, null)
Expand Down