Skip to content
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

fix: ImageEnricher#mergeEnvVariables causes error for empty env #3221

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Usage:
* Fix #2110: Add new helm dependency update goal task (`k8s:helm-dependency-update` for maven and `k8sHelmDependencyUpdate` for gradle)
* Fix #3122: JKube should also pass project directory in `buildpacks` build strategy
* Fix #2467: Add support for specifying imagePullSecrets via resource configuration
* Fix #3220: ImageEnricher#mergeEnvVariables causes error for empty env

_**Note**_:
- `defaultStorageClass` and `useStorageClassAnnotation` fields have been removed from VolumePermissionEnricher (`jkube-volume-permission`). Users are advised to use these fields from PersistentVolumeClaimStorageClassEnricher (`jkube-persistentvolumeclaim-storageclass`) instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private void mergeEnvVariables(Container container) {
EnvVar newEnvVar =
new EnvVarBuilder()
.withName(resourceEnvEntry.getKey())
.withValue(resourceEnvEntry.getValue())
.withValue(Optional.ofNullable(resourceEnvEntry.getValue()).orElse(""))
.build();

EnvVar oldEnvVar = containerEnvVars.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ items:
spec:
containers:
- env:
- name: MY_ENV_empty
- name: MY_ENV_key
value: MY_ENV_value
- name: KUBERNETES_NAMESPACE
Expand Down
1 change: 1 addition & 0 deletions kubernetes-maven-plugin/it/src/it/env-metadata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<configuration>
<resources>
<env>
<MY_ENV_empty></MY_ENV_empty>
<MY_ENV_key>MY_ENV_value</MY_ENV_key>
<KUBERNETES_NAMESPACE>this_will_not_be_overridden</KUBERNETES_NAMESPACE>
</env>
Expand Down