1.2.1 • Published 4 years ago
@pubgcorp/kubectl v1.2.1
How to Use
1. Implement IKubeConfigFactory
class KubeconfigFactory implements IKubeconfigFactory {
public async getKubeconfigs(): Promise<{ [name: string]: IKubeconfig }> {
// TODO: Implement method making Dictionary<name, IKubeconfig>
}
}2. Create Kubectl Instance
- General Version
const kubectl = new Kubectl(new KubeconfigFactory()); - Using
tsyringeVersion// entrypoint of application container.register<Kubectl>(Kubectl, { useFactory: (c) => new Kubectl(c.resolve(KubeconfigFactory)) });
3. Examples
Get Resource
export interface KubectlResponse { status: string; message: string; obj?: any; }
for custom resource// clusterName is key of dictionary<name, K8sCluster> const result: KubectlResponse = await kubectl.targetCluster(clusterName).get(namespace, kind, name);// apiVersion means like kubernetes-client.io/v1 const result: KubectlResponse = await kubectl.targetCluster(clusterName).get(namespace, kind, name, apiVersion);Apply Resource
const K8sObjects = [{ kind: 'Namespace', apiVersion: 'v1', metadata: { name: 'abcdefg', labels: {}, annotations: {}, } }] const result = await kubectl.targetCluster(clusterName).apply(k8sObjects);Patch Resource
if useJsonPatch is true, use object as json patch object, otherwise get target and merge with object.const result = await kubectl.targetCluster(clusterName).patch(namespace, target, targetName, object, useJsonPatch);
1.2.1
4 years ago
1.2.0
4 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.0.28
5 years ago
1.0.27
5 years ago
1.0.26
5 years ago
1.0.24
5 years ago
1.0.23
5 years ago
1.0.22
5 years ago
1.0.21
5 years ago
1.0.20
5 years ago
1.0.19
5 years ago
1.0.18
5 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago