-
Notifications
You must be signed in to change notification settings - Fork 199
8237: Add support for Jolokia over Kubernetes proxy #576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
skarsaune
wants to merge
51
commits into
openjdk:master
Choose a base branch
from
skarsaune:JMC-8237-kubernetes-proxy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 29 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
fb352ad
JMC-8237: Connect with Jolokia protocol over kubernetes HTTP proxy
skarsaune 626e56f
Revert "JMC-8237: Connect with Jolokia protocol over kubernetes HTTP …
skarsaune eb19c59
JMC-8237: Connect with Jolokia protocol over kubernetes HTTP proxy
skarsaune 5cc8576
Revert "JMC-8237: Connect with Jolokia protocol over kubernetes HTTP …
skarsaune 56ba52e
JMC-8237: Connect with Jolokia protocol over kubernetes HTTP proxy
skarsaune a97f7d1
JMC-8237: Remove unneeded template entries in plugin.xml
skarsaune c81c035
JMC-8237: Remove requirement to unlock credentials on startup
skarsaune 39b98bf
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 0df3c91
JMC-8237: Add kubernetes to 2024-06
skarsaune 36fdb91
Revert "JMC-8237: Remove requirement to unlock credentials on startup"
skarsaune 6b0a03a
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 7dc1b95
JMC-8237: Ensure credentials check only occur if credentials are actu…
skarsaune 7567c83
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune c815b52
JMC-8237: Removed JVM info from descriptor as it will be interpreted …
skarsaune cdf6ccf
JMC-8237: Removed JVM info from descriptor - follow up
skarsaune 25bc655
JMC-8237: Remove unused message
skarsaune a4ca550
JMC-8237: Fixed spotbugs issue
skarsaune 25586fb
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 8c878ab
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune a5d6ac7
JMC-8237: Upgrade to jolokia 2.2.2
skarsaune 9d1570d
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune ca1ee0a
JMC-8237: Updated bundle version to 10.0.0. Updated copyright year
skarsaune 3cc408e
JMC-8237: Remove unneeded changes
skarsaune 0e9e1f5
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 43805f9
JMC-8237: Removed dead assignment
skarsaune b65687e
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 690bbbb
JMC-8237: Upgrade jolokia 2.2.2 -> 2.2.9
skarsaune e90f615
JMC-8237: Upgrade jolokia 2.2.2 -> 2.2.9
skarsaune 2fed861
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 6227cc0
JMC-8237: PR cleanup: formatting and comments
skarsaune 89b2174
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 846881d
JMC-8237: Fixed copyright for this year
skarsaune e40caec
JMC-8237: Fix more copyright years
skarsaune 384af0c
JMC-8237: Fix spotless
skarsaune 8a30b56
JMC-8237: Renamed J4p classes to Jolokia
skarsaune 235e420
JMC-8237: Use java.util for Base64 (en/de)coding
skarsaune a37d4b2
JMC-8237: spotless:apply
skarsaune d636e88
JMC-8237: More jolokia class corrections
skarsaune fb47018
JMC-8237: Add http client for kubernetes
skarsaune 392dbba
JMC-8237: Add http components to third party
skarsaune 8ae2632
JMC-8237: Update copyright year
skarsaune 47941f1
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune 6e7f764
JMC-8237: Fixed http client versions
skarsaune bd34058
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune a31c665
JMC-8237: [WIP] add http client dependency
skarsaune 16170d9
Merge remote-tracking branch 'origin/master' into JMC-8237-kubernetes…
skarsaune f4b47e4
JMC-8237: [wip] making things run again
skarsaune aad7f0c
JMC-8237: [wip] Work on custom jolokia kubernetes standalone bundle
skarsaune be02de6
JMC-8237: [WIP] Still struggling with 3rd party dependencies
skarsaune 27e7e94
JMC-8237: Go back to use standalone kubernetes jar
skarsaune 8c70c07
JMC-8237: Fix older platform definitions
skarsaune File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
application/org.openjdk.jmc.kubernetes/META-INF/MANIFEST.MF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
3 changes: 3 additions & 0 deletions
3
application/org.openjdk.jmc.kubernetes/OSGI-INF/l10n/bundle.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline at the end of the file |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
83 changes: 83 additions & 0 deletions
83
...k.jmc.kubernetes/src/main/java/org/openjdk/jmc/kubernetes/JmcKubernetesJmxConnection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could the comment be one line? |
||
| 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()); | ||
| } | ||
|
|
||
| } | ||
55 changes: 55 additions & 0 deletions
55
...bernetes/src/main/java/org/openjdk/jmc/kubernetes/JmcKubernetesJmxConnectionProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
...dk.jmc.kubernetes/src/main/java/org/openjdk/jmc/kubernetes/JmcKubernetesJmxConnector.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, should be "logHandler"