Skip to content

Commit c64d341

Browse files
author
Andrew Farries
committed
Copy stripe secret into preview cluster
1 parent 49224d1 commit c64d341

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.werft/jobs/build/installer/installer.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { exec } from "../../../util/shell";
33
import { Werft } from "../../../util/werft";
44
import { getNodePoolIndex } from "../deploy-to-preview-environment";
55
import { renderPayment } from "../payment/render";
6+
import { CORE_DEV_KUBECONFIG_PATH } from "../const";
67

78
const BLOCK_NEW_USER_CONFIG_PATH = './blockNewUsers';
89
const WORKSPACE_SIZE_CONFIG_PATH = './workspaceSizing';
@@ -66,6 +67,7 @@ export class Installer {
6667
this.configureIDE(slice)
6768
this.configureObservability(slice)
6869
this.configureAuthProviders(slice)
70+
this.configureStripeAPIKeys(slice)
6971
this.configureSSHGateway(slice)
7072
this.configurePublicAPIServer(slice)
7173
this.configureUsage(slice)
@@ -161,6 +163,19 @@ EOF`)
161163
done`, { slice: slice })
162164
}
163165

166+
private configureStripeAPIKeys(slice: string) {
167+
exec(
168+
`kubectl --kubeconfig ${CORE_DEV_KUBECONFIG_PATH} -n werft get secret stripe-api-keys -o yaml > stripe-api-keys.secret.yaml`,
169+
{ slice },
170+
);
171+
exec(`yq w -i stripe-api-keys.secret.yaml metadata.namespace "default"`, { slice });
172+
exec(`yq d -i stripe-api-keys.secret.yaml metadata.creationTimestamp`, { slice });
173+
exec(`yq d -i stripe-api-keys.secret.yaml metadata.uid`, { slice });
174+
exec(`yq d -i stripe-api-keys.secret.yaml metadata.resourceVersion`, { slice });
175+
exec(`kubectl --kubeconfig "${this.options.kubeconfigPath}" apply -f stripe-api-keys.secret.yaml`, { slice });
176+
exec(`rm -f stripe-api-keys.secret.yaml`, { slice });
177+
}
178+
164179
private configureSSHGateway(slice: string) {
165180
exec(`cat /workspace/host-key.yaml \
166181
| yq w - metadata.namespace ${this.options.deploymentNamespace} \

0 commit comments

Comments
 (0)