-
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.
- Loading branch information
Showing
60 changed files
with
318 additions
and
210 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
26 changes: 26 additions & 0 deletions
26
core/deployment/src/main/java/io/quarkus/deployment/dev/CodeGenLock.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,26 @@ | ||
package io.quarkus.deployment.dev; | ||
|
||
import java.util.concurrent.locks.Lock; | ||
import java.util.concurrent.locks.ReentrantReadWriteLock; | ||
|
||
/** | ||
* Lock that is used to prevent scanning and compiling while code generator is updating sources | ||
* There is a race when testing this, where you can see the intermediate empty state of the | ||
* file, or where the file time changes twice. Codegen hold this lock during modification | ||
* to avoid the race. | ||
*/ | ||
public class CodeGenLock { | ||
|
||
/** | ||
* Allow for multiple code generators to run at the same time but give exclusive run to RuntimeUpdatesProcessor | ||
*/ | ||
private static final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); | ||
|
||
public static Lock lockForCodeGen() { | ||
return lock.readLock(); | ||
} | ||
|
||
public static Lock lockForCompilation() { | ||
return lock.writeLock(); | ||
} | ||
} |
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
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
40 changes: 40 additions & 0 deletions
40
...oyment/src/test/java/io/quarkus/kubernetes/client/deployment/KubernetesClientCDITest.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,40 @@ | ||
package io.quarkus.kubernetes.client.deployment; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.inject.Singleton; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.fabric8.kubernetes.client.Config; | ||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.quarkus.kubernetes.client.KubernetesConfigCustomizer; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class KubernetesClientCDITest { | ||
|
||
@Inject | ||
KubernetesClient client; | ||
|
||
@Test | ||
public void test() { | ||
assertEquals("-1", client.getConfiguration().getApiVersion()); | ||
} | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Customizer.class)) | ||
.overrideConfigKey("quarkus.kubernetes-client.devservices.enabled", "false"); | ||
|
||
@Singleton | ||
public static class Customizer implements KubernetesConfigCustomizer { | ||
@Override | ||
public void customize(Config config) { | ||
config.setApiVersion("-1"); | ||
} | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...client/runtime/src/main/java/io/quarkus/kubernetes/client/KubernetesConfigCustomizer.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,25 @@ | ||
package io.quarkus.kubernetes.client; | ||
|
||
import java.util.List; | ||
|
||
import io.fabric8.kubernetes.client.Config; | ||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.quarkus.kubernetes.client.runtime.KubernetesClientBuildConfig; | ||
import io.quarkus.kubernetes.client.runtime.KubernetesClientProducer; | ||
import io.quarkus.kubernetes.client.runtime.KubernetesConfigProducer; | ||
import io.quarkus.runtime.TlsConfig; | ||
|
||
/** | ||
* Meant to be implemented by a CDI bean that provided arbitrary customization for the default {@link Config} created by | ||
* Quarkus. | ||
* <p> | ||
* The {@link Config} is in turn used to produce the default {@link KubernetesClient} | ||
* <p> | ||
* | ||
* @see KubernetesConfigProducer#config(KubernetesClientBuildConfig, TlsConfig, List) } | ||
* @see KubernetesClientProducer#kubernetesClient(Config) } | ||
*/ | ||
public interface KubernetesConfigCustomizer { | ||
|
||
void customize(Config config); | ||
} |
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
Oops, something went wrong.