Conversation
|
Am I correct in thinking that all users may still require I had always assumed it hinged on Users may also want If pure python is preferred, then this looks like a big move in the right direction! |
src/warnet/bitcoin.py
Outdated
| # The k8s lib seems to convert json into its python representation. The following dance seems to | ||
| # avoid the worst of it. | ||
| if resp.startswith("{") or resp.startswith("["): | ||
| literal = ast.literal_eval(resp) | ||
| json_string = json.dumps(literal) | ||
| return json_string |
There was a problem hiding this comment.
the old exec_run() function added this option to stream() for this: _preload_content=False
overall i think its better to restore the old exec_run() function in k8s.py from pre-italy and just call it here.
That's as far as I got on this project: 756df48b97acb1496b2958e12b895a00
There was a problem hiding this comment.
addressed here via _preload_content=False: 16f869a
src/warnet/bitcoin.py
Outdated
| logs = sclient.read_namespaced_pod_log( | ||
| name=pod_name, | ||
| namespace=get_default_namespace(), | ||
| container=container_name, | ||
| timestamps=True, | ||
| ) |
There was a problem hiding this comment.
can also use the _log() internal function I added to get the log
src/warnet/bitcoin.py
Outdated
| # Get the IP of node_b | ||
| cmd = f"kubectl get pod {tank_b} -o jsonpath='{{.status.podIP}}'" | ||
| tank_b_ip = run_command(cmd).strip() | ||
| tank_b_pod: V1Pod = sclient.read_namespaced_pod(name=tank_b, namespace=get_default_namespace()) |
There was a problem hiding this comment.
why not use the get pod helpers in k8s.py?
src/warnet/control.py
Outdated
| print(f"Please consider waiting for the pod to become available. Encountered: {e}") | ||
| else: | ||
| pass # cancelled by user | ||
| container_name = "bitcoincore" if pod_name.startswith("tank") else None |
There was a problem hiding this comment.
we can't ever rely on tank names conforming to any kind of convention
src/warnet/k8s.py
Outdated
| with open(KUBECONFIG) as file: | ||
| kubeconfig_data = yaml.safe_load(file) |
There was a problem hiding this comment.
will this file always exist? is this the only way to get the namespace?
There was a problem hiding this comment.
I will need to revisit this.
There was a problem hiding this comment.
I replaced open(KUBECONFIG) instances with two functions that handle errors: b1365d3
Regarding getting the namespace, I do believe that the namespace stored in the KUBECONFIG file is the source of truth for the namespace for user OR our default namespace which is "warnet" right now. We talked about changing that on the call to "default". I
|
Still a few mentions |
59c173a to
04be184
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
@willcl-ark The python lib bypasses this. It currently relies on KUBECONFIG which is genreally at ~/.kube/config
I think the KubeConfigLoader provides access to KUBECONFIG, but it can also do config files in custom locations (maybe in memory, too?). Seems like the google credentials thing might be an easy win to modify KUBECONFIG with the correct google plugin data, but I have not had a chance to look into that yet.
I don't think k9s or ktop requires kubectl, but I do think we should guide users towards downloading it b/c it is so useful. Regarding setting the kubeconfig file, right now we rely on minikube to do that. I have also updated |
|
It appears that signet remains an issue. Will need to revisit. |
c666480 to
576c86d
Compare
I fixed up the signet test issue: 02562b2 It uses shlex to split up lines. Allegedly, shlex is command-line-escape-character aware. |
6431ca4 to
f15fb2f
Compare
Also, provide some logic around overwriting existing entries and also provide a warning when the namepsace is not set.
We need to specify a container name when we have prometheus logging enabled b/c we end up with a couple containers per pod.
I went with the _preload_content=False approach
Instead rely on the position of the container. Position Rule: we get logs from the first container as reported by V1Pod's spec.container metadata.
shlex appears to handle escape sequences nicely.
I figure we should add an error type for the k8s file, that way we can try...except everything from that file using just one error type.
Incorporates better error handling
This use of get_default_namespace relies on the brittle idea that get_pods will always use get_default_namespace. Currently, get_pods currently does, in fact, use get_default_namespace. However, I don't like that we use get_default_namespace out of band relative to get_pods. I'd prefer that we do not mention namespaces at all in our message to users unless we can prove it.
f15fb2f to
fcc9ed8
Compare
Took a stab at swapping out kubectl addressing #609
It appears to mostly work; however, something is up with the signet test, and I didn't have a chance to figure out what.
There was also an oddball issues around
streamreturning python dicts and lists instead of json. I was able to avoid the impacts of this issue.Some things remain less tested such as a few namespace items and the chain save-state functionality.