-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable s2i when the capability is mising.
- Loading branch information
Showing
5 changed files
with
123 additions
and
2 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
58 changes: 58 additions & 0 deletions
58
...illa/deployment/src/main/java/io/quarkus/kubernetes/deployment/RemoveEnvVarDecorator.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,58 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import io.dekorate.deps.kubernetes.api.model.ContainerFluent; | ||
import io.dekorate.kubernetes.decorator.AddEnvVarDecorator; | ||
import io.dekorate.kubernetes.decorator.ApplicationContainerDecorator; | ||
import io.dekorate.kubernetes.decorator.Decorator; | ||
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator; | ||
|
||
public class RemoveEnvVarDecorator extends ApplicationContainerDecorator<ContainerFluent<?>> { | ||
|
||
private final String envVarName; | ||
|
||
public RemoveEnvVarDecorator(String envVarName) { | ||
this(ANY, envVarName); | ||
} | ||
|
||
public RemoveEnvVarDecorator(String name, String envVarName) { | ||
super(name); | ||
this.envVarName = envVarName; | ||
} | ||
|
||
public void andThenVisit(ContainerFluent<?> container) { | ||
container.removeMatchingFromEnv(e -> e.getName().equals(envVarName)); | ||
} | ||
|
||
public String getEnvVarKey() { | ||
return this.envVarName; | ||
} | ||
|
||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { ResourceProvidingDecorator.class, AddEnvVarDecorator.class }; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + ((envVarName == null) ? 0 : envVarName.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
RemoveEnvVarDecorator other = (RemoveEnvVarDecorator) obj; | ||
if (envVarName == null) { | ||
if (other.envVarName != null) | ||
return false; | ||
} else if (!envVarName.equals(other.envVarName)) | ||
return false; | ||
return true; | ||
} | ||
} |