Package org.jolokia.kubernetes.client
Class KubernetesJmxConnector
java.lang.Object
org.jolokia.client.jmxadapter.JolokiaJmxConnector
org.jolokia.kubernetes.client.KubernetesJmxConnector
- All Implemented Interfaces:
Closeable,AutoCloseable,JMXConnector
public class KubernetesJmxConnector
extends org.jolokia.client.jmxadapter.JolokiaJmxConnector
-
Field Summary
FieldsFields inherited from class org.jolokia.client.jmxadapter.JolokiaJmxConnector
adapter, serviceUrlFields inherited from interface javax.management.remote.JMXConnector
CREDENTIALS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilderbuildProxyPath(io.fabric8.kubernetes.api.model.Pod pod, String protocol, String port, String path) voidprotected org.jolokia.client.jmxadapter.RemoteJmxAdaptercreateAdapter(org.jolokia.client.J4pClient client) protected org.jolokia.client.J4pClientexpandAndProbeUrl(io.fabric8.kubernetes.client.KubernetesClient client, Map<String, Object> env) static io.fabric8.kubernetes.client.KubernetesClientgetApiClient(String context) Get a kubernetes client for the specified local context (in ~/.kube/config)static org.jolokia.client.J4pClientprobeProxyPath(Map<String, Object> env, io.fabric8.kubernetes.client.KubernetesClient client, StringBuilder url, HashMap<String, String> headers) Probe whether we find Jolokia in given namespace, pod and pathstatic voidManually reset any cached config.Methods inherited from class org.jolokia.client.jmxadapter.JolokiaJmxConnector
addConnectionNotificationListener, close, connect, getConnectionId, getMBeanServerConnection, getMBeanServerConnection, instantiateAdapter, mergedEnvironment, postCreateAdapter, removeConnectionNotificationListener, removeConnectionNotificationListener
-
Field Details
-
KUBERNETES_CLIENT_CONTEXT
-
-
Constructor Details
-
KubernetesJmxConnector
-
-
Method Details
-
connect
- Specified by:
connectin interfaceJMXConnector- Overrides:
connectin classorg.jolokia.client.jmxadapter.JolokiaJmxConnector- Throws:
IOException
-
createAdapter
protected org.jolokia.client.jmxadapter.RemoteJmxAdapter createAdapter(org.jolokia.client.J4pClient client) throws IOException - Throws:
IOException
-
getApiClient
Get a kubernetes client for the specified local context (in ~/.kube/config)- Parameters:
context- , specify context, null for current context- Returns:
- client configured for the specified context - potentially recycled as the setup is expensive (YAML parsing is amazingly slow)
-
resetKubernetesConfig
public static void resetKubernetesConfig()Manually reset any cached config. To be uses in case you have changed your kubeconfig -
expandAndProbeUrl
protected org.jolokia.client.J4pClient expandAndProbeUrl(io.fabric8.kubernetes.client.KubernetesClient client, Map<String, Object> env) throws MalformedURLException- Returns:
- a connection if successful
- Throws:
MalformedURLException
-
buildProxyPath
public static StringBuilder buildProxyPath(io.fabric8.kubernetes.api.model.Pod pod, String protocol, String port, String path) -
probeProxyPath
public static org.jolokia.client.J4pClient probeProxyPath(Map<String, Object> env, io.fabric8.kubernetes.client.KubernetesClient client, StringBuilder url, HashMap<String, String> headers) Probe whether we find Jolokia in given namespace, pod and path
-