Skip to content

Commit a6e5622

Browse files
vulkoingimroboquat
authored andcommitted
Fix cert recreation
1 parent 849170f commit a6e5622

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

.werft/util/certs.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ export class InstallCertificateParams {
1414

1515
export async function certReady(werft: Werft, config: JobConfig, slice: string): Promise<boolean> {
1616
const certName = `harvester-${config.previewEnvironment.destname}`;
17+
const cpu = config.withLargeVM ? 12 : 6;
18+
const memory = config.withLargeVM ? 24 : 12;
19+
20+
// set some common vars for TF
21+
// We pass the GCP credentials explicitly, otherwise for some reason TF doesn't pick them up
22+
const commonVars = `GOOGLE_BACKEND_CREDENTIALS=${GCLOUD_SERVICE_ACCOUNT_PATH} \
23+
GOOGLE_APPLICATION_CREDENTIALS=${GCLOUD_SERVICE_ACCOUNT_PATH} \
24+
TF_VAR_dev_kube_path=${CORE_DEV_KUBECONFIG_PATH} \
25+
TF_VAR_harvester_kube_path=${HARVESTER_KUBECONFIG_PATH} \
26+
TF_VAR_preview_name=${config.previewEnvironment.destname} \
27+
TF_VAR_vm_cpu=${cpu} \
28+
TF_VAR_vm_memory=${memory}Gi \
29+
TF_VAR_vm_storage_class="longhorn-gitpod-k3s-202209251218-onereplica"`
1730

1831
if (isCertReady(certName)){
1932
werft.log(slice, `Certificate ready`);
@@ -23,21 +36,17 @@ export async function certReady(werft: Werft, config: JobConfig, slice: string):
2336
const maxAttempts = 5
2437
var certReady = false
2538
for (var i = 1;i<=maxAttempts;i++) {
26-
werft.log(slice, `Creating cert: Attempt ${i}`);
27-
exec(`GOOGLE_BACKEND_CREDENTIALS=${GCLOUD_SERVICE_ACCOUNT_PATH} \
28-
GOOGLE_APPLICATION_CREDENTIALS=${GCLOUD_SERVICE_ACCOUNT_PATH} \
29-
TF_VAR_dev_kube_path=${CORE_DEV_KUBECONFIG_PATH} \
30-
TF_VAR_harvester_kube_path=${HARVESTER_KUBECONFIG_PATH} \
31-
TF_VAR_preview_name=${config.previewEnvironment.destname} \
32-
TF_CLI_ARGS_plan="-replace=kubernetes_manifest.cert" \
33-
./dev/preview/workflow/preview/deploy-harvester.sh`,
34-
{slice: slice})
35-
3639
werft.log(slice, `Checking for cert readiness: Attempt ${i}`);
3740
if (waitCertReady(certName)) {
3841
certReady = true;
3942
break;
4043
}
44+
45+
werft.log(slice, `Creating cert: Attempt ${i}`);
46+
exec(`${commonVars} \
47+
TF_CLI_ARGS_plan="-replace=kubernetes_manifest.cert" \
48+
./dev/preview/workflow/preview/deploy-harvester.sh`,
49+
{slice: slice})
4150
}
4251

4352
if (!certReady) {

dev/preview/infrastructure/harvester/variables.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ variable "dev_kube_path" {
1515

1616
variable "vm_memory" {
1717
type = string
18-
default = "2Gi"
18+
default = "12Gi"
1919
description = "Memory for the VM"
2020
}
2121

2222
variable "vm_cpu" {
2323
type = number
24-
default = 2
24+
default = 6
2525
description = "CPU for the VM"
2626
}
2727

2828
variable "vm_storage_class" {
2929
type = string
30-
default = "longhorn-gitpod-k3s-202209251218-onereplica"
3130
description = "The storage class for the VM"
3231
}
3332

0 commit comments

Comments
 (0)