Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fb352ad
JMC-8237: Connect with Jolokia protocol over kubernetes HTTP proxy
skarsaune May 28, 2024
626e56f
Revert "JMC-8237: Connect with Jolokia protocol over kubernetes HTTP …
skarsaune Aug 4, 2024
eb19c59
JMC-8237: Connect with Jolokia protocol over kubernetes HTTP proxy
skarsaune May 28, 2024
5cc8576
Revert "JMC-8237: Connect with Jolokia protocol over kubernetes HTTP …
skarsaune Aug 6, 2024
56ba52e
JMC-8237: Connect with Jolokia protocol over kubernetes HTTP proxy
skarsaune May 28, 2024
a97f7d1
JMC-8237: Remove unneeded template entries in plugin.xml
skarsaune Sep 8, 2024
c81c035
JMC-8237: Remove requirement to unlock credentials on startup
skarsaune Sep 8, 2024
39b98bf
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Sep 8, 2024
0df3c91
JMC-8237: Add kubernetes to 2024-06
skarsaune Sep 10, 2024
36fdb91
Revert "JMC-8237: Remove requirement to unlock credentials on startup"
skarsaune Sep 15, 2024
6b0a03a
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Sep 21, 2024
7dc1b95
JMC-8237: Ensure credentials check only occur if credentials are actu…
skarsaune Oct 11, 2024
7567c83
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Nov 16, 2024
c815b52
JMC-8237: Removed JVM info from descriptor as it will be interpreted …
skarsaune Nov 17, 2024
cdf6ccf
JMC-8237: Removed JVM info from descriptor - follow up
skarsaune Nov 17, 2024
25bc655
JMC-8237: Remove unused message
skarsaune Nov 17, 2024
a4ca550
JMC-8237: Fixed spotbugs issue
skarsaune Nov 17, 2024
25586fb
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Jan 7, 2025
8c878ab
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Jan 11, 2025
a5d6ac7
JMC-8237: Upgrade to jolokia 2.2.2
skarsaune Feb 16, 2025
9d1570d
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Feb 16, 2025
ca1ee0a
JMC-8237: Updated bundle version to 10.0.0. Updated copyright year
skarsaune Feb 16, 2025
3cc408e
JMC-8237: Remove unneeded changes
skarsaune Feb 16, 2025
0e9e1f5
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Jun 1, 2025
43805f9
JMC-8237: Removed dead assignment
skarsaune Jun 5, 2025
b65687e
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune Jul 12, 2025
690bbbb
JMC-8237: Upgrade jolokia 2.2.2 -> 2.2.9
skarsaune Jul 16, 2025
e90f615
JMC-8237: Upgrade jolokia 2.2.2 -> 2.2.9
skarsaune Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions application/org.openjdk.jmc.feature.core/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@
version="0.0.0"
unpack="false"/>

<plugin
id="org.openjdk.jmc.kubernetes"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.jolokia.service.discovery"
download-size="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public JolokiaContext getJolokiaContext() {
StaticConfiguration configuration = new StaticConfiguration(ConfigKey.AGENT_ID, "jmc");//$NON-NLS-1$
JolokiaServiceManager serviceManager = JolokiaServiceManagerFactory.createJolokiaServiceManager(configuration,
new JulLogHandler(PLUGIN_ID), new AllowAllRestrictor(),
() -> new TreeSet<ServerDetector>(Arrays.asList(ServerDetector.FALLBACK)));
logHandleer -> new TreeSet<ServerDetector>(Arrays.asList(ServerDetector.FALLBACK)));
return serviceManager.start();
}

Expand Down
19 changes: 19 additions & 0 deletions application/org.openjdk.jmc.kubernetes/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.openjdk.jmc.kubernetes;singleton:=true
Bundle-Version: 10.0.0.qualifier
Automatic-Module-Name: org.openjdk.jmc.kubernetes
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.openjdk.jmc.jolokia,
org.eclipse.core.runtime,
org.eclipse.ui,
org.openjdk.jmc.ui,
org.eclipse.swt,
org.jolokia.client-kubernetes.standalone;bundle-version="2.2.9",
org.openjdk.jmc.rjmx
Export-Package: org.openjdk.jmc.kubernetes,
org.openjdk.jmc.kubernetes.preferences
Import-Package: org.apache.commons.logging;version="1.2.0"
Bundle-Activator: org.openjdk.jmc.kubernetes.JmcKubernetesPlugin
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Properties file for org.openjdk.jmc.kubernetes
page.name = Kubernetes
Bundle-Name = Kubernetes JMC extensions
7 changes: 7 additions & 0 deletions application/org.openjdk.jmc.kubernetes/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
OSGI-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\
plugin.xml
64 changes: 64 additions & 0 deletions application/org.openjdk.jmc.kubernetes/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2025, Kantega AS. All rights reserved.

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

The contents of this file are subject to the terms of either the Universal Permissive License
v 1.0 as shown at http://oss.oracle.com/licenses/upl

