Skip to content

Commit 9468eba

Browse files
committed
use options object for operations constructor
1 parent b75d8cb commit 9468eba

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

apps/kubernetes-provider/src/index.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,22 @@ type ResourceQuantities = {
4848
};
4949

5050
class KubernetesTaskOperations implements TaskOperations {
51-
#namespace: Namespace;
51+
#namespace: Namespace = {
52+
metadata: {
53+
name: "default",
54+
},
55+
};
56+
5257
#k8sApi: {
5358
core: k8s.CoreV1Api;
5459
batch: k8s.BatchV1Api;
5560
apps: k8s.AppsV1Api;
5661
};
5762

58-
constructor(namespace = KUBERNETES_NAMESPACE) {
59-
this.#namespace = {
60-
metadata: {
61-
name: namespace,
62-
},
63-
};
63+
constructor(opts: { namespace?: string } = {}) {
64+
if (opts.namespace) {
65+
this.#namespace.metadata.name = opts.namespace;
66+
}
6467

6568
this.#k8sApi = this.#createK8sApi();
6669
}
@@ -649,7 +652,9 @@ class KubernetesTaskOperations implements TaskOperations {
649652
}
650653

651654
const provider = new ProviderShell({
652-
tasks: new KubernetesTaskOperations(),
655+
tasks: new KubernetesTaskOperations({
656+
namespace: KUBERNETES_NAMESPACE,
657+
}),
653658
type: "kubernetes",
654659
});
655660

0 commit comments

Comments
 (0)