summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorMorten Tokle <mortent@oath.com>2019-06-07 11:12:38 +0200
committerandreer <andreer@verizonmedia.com>2019-06-19 12:44:08 +0200
commit825d5eb50ef63809454542a47173ebfba56bbcf1 (patch)
tree617c2643cf01a6bdb1b8511f0bfbc68ab75f63b6 /configserver
parent6b03dcdb00d381a580e10dcb48a2f02a29d2810e (diff)
Propagate deploy params to model
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java7
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java3
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java21
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java3
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java3
5 files changed, 29 insertions, 8 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
index fc6667087c6..13a94caf04f 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
@@ -132,6 +132,7 @@ public class ModelContextImpl implements ModelContext {
private final boolean useFdispatchByDefault;
private final boolean useAdaptiveDispatch;
private final boolean dispatchWithProtobuf;
+ private final String tlsSecretsKeyName;
public Properties(ApplicationId applicationId,
boolean multitenantFromConfig,
@@ -144,7 +145,8 @@ public class ModelContextImpl implements ModelContext {
Set<Rotation> rotations,
boolean isBootstrap,
boolean isFirstTimeDeployment,
- FlagSource flagSource) {
+ FlagSource flagSource,
+ String tlsSecretsKeyName) {
this.applicationId = applicationId;
this.multitenant = multitenantFromConfig || hostedVespa || Boolean.getBoolean("multitenant");
this.configServerSpecs = configServerSpecs;
@@ -164,6 +166,7 @@ public class ModelContextImpl implements ModelContext {
.with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value();
this.useAdaptiveDispatch = Flags.USE_ADAPTIVE_DISPATCH.bindTo(flagSource)
.with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value();
+ this.tlsSecretsKeyName = tlsSecretsKeyName;
}
@Override
@@ -215,6 +218,8 @@ public class ModelContextImpl implements ModelContext {
@Override
public boolean useAdaptiveDispatch() { return useAdaptiveDispatch; }
+ @Override
+ public String tlsSecretsKeyName() { return tlsSecretsKeyName; }
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java
index 6351a93e6e6..8917fa7bcb8 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java
@@ -129,7 +129,8 @@ public class ActivatedModelsBuilder extends ModelsBuilder<Application> {
new Rotations(curator, TenantRepository.getTenantPath(tenant)).readRotationsFromZooKeeper(applicationId),
false, // We may be bootstrapping, but we only know and care during prepare
false, // Always false, assume no one uses it when activating
- flagSource);
+ flagSource,
+ null /* TODO Read from ZK */);
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java
index 4cabf39edcc..686a6872093 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java
@@ -35,6 +35,7 @@ public final class PrepareParams {
static final String VESPA_VERSION_PARAM_NAME = "vespaVersion";
static final String ROTATIONS_PARAM_NAME = "rotations";
static final String CONTAINER_ENDPOINTS_PARAM_NAME = "containerEndpoints";
+ static final String TLS_SECRETS_KEY_NAME_PARAM_NAME = "tlsSecretsKeyName";
private final ApplicationId applicationId;
private final TimeoutBudget timeoutBudget;
@@ -44,11 +45,11 @@ public final class PrepareParams {
private final boolean isBootstrap;
private final Optional<Version> vespaVersion;
private final Set<Rotation> rotations;
- private final List<ContainerEndpoint> containerEndpoints;
+ private final Optional<String> tlsSecretsKeyName;
private PrepareParams(ApplicationId applicationId, TimeoutBudget timeoutBudget, boolean ignoreValidationErrors,
- boolean dryRun, boolean verbose, boolean isBootstrap, Optional<Version> vespaVersion,
- Set<Rotation> rotations, List<ContainerEndpoint> containerEndpoints) {
+ boolean dryRun, boolean verbose, boolean isBootstrap, Optional<Version> vespaVersion, Set<Rotation> rotations,
+ List<ContainerEndpoint> containerEndpoints, Optional<String> tlsSecretsKeyName) {
this.timeoutBudget = timeoutBudget;
this.applicationId = applicationId;
this.ignoreValidationErrors = ignoreValidationErrors;
@@ -61,6 +62,7 @@ public final class PrepareParams {
if ((rotations != null && !rotations.isEmpty()) && !containerEndpoints.isEmpty()) {
throw new IllegalArgumentException("Cannot set both rotations and containerEndpoints");
}
+ this.tlsSecretsKeyName = tlsSecretsKeyName;
}
public static class Builder {
@@ -74,6 +76,7 @@ public final class PrepareParams {
private Optional<Version> vespaVersion = Optional.empty();
private Set<Rotation> rotations;
private List<ContainerEndpoint> containerEndpoints = List.of();
+ private Optional<String> tlsSecretsKeyName = Optional.empty();
public Builder() { }
@@ -136,12 +139,18 @@ public final class PrepareParams {
if (serialized == null) return this;
Slime slime = SlimeUtils.jsonToSlime(serialized);
containerEndpoints = ContainerEndpointSerializer.endpointListFromSlime(slime);
+ return this;
+ }
+
+ public Builder tlsSecretsKeyName(String tlsSecretsKeyName) {
+ this.tlsSecretsKeyName = Optional.ofNullable(tlsSecretsKeyName)
+ .filter(s -> ! s.isEmpty());
return this;
}
public PrepareParams build() {
return new PrepareParams(applicationId, timeoutBudget, ignoreValidationErrors, dryRun,
- verbose, isBootstrap, vespaVersion, rotations, containerEndpoints);
+ verbose, isBootstrap, vespaVersion, rotations, containerEndpoints, tlsSecretsKeyName);
}
}
@@ -155,6 +164,7 @@ public final class PrepareParams {
.vespaVersion(request.getProperty(VESPA_VERSION_PARAM_NAME))
.rotations(request.getProperty(ROTATIONS_PARAM_NAME))
.containerEndpoints(request.getProperty(CONTAINER_ENDPOINTS_PARAM_NAME))
+ .tlsSecretsKeyName(request.getProperty(TLS_SECRETS_KEY_NAME_PARAM_NAME))
.build();
}
@@ -212,4 +222,7 @@ public final class PrepareParams {
return timeoutBudget;
}
+ public Optional<String> tlsSecretsKeyName() {
+ return tlsSecretsKeyName;
+ }
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java
index 7af61a6efc1..b54b47fdaf2 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java
@@ -174,7 +174,8 @@ public class SessionPreparer {
rotationsSet,
params.isBootstrap(),
! currentActiveApplicationSet.isPresent(),
- context.getFlagSource());
+ context.getFlagSource(),
+ params.tlsSecretsKeyName().orElse(null));
this.preparedModelsBuilder = new PreparedModelsBuilder(modelFactoryRegistry,
permanentApplicationPackage,
configDefinitionRepo,
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java
index 23326474371..d7fafb2dace 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java
@@ -55,7 +55,8 @@ public class ModelContextImplTest {
rotations,
false,
false,
- flagSource),
+ flagSource,
+ null),
Optional.empty(),
new Version(6),
new Version(6));