Skip to content

Commit 5af9933

Browse files
vulkoingimroboquat
authored andcommitted
Don't recreate cert
1 parent 2b82c4b commit 5af9933

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

.werft/util/certs.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,12 @@ export class InstallCertificateParams {
1818

1919
export async function certReady(werft: Werft, config: JobConfig, slice: string): Promise<boolean> {
2020
const certName = `harvester-${config.previewEnvironment.destname}`;
21-
const cpu = config.withLargeVM ? 12 : 6;
22-
const memory = config.withLargeVM ? 24 : 12;
23-
24-
// set some common vars for TF
25-
// We pass the GCP credentials explicitly, otherwise for some reason TF doesn't pick them up
26-
const commonVars = `GOOGLE_BACKEND_CREDENTIALS=${GCLOUD_SERVICE_ACCOUNT_PATH} \
27-
GOOGLE_APPLICATION_CREDENTIALS=${GCLOUD_SERVICE_ACCOUNT_PATH} \
28-
TF_VAR_cert_issuer=${config.certIssuer} \
29-
TF_VAR_kubeconfig_path=${GLOBAL_KUBECONFIG_PATH} \
30-
TF_VAR_preview_name=${config.previewEnvironment.destname} \
31-
TF_VAR_vm_cpu=${cpu} \
32-
TF_VAR_vm_memory=${memory}Gi \
33-
TF_VAR_vm_storage_class="longhorn-gitpod-k3s-202209251218-onereplica"`
34-
3521
if (isCertReady(certName)){
3622
werft.log(slice, `Certificate ready`);
3723
return true
3824
}
3925

40-
const maxAttempts = 5
41-
var certReady = false
42-
for (var i = 1;i<=maxAttempts;i++) {
43-
werft.log(slice, `Checking for cert readiness: Attempt ${i}`);
44-
if (waitCertReady(certName)) {
45-
certReady = true;
46-
break;
47-
}
48-
49-
werft.log(slice, `Creating cert: Attempt ${i}`);
50-
await execStream(`${commonVars} \
51-
TF_CLI_ARGS_plan="-replace=kubernetes_manifest.cert" \
52-
./dev/preview/workflow/preview/deploy-harvester.sh`,
53-
{slice: slice})
54-
}
26+
const certReady = waitCertReady(certName)
5527

5628
if (!certReady) {
5729
retrieveFailedCertDebug(certName, slice)
@@ -62,7 +34,7 @@ export async function certReady(werft: Werft, config: JobConfig, slice: string):
6234
}
6335

6436
function waitCertReady(certName: string): boolean {
65-
const timeout = "240s"
37+
const timeout = "500s"
6638
const rc = exec(
6739
`kubectl --kubeconfig ${CORE_DEV_KUBECONFIG_PATH} wait --for=condition=Ready --timeout=${timeout} -n certs certificate ${certName}`,
6840
{ dontCheckRc: true },

0 commit comments

Comments
 (0)