Skip to content

add temporary testing setup self-hosted #10536

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

Closed
wants to merge 2 commits into from
Closed
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
17 changes: 13 additions & 4 deletions .werft/installer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { Werft } from "./util/werft";

const testConfig: string = process.argv.length > 2 ? process.argv[2] : "STANDARD_K3S_TEST";
// we can provide the version of the gitpod to install (eg: 2022.4.2)
const version: string = process.argv.length > 3 ? process.argv[3] : "";
// "-" is the default value which will install the latest version
const version: string = process.argv.length > 3 ? process.argv[3] : "-";

const channel: string = process.argv.length > 4 ? process.argv[4] : "";

const makefilePath: string = join("install/tests");

Expand Down Expand Up @@ -43,12 +46,12 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
},
INSTALL_GITPOD_IGNORE_PREFLIGHTS: {
phase: "install-gitpod-without-preflights",
makeTarget: `kots-install channel=unstable version=${version} preflights=false`, // this is a bit of a hack, for now we pass params like this
makeTarget: `kots-install channel=${channel} version=${version} preflights=false`, // this is a bit of a hack, for now we pass params like this
description: "Install gitpod using kots community edition without preflights",
},
INSTALL_GITPOD: {
phase: "install-gitpod",
makeTarget: `kots-install channel=unstable version=${version} preflights=true`,
makeTarget: `kots-install channel=${channel} version=${version} preflights=true`,
description: "Install gitpod using kots community edition",
},
CHECK_INSTALLATION: {
Expand All @@ -72,6 +75,11 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
makeTarget: "get-results",
description: "Get the result of the setup",
},
DONE: {
phase: "done-msg",
makeTarget: "done-msg",
description: "The operation has terminated",
},
};