or the following license:

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided with
the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--><?eclipse version="3.4"?>
<plugin>
<extension
point="org.openjdk.jmc.rjmx.jmxProtocols">
<client
class="org.openjdk.jmc.kubernetes.JmcKubernetesJmxConnectionProvider" protocol="kubernetes">
<sysproperty name="running.in.jmc" include="true" />
</client>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.openjdk.jmc.browser.preferences.BrowserPreferencePage"
class="org.openjdk.jmc.kubernetes.preferences.JmcKubernetesPreferenceForm"
id="org.openjdk.jmc.kubernetes.preferences.JmcKubernetesPreferences"
name="%page.name">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.openjdk.jmc.kubernetes.preferences.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.openjdk.jmc.rjmx.descriptorProvider">
<provider
class="org.openjdk.jmc.kubernetes.KubernetesDiscoveryListener">
</provider>
</extension>
</plugin>
49 changes: 49 additions & 0 deletions application/org.openjdk.jmc.kubernetes/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2025, Kantega AS. All rights reserved.

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

The contents of this file are subject to the terms of either the Universal Permissive License
v 1.0 as shown at http://oss.oracle.com/licenses/upl

or the following license:

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided with
the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openjdk.jmc</groupId>
<artifactId>missioncontrol.application</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>org.openjdk.jmc.kubernetes</artifactId>
<packaging>eclipse-plugin</packaging>
<properties>
<jmc.config.path>${project.basedir}/../../configuration</jmc.config.path>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Kantega AS. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
* v 1.0 as shown at http://oss.oracle.com/licenses/upl
*
* or the following license:
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openjdk.jmc.kubernetes;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.regex.Pattern;

import javax.management.InstanceNotFoundException;

import org.jolokia.client.J4pClient;
import org.jolokia.client.exception.J4pException;
import org.jolokia.client.exception.J4pRemoteException;
import org.jolokia.client.request.J4pResponse;
import org.openjdk.jmc.jolokia.JmcJolokiaJmxConnection;
import org.openjdk.jmc.rjmx.common.ConnectionException;

/**
* Jolokia based MBeanServerConnector tailored for JMC needs
*/
public class JmcKubernetesJmxConnection extends JmcJolokiaJmxConnection {

static final Collection<Pattern> DISCONNECT_SIGNS = Arrays.asList(Pattern.compile("Error: pods \".+\" not found")); //$NON-NLS-1$

public JmcKubernetesJmxConnection(J4pClient client) throws IOException {
super(client);
}

@SuppressWarnings("rawtypes")
@Override
protected J4pResponse unwrapException(J4pException e) throws IOException, InstanceNotFoundException {
// recognize signs of disconnect and signal to the application for better
// handling
if (isKnownDisconnectException(e)) {
throw new ConnectionException(e.getMessage());
} else {
return super.unwrapException(e);
}
}

private boolean isKnownDisconnectException(J4pException e) {
if (!(e instanceof J4pRemoteException)) {
return false;
}
if (!"io.fabric8.kubernetes.client.KubernetesClientException".equals(((J4pRemoteException) e).getErrorType())) { //$NON-NLS-1$
return false;
}
return DISCONNECT_SIGNS.stream().anyMatch(pattern -> pattern.matcher(e.getMessage()).matches());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Kantega AS. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
* v 1.0 as shown at http://oss.oracle.com/licenses/upl
*
* or the following license:
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openjdk.jmc.kubernetes;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Map;

import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorProvider;
import javax.management.remote.JMXServiceURL;

/**
* This {@code JMXConnectionProvider} handles the "kubernetes" protocol.
*/
public class JmcKubernetesJmxConnectionProvider implements JMXConnectorProvider {
@Override
public JMXConnector newJMXConnector(JMXServiceURL serviceURL, Map<String, ?> environment) throws IOException {
if (!"kubernetes".equals(serviceURL.getProtocol())) { //$NON-NLS-1$
throw new MalformedURLException("I only serve Kubernetes connections"); //$NON-NLS-1$
}
return new JmcKubernetesJmxConnector(serviceURL, environment);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Kantega AS. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
* v 1.0 as shown at http://oss.oracle.com/licenses/upl
*
* or the following license:
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openjdk.jmc.kubernetes;

import java.io.IOException;
import java.util.Map;

import javax.management.remote.JMXServiceURL;

import org.jolokia.client.J4pClient;
import org.jolokia.client.jmxadapter.RemoteJmxAdapter;
import org.jolokia.kubernetes.client.KubernetesJmxConnector;

public class JmcKubernetesJmxConnector extends KubernetesJmxConnector {

public JmcKubernetesJmxConnector(JMXServiceURL serviceURL, Map<String, ?> environment) {
super(serviceURL, environment);
}

@Override
protected RemoteJmxAdapter createAdapter(J4pClient client) throws IOException {
return new JmcKubernetesJmxConnection(client);
}
}
Loading