Skip to content

Commit

Permalink
Add labels and annotation to minikube manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jul 8, 2020
1 parent 91015de commit 6baafc9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public List<KubernetesAnnotationBuildItem> createAnnotations(KubernetesConfig ku
Optional<MetricsConfigurationBuildItem> metricsConfiguration, List<KubernetesPortBuildItem> kubernetesPorts) {
List<KubernetesAnnotationBuildItem> result = new ArrayList<KubernetesAnnotationBuildItem>();
addAnnotations(kubernetesConfig, KUBERNETES, metricsConfiguration, kubernetesPorts, result);
addAnnotations(kubernetesConfig, MINIKUBE, metricsConfiguration, kubernetesPorts, result);
addAnnotations(openshiftConfig, OPENSHIFT, metricsConfiguration, kubernetesPorts, result);
addAnnotations(knativeConfig, KNATIVE, metricsConfiguration, kubernetesPorts, result);
return result;
Expand Down Expand Up @@ -211,6 +212,7 @@ public void createLabels(KubernetesConfig kubernetesConfig, OpenshiftConfig open
BuildProducer<ContainerImageLabelBuildItem> containerImageLabelsProducer) {
kubernetesConfig.labels.forEach((k, v) -> {
kubernetesLabelsProducer.produce(new KubernetesLabelBuildItem(k, v, KUBERNETES));
kubernetesLabelsProducer.produce(new KubernetesLabelBuildItem(k, v, MINIKUBE));
containerImageLabelsProducer.produce(new ContainerImageLabelBuildItem(k, v));
});
openshiftConfig.labels.forEach((k, v) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.quarkus.it.kubernetes;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
Expand Down Expand Up @@ -42,6 +43,11 @@ public void assertGeneratedResources() throws IOException {

assertThat(kubernetesList).filteredOn(i -> "Deployment".equals(i.getKind())).hasOnlyOneElementSatisfying(i -> {
assertThat(i).isInstanceOfSatisfying(Deployment.class, d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("minikube-with-application-properties");
assertThat(m.getLabels()).contains(entry("foo", "bar"));
assertThat(m.getAnnotations()).contains(entry("bar", "baz"));
});

assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getReplicas()).isEqualTo(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
quarkus.kubernetes.deployment-target=minikube
quarkus.http.port=9090
quarkus.kubernetes.node-port=31999
quarkus.kubernetes.labels.foo=bar
quarkus.kubernetes.annotations.bar=baz

0 comments on commit 6baafc9

Please sign in to comment.