Skip to content

Commit

Permalink
Merge pull request #2130 from cjihrig/kubectl-examples
Browse files Browse the repository at this point in the history
examples: fix kubectl examples for v1
  • Loading branch information
k8s-ci-robot authored Dec 28, 2024
2 parents 27ba0e1 + 03038f8 commit 63f3748
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
22 changes: 11 additions & 11 deletions examples/kubectl/equivalents/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ const client = k8s.KubernetesObjectApi.makeApiClient(kc);

// update deployment "my-deployment" in namespace "my-namespace" to 3 replicas
const deployment = {
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: 'my-deployment',
namespace: 'my-namespace'
},
spec: {
replicas: 3
}
}
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: 'my-deployment',
namespace: 'my-namespace',
},
spec: {
replicas: 3,
},
};

client.patch(deployment)
client.patch(deployment);
10 changes: 5 additions & 5 deletions examples/kubectl/equivalents/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const kc = new k8s.KubeConfig();
kc.loadFromDefault();

const client = k8s.KubernetesObjectApi.makeApiClient(kc);

const namespace = {
kind: 'Namespace',
metadata: {
name: 'test'
}
}
name: 'test',
},
};

client.create(namespace)
client.create(namespace);
10 changes: 5 additions & 5 deletions examples/kubectl/equivalents/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const kc = new k8s.KubeConfig();
kc.loadFromDefault();

const client = k8s.KubernetesObjectApi.makeApiClient(kc);

const namespace = {
kind: 'Namespace',
metadata: {
name: 'test'
}
}
name: 'test',
},
};

client.delete(namespace)
client.delete(namespace);
12 changes: 6 additions & 6 deletions examples/kubectl/equivalents/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const kc = new k8s.KubeConfig();
kc.loadFromDefault();

const client = k8s.KubernetesObjectApi.makeApiClient(kc);

const namespace = {
apiVersion: 'v1',
kind: 'Namespace',
metadata: {
name: 'test'
}
}
name: 'test',
},
};

const live_namespace = (await client.read(namespace)).body
console.log(live_namespace)
console.log(await client.read(namespace));

0 comments on commit 63f3748

Please sign in to comment.