Skip to content

Commit 8a4a03b

Browse files
committed
feat(k8sworker): add examples
Signed-off-by: Chris Snow <[email protected]>
1 parent 0554f53 commit 8a4a03b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

hpecp/cli/k8sworker.py

+16
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
from hpecp.k8s_worker import WorkerK8sStatus, WorkerK8s
2727
from hpecp.cli import base
2828

29+
from textwrap import dedent
30+
2931

3032
class K8sWorkerProxy(base.BaseProxy):
3133
"""Proxy object to :py:attr:`<hpecp.client.k8s_worker>`."""
@@ -35,6 +37,7 @@ def __dir__(self):
3537
return [
3638
"create_with_ssh_key",
3739
"delete",
40+
"examples",
3841
"get",
3942
"list",
4043
"set_storage",
@@ -161,6 +164,19 @@ def create_with_ssh_key(
161164

162165
print(worker_id)
163166

167+
def examples(self):
168+
"""Show examples for working with k8sclusters."""
169+
print(
170+
dedent(
171+
"""\
172+
# Find id of k8s workers by ip address
173+
$ hpecp k8sworker list --query "[*] | @[?contains('10.0.1.10 10.0.1.210', ipaddr)] | [*][_links.self.href]" --output text
174+
/api/v2/worker/k8shost/5
175+
/api/v2/worker/k8shost/7
176+
""" # noqa: E501
177+
)
178+
)
179+
164180
# TODO: verify with engineering if setup_log is a valid parameter
165181
# def get(self, id, setup_log=False):
166182
# """Get a K8SWorker."""

0 commit comments

Comments
 (0)