interface TestConfig {
Expand Down Expand Up @@ -113,10 +121,11 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
DESCRIPTION: "Create a SH Gitpod preview environment on a K3s cluster, created on a GCP instance",
PHASES: [
"STANDARD_K3S_CLUSTER_ON_GCP",
"GCP_MANAGED_DNS",
"CERT_MANAGER",
"INSTALL_GITPOD_IGNORE_PREFLIGHTS",
"CHECK_INSTALLATION",
"RESULTS",
"DONE", // this is a temporary hack to print clean msg
],
},
};
Expand Down
33 changes: 32 additions & 1 deletion .werft/k3s-installer-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/k3s-installer-tests.yaml -a debug=true`
args:
- name: destroy
desc: "Should the setup be destroyed or not"
required: false
default: true
- name: channel
desc: "Replicated channel to use"
required: false
default: ""
- name: version
desc: "Version of gitpod to install initially"
required: false
default: ""
pod:
serviceAccount: werft
affinity:
Expand Down Expand Up @@ -63,7 +76,25 @@ pod:
(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
printf '{{ toJson . }}' > context.json

npx ts-node .werft/installer-tests.ts "STANDARD_K3S_TEST"
export DESTROY="{{ .Annotations.destroy }}"

if [ $DESTROY == "false" ]; then
export STAGE=STANDARD_K3S_PREVIEW
else
export STAGE=STANDARD_K3S_TEST
fi

export VERSION="{{ .Annotations.version }}"
if [[ "$VERSION" == "<no value>" ]]; then
VERSION="-"
fi

export CHANNEL="{{ .Annotations.channel }}"
if [[ "$CHANNEL" == "<no value>" ]]; then
CHANNEL=""
fi

npx ts-node .werft/installer-tests.ts ${STAGE} ${VERSION} ${CHANNEL}
# The bit below makes this a cron job
plugins:
cron: "15 3 * * *"
2 changes: 1 addition & 1 deletion install/infra/terraform/k3s/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ provider "google" {
}

resource "google_service_account" "gcp_instance" {
account_id = "gcp-k3s-compute"
account_id = "sa-${var.name}"
display_name = "Service Account"
}

Expand Down
36 changes: 36 additions & 0 deletions install/licenses/dev-nan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: kots.io/v1beta1
kind: License
metadata:
name: nan-test
spec:
appSlug: gitpod
channelID: 29hLY1hDM4RI3Tbb3hqaZcsCCAz
channelName: dev-nan
customerName: nan-test
endpoint: https://replicated.app
entitlements:
domain:
title: Domain
value: ""
valueType: String
expires_at:
description: License Expiration
title: Expiration
value: ""
valueType: String
levelId:
isHidden: true
title: License level
value: 1
valueType: Integer
seats:
title: User seats
value: 0
valueType: Integer
isGitOpsSupported: true
isNewKotsUiEnabled: true
isSnapshotSupported: true
licenseID: 28hucw4HRxj8bBKUJXxV2INBnZz
licenseSequence: 12
licenseType: prod
signature: eyJsaWNlbnNlRGF0YSI6ImV5SmhjR2xXWlhKemFXOXVJam9pYTI5MGN5NXBieTkyTVdKbGRHRXhJaXdpYTJsdVpDSTZJa3hwWTJWdWMyVWlMQ0p0WlhSaFpHRjBZU0k2ZXlKdVlXMWxJam9pYm1GdUxYUmxjM1FpZlN3aWMzQmxZeUk2ZXlKc2FXTmxibk5sU1VRaU9pSXlPR2gxWTNjMFNGSjRhamhpUWt0VlNsaDRWakpKVGtKdVdub2lMQ0pzYVdObGJuTmxWSGx3WlNJNkluQnliMlFpTENKamRYTjBiMjFsY2s1aGJXVWlPaUp1WVc0dGRHVnpkQ0lzSW1Gd2NGTnNkV2NpT2lKbmFYUndiMlFpTENKamFHRnVibVZzU1VRaU9pSXlPV2hNV1RGb1JFMDBVa2t6VkdKaU0yaHhZVnBqYzBORFFYb2lMQ0pqYUdGdWJtVnNUbUZ0WlNJNkltUmxkaTF1WVc0aUxDSnNhV05sYm5ObFUyVnhkV1Z1WTJVaU9qRXlMQ0psYm1Sd2IybHVkQ0k2SW1oMGRIQnpPaTh2Y21Wd2JHbGpZWFJsWkM1aGNIQWlMQ0psYm5ScGRHeGxiV1Z1ZEhNaU9uc2laRzl0WVdsdUlqcDdJblJwZEd4bElqb2lSRzl0WVdsdUlpd2lkbUZzZFdVaU9pSWlMQ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& 5 deletions install/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ KOTS_KONFIG := "./manifests/kots-config.yaml"
license_community_beta := "../licenses/Community (Beta).yaml"
license_community_stable := "../licenses/Community.yaml"
license_community_unstable := "../licenses/Community (Unstable).yaml"
license_community_$(channel) := "../licenses/$(channel).yaml"

install-kots-cli:
curl https://kots.io/install | bash
Expand All @@ -68,7 +69,7 @@ channel ?= unstable
version ?= -
kots-install: version-flag = $(if $(version:-=),--app-version-label=$(version),)
kots-install: preflight-flag = $(if $(preflights:true=),--skip-preflights,)
kots-install: license-file = $(license_community_$(channel))
kots-install: license-file = $(license_community_$(channel))
kots-install: install-kots-cli
envsubst < ${KOTS_KONFIG} > tmp_config.yml
kubectl kots install gitpod/${channel} \
Expand Down Expand Up @@ -101,13 +102,13 @@ cleanup:

get-results:
@echo "If you have gotten this far, it means your setup succeeded"
@echo
@echo "URL of your setup is: "https://$(TF_VAR_TEST_ID).gitpod-self-hosted.com""
@echo
@echo "The IP address of you setup is "$(TF_VAR_TEST_ID).gitpod-self-hosted.com""
@echo "Following is the KUBECONFIG you can use to connect to the cluster:"
@echo
@cat ${KUBECONFIG}

done-msg:
@echo "Your operation has completed"

list-state:
terraform state list
# end