🚑️ Fix kubeconfig flag for logs and env
This commit is contained in:
parent
64216c6401
commit
49129b5f48
@ -51,7 +51,7 @@ public class LogResource
|
||||
|
||||
public List<KubernetesLog> getLogs(Pod pod, LocalDateTime from)
|
||||
{
|
||||
String command = String.format("kubectl logs %s -n %s --timestamps", pod.getMetadata().getName(), pod.getMetadata().getNamespace());
|
||||
String command = String.format("kubectl --kubeconfig=%s logs %s -n %s --timestamps", clientProvider.pathToKubeconfig(), pod.getMetadata().getName(), pod.getMetadata().getNamespace());
|
||||
List<KubernetesLog> result = new ArrayList<>();
|
||||
List<String> logs = processRunner.runToLines(command);
|
||||
for (String log : logs)
|
||||
|
||||
@ -28,6 +28,9 @@ public class PodResource
|
||||
@Inject
|
||||
ProcessRunner processRunner;
|
||||
|
||||
@Inject
|
||||
ClientProvider clientProvider;
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes
|
||||
@ -41,7 +44,7 @@ public class PodResource
|
||||
private List<EnvVar> getVars(Pod pod)
|
||||
{
|
||||
List<EnvVar> result = new ArrayList<>();
|
||||
List<String> lines = processRunner.runToLines(String.format("kubectl exec -it %s -n %s -- env", pod.getMetadata().getName(), pod.getMetadata().getNamespace()));
|
||||
List<String> lines = processRunner.runToLines(String.format("kubectl --kubeconfig=%s exec -it %s -n %s -- env", clientProvider.pathToKubeconfig(), pod.getMetadata().getName(), pod.getMetadata().getNamespace()));
|
||||
for (String line : lines)
|
||||
{
|
||||
int indexOfFirstEquals = line.indexOf("=");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user