-
Notifications
You must be signed in to change notification settings - Fork 861
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,478 additions
and
90 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
29 changes: 29 additions & 0 deletions
29
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/RefreshableKeys.java
This file contains 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,29 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.cloud.oracle; | ||
|
||
/** | ||
* | ||
* @author Jan Horvath | ||
*/ | ||
public interface RefreshableKeys { | ||
|
||
public void refreshKeys(); | ||
|
||
} |
This file contains 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 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 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 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
73 changes: 73 additions & 0 deletions
73
...rise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/k8s/KubernetesLoaders.java
This file contains 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,73 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.cloud.oracle.assets.k8s; | ||
|
||
import io.fabric8.kubernetes.api.model.Pod; | ||
import io.fabric8.kubernetes.api.model.PodList; | ||
import io.fabric8.kubernetes.api.model.apps.Deployment; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.netbeans.modules.cloud.oracle.compute.ClusterItem; | ||
import org.netbeans.modules.cloud.oracle.compute.PodItem; | ||
import org.openide.util.NbBundle; | ||
|
||
/** | ||
* | ||
* @author Jan Horvath | ||
*/ | ||
@NbBundle.Messages({ | ||
"ForwardingPorts=Forwarding http://localhost:{0} to a pod {1}" | ||
|
||
}) | ||
public class KubernetesLoaders { | ||
|
||
public static List<PodItem> loadPods(ClusterItem cluster, List<String> deploymentNames) { | ||
final List<PodItem> result = new ArrayList<>(); | ||
KubernetesUtils.runWithClient(cluster, client -> { | ||
for (String name : deploymentNames) { | ||
Deployment deployment = client | ||
.apps() | ||
.deployments() | ||
.inNamespace(cluster.getNamespace()) | ||
.withName(name) | ||
.get(); | ||
if (deployment == null) { | ||
continue; | ||
} | ||
|
||
var labelSelector = deployment | ||
.getSpec() | ||
.getSelector() | ||
.getMatchLabels(); | ||
|
||
PodList podList = client.pods() | ||
.inNamespace(cluster.getNamespace()) | ||
.withLabels(labelSelector) | ||
.list(); | ||
for (Pod pod : podList.getItems()) { | ||
result.add(new PodItem(cluster, | ||
pod.getMetadata().getNamespace(), | ||
pod.getMetadata().getName())); | ||
} | ||
} | ||
}); | ||
return result; | ||
} | ||
|
||
} |
This file contains 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
56 changes: 56 additions & 0 deletions
56
...rise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/k8s/PortForwardAction.java
This file contains 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,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.cloud.oracle.assets.k8s; | ||
|
||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import org.netbeans.modules.cloud.oracle.compute.PodItem; | ||
import org.openide.awt.ActionID; | ||
import org.openide.awt.ActionRegistration; | ||
import org.openide.util.NbBundle; | ||
|
||
/** | ||
* | ||
* @author Jan Horvath | ||
*/ | ||
@ActionID( | ||
category = "Tools", | ||
id = "org.netbeans.modules.cloud.oracle.actions.PortForwardAction" | ||
) | ||
@ActionRegistration( | ||
displayName = "#PortForward", | ||
asynchronous = true | ||
) | ||
|
||
@NbBundle.Messages({ | ||
"PortForward=Start port forwarding" | ||
}) | ||
public class PortForwardAction implements ActionListener { | ||
private final PodItem pod; | ||
|
||
public PortForwardAction(PodItem pod) { | ||
this.pod = pod; | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
PortForwards.getDefault().startPortForward(pod); | ||
} | ||
|
||
} |
Oops, something went wrong.