diff --git a/annotations/knative-annotations/src/main/java/io/dekorate/knative/handler/KnativeHandler.java b/annotations/knative-annotations/src/main/java/io/dekorate/knative/handler/KnativeHandler.java index ab47dbd55..2fae6f67c 100644 --- a/annotations/knative-annotations/src/main/java/io/dekorate/knative/handler/KnativeHandler.java +++ b/annotations/knative-annotations/src/main/java/io/dekorate/knative/handler/KnativeHandler.java @@ -155,15 +155,14 @@ public void handle(KnativeConfig config) { } - if (config.getGlobalAutoScaling().getContainerConcurrency() != 0 || !config.isScaleToZeroEnabled()) { + if (config.getGlobalAutoScaling().getContainerConcurrency() != 0) { resources.decorate(KNATIVE, new AddConfigMapResourceProvidingDecorator("config-defaults")); - if (config.getGlobalAutoScaling().getContainerConcurrency() != 0) { - resources.decorate(KNATIVE, new ApplyGlobalContainerConcurrencyDecorator(config.getGlobalAutoScaling().getContainerConcurrency())); - } + resources.decorate(KNATIVE, new ApplyGlobalContainerConcurrencyDecorator(config.getGlobalAutoScaling().getContainerConcurrency())); + } - if (!config.isScaleToZeroEnabled()) { - resources.decorate(KNATIVE, new AddConfigMapDataDecorator(config.getName(), "enable-scale-to-zero", String.valueOf(config.isScaleToZeroEnabled()))); - } + if (!config.isScaleToZeroEnabled()) { + resources.decorate(KNATIVE, new AddConfigMapResourceProvidingDecorator("config-autoscaler")); + resources.decorate(KNATIVE, new AddConfigMapDataDecorator("config-autoscaler", "enable-scale-to-zero", String.valueOf(config.isAutoDeployEnabled()))); } } diff --git a/core/src/main/java/io/dekorate/kubernetes/decorator/AddConfigMapDataDecorator.java b/core/src/main/java/io/dekorate/kubernetes/decorator/AddConfigMapDataDecorator.java index dcb18f8c9..9f109a158 100644 --- a/core/src/main/java/io/dekorate/kubernetes/decorator/AddConfigMapDataDecorator.java +++ b/core/src/main/java/io/dekorate/kubernetes/decorator/AddConfigMapDataDecorator.java @@ -40,4 +40,9 @@ public AddConfigMapDataDecorator(String name, Map map) { public void andThenVisit(ConfigMapFluent config, ObjectMeta resourceMeta) { config.addToData(map); } + + @Override + public Class[] after() { + return new Class[]{ ResourceProvidingDecorator.class ,AddConfigMapDataDecorator.class }; + } } diff --git a/core/src/main/java/io/dekorate/kubernetes/decorator/NamedResourceDecorator.java b/core/src/main/java/io/dekorate/kubernetes/decorator/NamedResourceDecorator.java index ffba4fd26..9023b05fe 100644 --- a/core/src/main/java/io/dekorate/kubernetes/decorator/NamedResourceDecorator.java +++ b/core/src/main/java/io/dekorate/kubernetes/decorator/NamedResourceDecorator.java @@ -85,4 +85,9 @@ public Class getType() { return (Class)Generics.getTypeArguments(NamedResourceDecorator.class, NamedResourceDecorator.this.getClass()).get(0); } } + + @Override + public Class[] after() { + return new Class[]{ ResourceProvidingDecorator.class }; + } } diff --git a/tests/pom.xml b/tests/pom.xml index c34924383..dc9179b8f 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -55,6 +55,7 @@ feat-547-spring-boot-request-mapping feat-575-knative-local-autoscaling feat-575-knative-global-autoscaling + feat-575-knative-scale-to-zero feat-572-knative-cluster-local