Skip to content

Commit

Permalink
add description
Browse files Browse the repository at this point in the history
  • Loading branch information
ssharaev committed Dec 21, 2024
1 parent 674fd9f commit 4b0522a
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 50 deletions.
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# intellij-k8s-env Changelog

## [Unreleased]
## [0.1.0]
### Added
- Draft created
- Run configuration environment variables from Kubernetes configmap and secrets,
container runtime environment, and container Vault runtime environment
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
[![Version](https://img.shields.io/jetbrains/plugin/v/MARKETPLACE_ID.svg)](https://plugins.jetbrains.com/plugin/MARKETPLACE_ID)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/MARKETPLACE_ID.svg)](https://plugins.jetbrains.com/plugin/MARKETPLACE_ID)

## Template ToDo list
- [x] Create a new [IntelliJ Platform Plugin Template][template] project.
- [ ] Get familiar with the [template documentation][template].
- [ ] Adjust the [pluginGroup](./gradle.properties) and [pluginName](./gradle.properties), as well as the [id](./src/main/resources/META-INF/plugin.xml) and [sources package](./src/main/java).
- [ ] Adjust the plugin description in `README` (see [Tips][docs:plugin-description])
- [ ] Review the [Legal Agreements](https://plugins.jetbrains.com/docs/marketplace/legal-agreements.html?from=IJPluginTemplate).
- [ ] [Publish a plugin manually](https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate) for the first time.
- [ ] Set the `MARKETPLACE_ID` in the above README badges. You can obtain it once the plugin is published to JetBrains Marketplace.
- [ ] Set the [Plugin Signing](https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate) related [secrets](https://github.com/JetBrains/intellij-platform-plugin-template#environment-variables).
- [ ] Set the [Deployment Token](https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html?from=IJPluginTemplate).
- [ ] Click the <kbd>Watch</kbd> button on the top of the [IntelliJ Platform Plugin Template][template] to be notified about releases containing new features and fixes.
This plugin allows you to add environment variables to your run configuration from a k8s cluster. It uses the current context from `$KUBECONFIG` or `$HOME/.kube/config` file.

It supports several modes:
- Configmap and secrets - fetch variables from multiple configmap and/or secrets
- Pod environment - fetch all environment variables from the selected pod
- Pod Vault environment - fetch all Vault environment variables from the selected pod.

Also, you can replace your variable values using regexp.

![Screenshot](/doc/img/screenshot.png)

## Installation

Expand All @@ -35,7 +34,6 @@
Download the [latest release](https://github.com/ssharaev/intelij-k8s-env-plugin/releases/latest) and install it manually using
<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>⚙️</kbd> > <kbd>Install plugin from disk...</kbd>


# License

Copyright (c) 2024 Sviatoslav Sharaev. See the [LICENSE](./LICENSE) file for license rights and limitations (MIT).
Expand Down
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "com.ssharaev"
version = "0.0.1-alfa"
version = providers.gradleProperty("pluginVersion")

repositories {
mavenCentral()
Expand All @@ -28,6 +28,7 @@ intellij {

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
path.set(file("CHANGELOG.md").canonicalPath)
groups.empty()
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}
Expand All @@ -46,7 +47,13 @@ tasks {
}

patchPluginXml {
sinceBuild.set("233")
untilBuild.set("245")
sinceBuild.set(providers.gradleProperty("pluginSinceBuild").get())
untilBuild.set(providers.gradleProperty("pluginUntilBuild").get())
changeNotes = provider {
changelog.renderItem(changelog.getLatest()
.withHeader(false)
.withEmptySections(false),
org.jetbrains.changelog.Changelog.OutputType.HTML)
}
}
}
Binary file added doc/img/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 3 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html

pluginGroup = com.github.ssharaev.intellijk8senvplugin
pluginName = intellij-k8s-env
pluginName = Kubernetes Run Configuration Env
pluginRepositoryUrl = https://github.com/ssharaev/intellij-k8s-env-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.0.1-alfa
pluginVersion = 0.1.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 233
pluginUntilBuild = 242.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2023.3.8

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins =
pluginUntilBuild = 245.*

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.10.2

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true

Expand Down
19 changes: 19 additions & 0 deletions manifests/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: dev-configmap-two
namespace: dev
data:
CONFIGMAP_TWO_FIRST_ENV: 'dev-configmap-two-dev'
CONFIGMAP_TWO_SECOND_ENV: 'dev-configmap-two-dev'

---
apiVersion: v1
kind: ConfigMap
metadata:
name: dev-configmap-one
namespace: dev
data:
CONFIGMAP_ONE_FIRST_ENV: 'dev-configmap-one'
CONFIGMAP_ONE_SECOND_ENV: 'dev-configmap-one'

11 changes: 11 additions & 0 deletions manifests/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: dev
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
20 changes: 20 additions & 0 deletions manifests/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Secret
metadata:
name: dev-secret-one
namespace: dev
type: kubernetes.io/ssh-auth
data:
# the data is abbreviated in this example
ssh-privatekey: 'UG91cmluZzYlRW1vdGljb24lU2N1YmE='

---
apiVersion: v1
kind: Secret
metadata:
name: dev-secret-two
namespace: dev
type: kubernetes.io/ssh-auth
data:
privatekey-dev: 'UG91cmluZzYlRW1vdGljb24lU2N1YmE='
ssh-privatekey: 'UG91cmluZzYlRW1vdGljb24lU2N1YmE='
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public Map<String, String> getEnvFromPod(@NotNull String namespace, @NotNull Str
// TODO change command
public Map<String, String> getVaultEnvFromPod(@NotNull String namespace, @NotNull String podName) {
LOGGER.debug("Start searching pod k8s vault env for namespace: " + namespace + " and pod name: " + podName);
return execInPod(namespace, podName, "printenv");
return execInPod(namespace, podName, "/vault/vault-env env");
}

private Map<String, String> execInPod(@NotNull String namespace, @NotNull String podName, @NotNull String command) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NotificationService {

private static final String NOTIFICATION_GROUP = "com.ssharaev.k8sEnv";
private static final String NOTIFICATION_GROUP = "com.ssharaev.k8s.env.plugin";

public static void notifyWarn(@NotNull String title, @NotNull String body) {
Notifications.Bus.notify(new Notification(NOTIFICATION_GROUP, title, body, NotificationType.WARNING));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public RunConfigurationPanelProvider() {
this.envModeComboBox = new ComboBox<>(EnvMode.beautyNames());
this.envModeComboBox.addItemListener(e -> updatePanel());
this.replacementModel = new ListTableModel<>(
new RegexpTableColumnInfo("Regexp"),
new ReplacementTableColumnInfo("Replacement"));
new RegexpTableColumnInfo("Search"),
new ReplacementTableColumnInfo("Replace"));
this.namespaceComboBoxModel = new MutableCollectionComboBoxModel<>(new ArrayList<>());
ComboBox<String> namespaceComboBox = new ComboBox<>(namespaceComboBoxModel);
namespaceComboBox.addPopupMenuListener(new PopupMenuListenerAdapter() {
Expand Down
17 changes: 9 additions & 8 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
<idea-plugin>
<id>com.ssharaev.k8sEnv</id>
<id>com.ssharaev.k8s.env.plugin</id>
<name>Kubernetes Run Configuration Env</name>
<vendor email="[email protected]">Slava Sharaev</vendor>
<vendor email="[email protected]">Sviatoslav Sharaev</vendor>

<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.java</depends>
<depends>com.intellij.gradle</depends>
<depends>org.jetbrains.idea.maven</depends>

<extensions defaultExtensionNs="com.intellij">
<notificationGroup displayType="BALLOON" id="com.ssharaev.k8sEnv"/>
<notificationGroup displayType="BALLOON" id="com.ssharaev.k8s.env.plugin"/>
<runConfigurationExtension implementation="com.ssharaev.k8s.env.plugin.run.configuration.IdeaRunConfigurationExtension"/>
</extensions>

Expand All @@ -24,13 +24,14 @@

<description>
<![CDATA[
Provides run configuration environment variables from kubernetes</p>
Support several modes:
<p>This plugin allows you to add environment variables to your run configuration from a k8s cluster. It uses the current context from <code>$KUBECONFIG</code> or <code>$HOME/.kube/config</code> file.</p>
<p>It supports several modes:</p>
<ul>
<li>Configmap + secrets</li>
<li>Pod vault</li>
<li>Pod env</li>
<li>Configmap and secrets - fetch variables from multiple configmap and/or secrets</li>
<li>Pod environment - fetch all environment variables from the selected pod</li>
<li>Pod Vault environment - fetch all Vault environment variables from the selected pod.</li>
</ul>
<p>Also, you can replace your variable values using regexp.</p>
]]>
</description>
</idea-plugin>

0 comments on commit 4b0522a

Please sign in to comment.