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.
This PR the following issues: - The generated `config-autoscaler` configmap does not set the namespace which should always be `knative-serving` (see for example https://knative.dev/docs/serving/autoscaling/scale-to-zero/#enable-scale-to-zero). - Some properties do add the annotations at Knative service metadata level, and it should add them at Knative service spec template metadata level. - The property `quarkus.knative.global-auto-scaling.containerConcurrency` (hard limit option) wrongly uses the `config-autoscaler` configmap and it should use `config-defaults` configmap (see https://knative.dev/docs/serving/autoscaling/concurrency/#hard-limit) Moreover, add the autoscaling Knative properties to the Knative documentation. Fix quarkusio#23786 (cherry picked from commit 3f797dc)
- Loading branch information
Showing
15 changed files
with
307 additions
and
42 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
38 changes: 38 additions & 0 deletions
38
...illa/deployment/src/main/java/io/quarkus/kubernetes/deployment/AddConfigMapDecorator.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,38 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator; | ||
import io.fabric8.kubernetes.api.model.KubernetesListBuilder; | ||
|
||
/** | ||
* This class was created to workaround https://github.com/dekorateio/dekorate/issues/869. | ||
* Once this issue is fixed, we can delete this and use the provided by Dekorate. | ||
*/ | ||
public class AddConfigMapDecorator extends ResourceProvidingDecorator<KubernetesListBuilder> { | ||
|
||
private static final String DEFAULT_NAMESPACE = null; | ||
|
||
private final String name; | ||
private final String namespace; | ||
|
||
public AddConfigMapDecorator(String name) { | ||
this(name, DEFAULT_NAMESPACE); | ||
} | ||
|
||
public AddConfigMapDecorator(String name, String namespace) { | ||
this.name = name; | ||
this.namespace = namespace; | ||
} | ||
|
||
public void visit(KubernetesListBuilder list) { | ||
if (contains(list, "v1", "ConfigMap", name)) { | ||
return; | ||
} | ||
|
||
list.addNewConfigMapItem() | ||
.withNewMetadata() | ||
.withName(name) | ||
.withNamespace(namespace) | ||
.endMetadata() | ||
.endConfigMapItem(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ent/src/main/java/io/quarkus/kubernetes/deployment/ApplyAnnotationsToServiceTemplate.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,35 @@ | ||
package io.quarkus.kubernetes.deployment; | ||
|
||
import java.util.Map; | ||
|
||
import io.dekorate.kubernetes.decorator.NamedResourceDecorator; | ||
import io.dekorate.utils.Maps; | ||
import io.fabric8.knative.serving.v1.ServiceFluent; | ||
import io.fabric8.kubernetes.api.model.ObjectMeta; | ||
|
||
/** | ||
* This class was created to workaround https://github.com/dekorateio/dekorate/issues/869. | ||
* Once this issue is fixed, we can delete this and use the provided by Dekorate. | ||
*/ | ||
public class ApplyAnnotationsToServiceTemplate extends NamedResourceDecorator<ServiceFluent<?>> { | ||
|
||
private static final String SERVICE_KIND = "Service"; | ||
|
||
private final Map<String, String> annotations; | ||
|
||
public ApplyAnnotationsToServiceTemplate(String name, String... annotations) { | ||
this(name, Maps.from(annotations)); | ||
} | ||
|
||
public ApplyAnnotationsToServiceTemplate(String name, Map<String, String> annotations) { | ||
super(SERVICE_KIND, name); | ||
this.annotations = annotations; | ||
} | ||
|
||
@Override | ||
public void andThenVisit(ServiceFluent<?> service, ObjectMeta resourceMeta) { | ||
service.editOrNewSpec().editOrNewTemplate().editOrNewMetadata() | ||
.addToAnnotations(annotations) | ||
.endMetadata().endTemplate().endSpec(); | ||
} | ||
} |
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
Oops, something went wrong.