Skip to content

Commit

Permalink
[installer-tests] Adding test support for s3 registry backend
Browse files Browse the repository at this point in the history
  • Loading branch information
nandajavarma committed Aug 22, 2022
1 parent 6042240 commit 432a7df
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
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
24 changes: 16 additions & 8 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:
@echo "Nothing to do"
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: "0"
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_bucket:
value: "${BUCKET}"
data: "reg_incluster_storage_s3_bucket"
reg_incluster_storage_s3_access_key_id:
value: "${S3_ACCESS_KEY_ID}"
data: "reg_incluster_storage_s3_access_key_id"
reg_incluster_storage_s3_secret_access_key:
value: "${S3_SECRET_ACCESS_KEY}"
data: "reg_incluster_storage_s3_secret_access_key"
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

0 comments on commit 432a7df

Please sign in to comment.