Skip to content

Commit

Permalink
fix (#584): order of configmap decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Jul 10, 2020
1 parent 9e748d6 commit 5dc4ab4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ public AddConfigMapDataDecorator(String name, Map<String, String> map) {
public void andThenVisit(ConfigMapFluent<?> config, ObjectMeta resourceMeta) {
config.addToData(map);
}

@Override
public Class<? extends Decorator>[] after() {
return new Class[]{ ResourceProvidingDecorator.class ,AddConfigMapDataDecorator.class };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ public Class<T> getType() {
return (Class)Generics.getTypeArguments(NamedResourceDecorator.class, NamedResourceDecorator.this.getClass()).get(0);
}
}

@Override
public Class<? extends Decorator>[] after() {
return new Class[]{ ResourceProvidingDecorator.class };
}
}
1 change: 1 addition & 0 deletions tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<module>feat-547-spring-boot-request-mapping</module>
<module>feat-575-knative-local-autoscaling</module>
<module>feat-575-knative-global-autoscaling</module>
<module>feat-575-knative-scale-to-zero</module>
<module>feat-572-knative-cluster-local</module>
</modules>

Expand Down

0 comments on commit 5dc4ab4

Please sign in to comment.