diff --git a/README.md b/README.md index dc650bf2..46a16dc7 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,8 @@ The final state is a regional gke cluster running on a private network with a ba - `bootstrap` - Enables required APIs and provisions the initial "inception" service account as well as the GCS bucket to store all terraform state required in all other phases. This step should be executed 1 time only and not automated. - `inception` - Provisions all security sensitive resourced like the vpc network, bastion, roles, service accounts etc. - `platform` - Provisions the gke cluster itself -- `services` - Deploys the [ingress-nginx](https://github.com/kubernetes/ingress-nginx) and [cert-manager](https://cert-manager.io/docs/) charts onto the k8s cluster - basic dependencies for everything else that will be deployed to kubernetes. -The `bootstrap`, `inception` and `platform` modules currently only support GCP while the `services` module is IaaS independent. +The `bootstrap`, `inception` and `platform` modules currently only support GCP. In the future additional versions of the first 3 modules will be developped to support other IaaSes. The structure of the modules is intended to support continous delivery. diff --git a/ci/commons.lib.yml b/ci/commons.lib.yml index 953839ef..da33bc4b 100644 --- a/ci/commons.lib.yml +++ b/ci/commons.lib.yml @@ -20,8 +20,8 @@ #@ return testflight_group_name(cloud) + "-postgresql" #@ end -#@ def testflight_services_job_name(cloud): -#@ return testflight_group_name(cloud) + "-services" +#@ def testflight_smoketest_job_name(cloud): +#@ return testflight_group_name(cloud) + "-smoketest" #@ end #@ def testflight_cleanup_postgresql_job_name(cloud): diff --git a/ci/gcp.lib.yml b/ci/gcp.lib.yml index 716155b6..59f7c500 100644 --- a/ci/gcp.lib.yml +++ b/ci/gcp.lib.yml @@ -5,7 +5,7 @@ #@ "testflight_inception_job_name", #@ "testflight_platform_job_name", #@ "testflight_postgresql_job_name", -#@ "testflight_services_job_name", +#@ "testflight_smoketest_job_name", #@ "testflight_cleanup_job_name", #@ "testflight_cleanup_postgresql_job_name", #@ "bump_repos_job_name", @@ -35,7 +35,7 @@ source: - modules/inception/gcp - modules/platform/gcp - modules/postgresql/gcp - - modules/services + - modules/smoketest/gcp uri: #@ data.values.git_uri branch: #@ data.values.git_branch private_key: #@ data.values.github_private_key @@ -158,8 +158,8 @@ plan: on_failure: #@ slack_failure_notification() #@ end -#@ def gcp_testflight_services_job(): -name: #@ testflight_services_job_name("gcp") +#@ def gcp_testflight_smoketest_job(): +name: #@ testflight_smoketest_job_name("gcp") serial: true plan: - get: gcp-testflight-lock @@ -177,7 +177,7 @@ plan: - get: gcp-testflight-uid passed: - #@ testflight_platform_job_name("gcp") -- task: services +- task: smoketest config: platform: linux image_resource: #@ task_image_config() @@ -190,7 +190,7 @@ plan: path: testflight-uid params: #@ gcp_testflight_task_params() run: - path: pipeline-tasks/ci/tasks/gcp/services.sh + path: pipeline-tasks/ci/tasks/gcp/smoketest.sh - #@ slack_success_notification() on_failure: #@ slack_failure_notification() #@ end @@ -238,22 +238,22 @@ serial: true plan: - get: gcp-testflight-lock passed: - - #@ testflight_services_job_name("gcp") + - #@ testflight_smoketest_job_name("gcp") - #@ testflight_cleanup_postgresql_job_name("gcp") - in_parallel: - get: #@ modules_resource_name("gcp") trigger: true passed: - - #@ testflight_services_job_name("gcp") + - #@ testflight_smoketest_job_name("gcp") - #@ testflight_cleanup_postgresql_job_name("gcp") - get: repo passed: - - #@ testflight_services_job_name("gcp") + - #@ testflight_smoketest_job_name("gcp") - #@ testflight_cleanup_postgresql_job_name("gcp") - { get: pipeline-tasks } - get: gcp-testflight-uid passed: - - #@ testflight_services_job_name("gcp") + - #@ testflight_smoketest_job_name("gcp") - #@ testflight_cleanup_postgresql_job_name("gcp") - task: teardown config: @@ -435,7 +435,7 @@ source: - #@ gcp_testflight_bootstrap_job() - #@ gcp_testflight_inception_job() - #@ gcp_testflight_platform_job() -- #@ gcp_testflight_services_job() +- #@ gcp_testflight_smoketest_job() - #@ gcp_testflight_postgresql_job() - #@ gcp_testflight_cleanup_postgresql_job() - #@ gcp_testflight_cleanup_job() diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 4e20233f..28da8839 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -1,12 +1,12 @@ #@ load("@ytt:data", "data") -#@ load("commons.lib.yml", +#@ load("commons.lib.yml", #@ "testflight_group_name", #@ "testflight_bootstrap_job_name", #@ "testflight_inception_job_name", #@ "testflight_platform_job_name", #@ "testflight_postgresql_job_name", -#@ "testflight_services_job_name", +#@ "testflight_smoketest_job_name", #@ "testflight_cleanup_job_name", #@ "testflight_cleanup_postgresql_job_name", #@ "bump_repos_job_name", @@ -30,7 +30,7 @@ groups: - #@ testflight_bootstrap_job_name(cloud) - #@ testflight_inception_job_name(cloud) - #@ testflight_platform_job_name(cloud) - - #@ testflight_services_job_name(cloud) + - #@ testflight_smoketest_job_name(cloud) - #@ testflight_cleanup_job_name(cloud) #@ if cloud == "gcp": - #@ testflight_postgresql_job_name(cloud) @@ -47,7 +47,7 @@ groups: - #@ testflight_bootstrap_job_name(cloud) - #@ testflight_inception_job_name(cloud) - #@ testflight_platform_job_name(cloud) - - #@ testflight_services_job_name(cloud) + - #@ testflight_smoketest_job_name(cloud) - #@ testflight_cleanup_job_name(cloud) #@ if cloud == "gcp": - #@ testflight_postgresql_job_name(cloud) diff --git a/ci/tasks/gcp/services.sh b/ci/tasks/gcp/smoketest.sh similarity index 93% rename from ci/tasks/gcp/services.sh rename to ci/tasks/gcp/smoketest.sh index 54761aa4..ccedcf9c 100755 --- a/ci/tasks/gcp/services.sh +++ b/ci/tasks/gcp/smoketest.sh @@ -28,7 +28,7 @@ export ADDITIONAL_SSH_OPTS="-o StrictHostKeyChecking=no -i ${CI_ROOT}/login.ssh" gcloud compute os-login ssh-keys add --key-file=${CI_ROOT}/login.ssh.pub cp ${CI_ROOT}/gcloud-creds.json ./ -bin/prep-services.sh +bin/prep-smoketest.sh set +e for i in {1..60}; do @@ -38,4 +38,4 @@ for i in {1..60}; do done set -e -gcloud compute ssh --ssh-key-file=${CI_ROOT}/login.ssh ${bastion_name} --zone=${bastion_zone} -- "cd repo/examples/gcp; export GOOGLE_APPLICATION_CREDENTIALS=\$(pwd)/gcloud-creds.json; echo yes | make initial-services && echo yes | make services" +gcloud compute ssh --ssh-key-file=${CI_ROOT}/login.ssh ${bastion_name} --zone=${bastion_zone} -- "cd repo/examples/gcp; export GOOGLE_APPLICATION_CREDENTIALS=\$(pwd)/gcloud-creds.json; echo yes | make smoketest" diff --git a/ci/tasks/gcp/teardown.sh b/ci/tasks/gcp/teardown.sh index e52b2f9d..e5b50c7b 100755 --- a/ci/tasks/gcp/teardown.sh +++ b/ci/tasks/gcp/teardown.sh @@ -22,9 +22,9 @@ bastion_zone="$(cd inception && terraform output bastion_zone | jq -r)" export BASTION_USER="sa_$(cat ${CI_ROOT}/gcloud-creds.json | jq -r '.client_id')" export ADDITIONAL_SSH_OPTS="-o StrictHostKeyChecking=no -i ${CI_ROOT}/login.ssh" -bin/prep-services.sh +bin/prep-smoketest.sh -gcloud compute ssh --ssh-key-file=${CI_ROOT}/login.ssh ${bastion_name} --zone=${bastion_zone} -- "cd repo/examples/gcp; export GOOGLE_APPLICATION_CREDENTIALS=\$(pwd)/gcloud-creds.json; echo yes | make destroy-services" +gcloud compute ssh --ssh-key-file=${CI_ROOT}/login.ssh ${bastion_name} --zone=${bastion_zone} -- "cd repo/examples/gcp; export GOOGLE_APPLICATION_CREDENTIALS=\$(pwd)/gcloud-creds.json; echo yes | make destroy-smoketest" echo yes | make destroy-platform echo yes | GOOGLE_CREDENTIALS=$(cat inception-sa-creds.json) make destroy-inception diff --git a/examples/gcp/Makefile b/examples/gcp/Makefile index d5a28590..c364077d 100644 --- a/examples/gcp/Makefile +++ b/examples/gcp/Makefile @@ -14,13 +14,9 @@ platform: cd platform \ && $(TF) apply -initial-services: - cd services \ +smoketest: + cd smoketest \ && $(TF) init \ - && $(TF) apply -target module.services.helm_release.cert_manager - -services: - cd services \ && $(TF) apply postgresql: @@ -35,8 +31,8 @@ destroy-inception: && $(TF) state rm module.inception.google_storage_bucket_iam_policy.policy || true cd inception && $(TF) destroy -destroy-services: - cd services \ +destroy-smoketest: + cd smoketest \ && $(TF) destroy destroy-platform: @@ -51,4 +47,4 @@ destroy-postgresql: cd postgresql \ && $(TF) destroy -.PHONY: bootstrap inception platform services postgresql +.PHONY: bootstrap inception platform smoketest postgresql diff --git a/examples/gcp/README.md b/examples/gcp/README.md index 2b44602b..347fcbe5 100644 --- a/examples/gcp/README.md +++ b/examples/gcp/README.md @@ -86,26 +86,3 @@ $ gcloud compute ssh ${bastion_name} --zone=${bastion_zone} --project=${gcp_proj