forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use own AddEnvVarDecorator to prevent it from being skipped
Fixes quarkusio#12063. This occurs because the dekorate version of AddEnvVarDecorator inherits from ApplicationContainerDecorator which expects metadata to be present, which doesn't happen in our context. We sidestep the issue by wrapping the original behavior and calling its andThenVisit method, which does the work when not skipped.
- Loading branch information
Showing
5 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/AddEnvVarDecorator.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,30 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import io.dekorate.deps.kubernetes.api.model.ContainerBuilder; | ||
import io.dekorate.kubernetes.config.Env; | ||
import io.dekorate.kubernetes.decorator.AddSidecarDecorator; | ||
import io.dekorate.kubernetes.decorator.ContainerDecorator; | ||
import io.dekorate.kubernetes.decorator.Decorator; | ||
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator; | ||
|
||
/** | ||
* Delegate to dekorate's version to sidestep the fact that the dekorate version of AddEnvVarDecorator inherits from | ||
* ApplicationContainerDecorator which expects metadata to be present, which doesn't happen in our context. We sidestep the | ||
* issue by wrapping the original behavior and calling its andThenVisit method, which does the work when not skipped. | ||
*/ | ||
public class AddEnvVarDecorator extends Decorator<ContainerBuilder> { | ||
private final io.dekorate.kubernetes.decorator.AddEnvVarDecorator delegate; | ||
|
||
public AddEnvVarDecorator(Env env) { | ||
delegate = new io.dekorate.kubernetes.decorator.AddEnvVarDecorator(env); | ||
} | ||
|
||
@Override | ||
public void visit(ContainerBuilder containerBuilder) { | ||
delegate.andThenVisit(containerBuilder); | ||
} | ||
|
||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { ResourceProvidingDecorator.class, ContainerDecorator.class, AddSidecarDecorator.class }; | ||
} | ||
} |
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