diff options
24 files changed, 200 insertions, 184 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 720da3d40d3..eda962af5ac 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 @@ -25,6 +25,7 @@ import com.yahoo.config.provision.Zone; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.flags.UnboundFlag; import java.io.File; @@ -230,7 +231,7 @@ public class ModelContextImpl implements ModelContext { .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); useFastValueTensorImplementation = Flags.USE_FAST_VALUE_TENSOR_IMPLEMENTATION.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); - jvmGCOPtions = Flags.JVM_GC_OPTIONS.bindTo(flagSource) + jvmGCOPtions = PermanentFlags.JVM_GC_OPTIONS.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); feedSequencer = Flags.FEED_SEQUENCER_TYPE.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintainer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintainer.java index 61d411802ad..70c1b288202 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintainer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ConfigServerMaintainer.java @@ -5,15 +5,14 @@ import com.yahoo.concurrent.maintenance.JobControl; import com.yahoo.concurrent.maintenance.JobControlState; import com.yahoo.concurrent.maintenance.JobMetrics; import com.yahoo.concurrent.maintenance.Maintainer; -import com.yahoo.config.provision.HostName; import com.yahoo.jdisc.Metric; import com.yahoo.path.Path; import com.yahoo.transaction.Mutex; import com.yahoo.vespa.config.server.ApplicationRepository; import com.yahoo.vespa.curator.Curator; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.ListFlag; +import com.yahoo.vespa.flags.PermanentFlags; import java.time.Duration; import java.time.Instant; @@ -64,7 +63,7 @@ public abstract class ConfigServerMaintainer extends Maintainer { public JobControlFlags(Curator curator, FlagSource flagSource) { this.curator = curator; - this.inactiveJobsFlag = Flags.INACTIVE_MAINTENANCE_JOBS.bindTo(flagSource); + this.inactiveJobsFlag = PermanentFlags.INACTIVE_MAINTENANCE_JOBS.bindTo(flagSource); } @Override diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/JobControlFlags.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/JobControlFlags.java index 1cb23d0c515..109e761f925 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/JobControlFlags.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/JobControlFlags.java @@ -4,8 +4,8 @@ package com.yahoo.vespa.hosted.controller.persistence; import com.yahoo.concurrent.maintenance.JobControlState; import com.yahoo.transaction.Mutex; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.ListFlag; +import com.yahoo.vespa.flags.PermanentFlags; import java.util.Set; @@ -21,7 +21,7 @@ public class JobControlFlags implements JobControlState { public JobControlFlags(CuratorDb curator, FlagSource flagSource) { this.curator = curator; - this.inactiveJobsFlag = Flags.INACTIVE_MAINTENANCE_JOBS.bindTo(flagSource); + this.inactiveJobsFlag = PermanentFlags.INACTIVE_MAINTENANCE_JOBS.bindTo(flagSource); } @Override diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java index 1b3c216c1f3..f17be5896ba 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java @@ -21,7 +21,7 @@ import com.yahoo.slime.SlimeUtils; import com.yahoo.vespa.flags.BooleanFlag; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.LockedTenant; import com.yahoo.vespa.hosted.controller.api.integration.user.Roles; @@ -71,7 +71,7 @@ public class UserApiHandler extends LoggingRequestHandler { super(parentCtx); this.users = users; this.controller = controller; - this.enable_public_signup_flow = Flags.ENABLE_PUBLIC_SIGNUP_FLOW.bindTo(flagSource); + this.enable_public_signup_flow = PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.bindTo(flagSource); } @Override diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/CloudAccessControl.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/CloudAccessControl.java index 6d2b2d58e78..ef13348fb74 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/CloudAccessControl.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/CloudAccessControl.java @@ -6,7 +6,7 @@ import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.flags.BooleanFlag; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.api.integration.ServiceRegistry; import com.yahoo.vespa.hosted.controller.api.integration.billing.BillingController; @@ -24,7 +24,9 @@ import javax.ws.rs.ForbiddenException; import java.util.List; import java.util.stream.Collectors; -import static com.yahoo.vespa.hosted.controller.api.role.RoleDefinition.*; +import static com.yahoo.vespa.hosted.controller.api.role.RoleDefinition.administrator; +import static com.yahoo.vespa.hosted.controller.api.role.RoleDefinition.hostedOperator; +import static com.yahoo.vespa.hosted.controller.api.role.RoleDefinition.hostedSupporter; /** * @author jonmv @@ -39,7 +41,7 @@ public class CloudAccessControl implements AccessControl { @Inject public CloudAccessControl(UserManagement userManagement, FlagSource flagSource, ServiceRegistry serviceRegistry) { this.userManagement = userManagement; - this.enablePublicSignup = Flags.ENABLE_PUBLIC_SIGNUP_FLOW.bindTo(flagSource); + this.enablePublicSignup = PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.bindTo(flagSource); billingController = serviceRegistry.billingController(); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java index 5b33f989163..92f6b6cef27 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java @@ -2,10 +2,9 @@ package com.yahoo.vespa.hosted.controller.restapi.application; import com.yahoo.config.provision.ApplicationName; -import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.TenantName; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.role.Role; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; @@ -23,8 +22,8 @@ import java.util.Collections; import java.util.Set; import static com.yahoo.application.container.handler.Request.Method.GET; -import static com.yahoo.application.container.handler.Request.Method.PUT; import static com.yahoo.application.container.handler.Request.Method.POST; +import static com.yahoo.application.container.handler.Request.Method.PUT; import static com.yahoo.vespa.hosted.controller.restapi.application.ApplicationApiTest.createApplicationSubmissionData; public class ApplicationApiCloudTest extends ControllerContainerCloudTest { @@ -41,7 +40,7 @@ public class ApplicationApiCloudTest extends ControllerContainerCloudTest { public void before() { tester = new ContainerTester(container, responseFiles); ((InMemoryFlagSource) tester.controller().flagSource()) - .withBooleanFlag(Flags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true); + .withBooleanFlag(PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true); deploymentTester = new DeploymentTester(new ControllerTester(tester)); deploymentTester.controllerTester().computeVersionStatus(); setupTenantAndApplication(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java index c061bfed21a..5523ce8dd9f 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java @@ -6,8 +6,8 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.test.ManualClock; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.api.integration.resource.ResourceSnapshot; import com.yahoo.vespa.hosted.controller.auditlog.AuditLogger; import com.yahoo.vespa.hosted.controller.restapi.ContainerTester; @@ -42,7 +42,7 @@ public class ControllerApiTest extends ControllerContainerTest { public void testControllerApi() { tester.assertResponse(authenticatedRequest("http://localhost:8080/controller/v1/", "", Request.Method.GET), new File("root.json")); - ((InMemoryFlagSource) tester.controller().flagSource()).withListFlag(Flags.INACTIVE_MAINTENANCE_JOBS.id(), List.of("DeploymentExpirer"), String.class); + ((InMemoryFlagSource) tester.controller().flagSource()).withListFlag(PermanentFlags.INACTIVE_MAINTENANCE_JOBS.id(), List.of("DeploymentExpirer"), String.class); // GET a list of all maintenance jobs tester.assertResponse(authenticatedRequest("http://localhost:8080/controller/v1/maintenance/", "", Request.Method.GET), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java index d9ad30020db..0ea3b061893 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java @@ -4,8 +4,8 @@ package com.yahoo.vespa.hosted.controller.restapi.user; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.TenantName; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.integration.user.User; import com.yahoo.vespa.hosted.controller.api.role.Role; @@ -19,7 +19,6 @@ import java.util.Set; import static com.yahoo.application.container.handler.Request.Method.DELETE; import static com.yahoo.application.container.handler.Request.Method.POST; -import static com.yahoo.application.container.handler.Request.Method.PUT; import static org.junit.Assert.assertEquals; /** @@ -203,7 +202,7 @@ public class UserApiTest extends ControllerContainerCloudTest { public void userMetadataTest() { ContainerTester tester = new ContainerTester(container, responseFiles); ((InMemoryFlagSource) tester.controller().flagSource()) - .withBooleanFlag(Flags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true); + .withBooleanFlag(PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true); ControllerTester controller = new ControllerTester(tester); Set<Role> operator = Set.of(Role.hostedOperator(), Role.hostedSupporter(), Role.hostedAccountant()); User user = new User("dev@domail", "Joe Developer", "dev", null); diff --git a/flags/pom.xml b/flags/pom.xml index ba0e4a94692..4f1bdcb61e3 100644 --- a/flags/pom.xml +++ b/flags/pom.xml @@ -88,6 +88,11 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> <plugins> diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index c44fba20f5d..4f794302ca1 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -3,8 +3,6 @@ package com.yahoo.vespa.flags; import com.yahoo.component.Vtag; import com.yahoo.vespa.defaults.Defaults; -import com.yahoo.vespa.flags.custom.ClusterCapacity; -import com.yahoo.vespa.flags.custom.SharedHost; import java.time.Instant; import java.time.LocalDate; @@ -15,10 +13,8 @@ import java.util.Optional; import java.util.TreeMap; import static com.yahoo.vespa.flags.FetchVector.Dimension.APPLICATION_ID; -import static com.yahoo.vespa.flags.FetchVector.Dimension.CONSOLE_USER_EMAIL; import static com.yahoo.vespa.flags.FetchVector.Dimension.HOSTNAME; import static com.yahoo.vespa.flags.FetchVector.Dimension.NODE_TYPE; -import static com.yahoo.vespa.flags.FetchVector.Dimension.TENANT_ID; import static com.yahoo.vespa.flags.FetchVector.Dimension.VESPA_VERSION; import static com.yahoo.vespa.flags.FetchVector.Dimension.ZONE_ID; @@ -46,45 +42,6 @@ import static com.yahoo.vespa.flags.FetchVector.Dimension.ZONE_ID; public class Flags { private static volatile TreeMap<FlagId, FlagDefinition> flags = new TreeMap<>(); - public static final UnboundBooleanFlag FLEET_CANARY = defineFeatureFlag( - "fleet-canary", false, - List.of("hakonhall"), "2020-12-02", "2021-02-01", - "Whether the host is a fleet canary.", - "Takes effect on next host admin tick.", - HOSTNAME); - - public static final UnboundListFlag<String> DISABLED_HOST_ADMIN_TASKS = defineListFlag( - "disabled-host-admin-tasks", List.of(), String.class, - List.of("valerijf"), "2020-12-02", "2021-02-01", - "List of host-admin task names (as they appear in the log, e.g. root>main>UpgradeTask), or some node-agent " + - "functionality (see NodeAgentTask), that should be skipped", - "Takes effect on next host admin tick", - HOSTNAME, NODE_TYPE); - - public static final UnboundStringFlag DOCKER_VERSION = defineStringFlag( - "docker-version", "1.13.1-102.git7f2769b", - List.of("hakonhall"), "2020-12-02", "2021-02-01", - "The version of the docker to use of the format VERSION-REL: The YUM package to be installed will be " + - "2:docker-VERSION-REL.el7.centos.x86_64 in AWS (and without '.centos' otherwise). " + - "If docker-version is not of this format, it must be parseable by YumPackageName::fromString.", - "Takes effect on next tick.", - HOSTNAME); - - public static final UnboundDoubleFlag CONTAINER_CPU_CAP = defineDoubleFlag( - "container-cpu-cap", 0, - List.of("valerijf"), "2020-12-02", "2021-02-01", - "Hard limit on how many CPUs a container may use. This value is multiplied by CPU allocated to node, so " + - "to cap CPU at 200%, set this to 2, etc.", - "Takes effect on next node agent tick. Change is orchestrated, but does NOT require container restart", - HOSTNAME, APPLICATION_ID); - - public static final UnboundIntFlag REBOOT_INTERVAL_IN_DAYS = defineIntFlag( - "reboot-interval-in-days", 30, - List.of("hakonhall"), "2020-12-02", "2021-02-01", - "No reboots are scheduled 0x-1x reboot intervals after the previous reboot, while reboot is " + - "scheduled evenly distributed in the 1x-2x range (and naturally guaranteed at the 2x boundary).", - "Takes effect on next run of NodeRebooter"); - public static final UnboundBooleanFlag RETIRE_WITH_PERMANENTLY_DOWN = defineFeatureFlag( "retire-with-permanently-down", false, List.of("hakonhall"), "2020-12-02", "2021-02-01", @@ -93,27 +50,6 @@ public class Flags { "Takes effect on the next run of RetiredExpirer.", HOSTNAME); - public static final UnboundListFlag<ClusterCapacity> PREPROVISION_CAPACITY = defineListFlag( - "preprovision-capacity", List.of(), ClusterCapacity.class, - List.of("hakonhall"), "2020-12-02", "2021-02-01", - "Specifies the resources that ought to be immediately available for additional cluster " + - "allocations. If the resources are not available, additional hosts will be provisioned. " + - "Only applies to dynamically provisioned zones.", - "Takes effect on next iteration of DynamicProvisioningMaintainer."); - - public static final UnboundJacksonFlag<SharedHost> SHARED_HOST = defineJacksonFlag( - "shared-host", SharedHost.createDisabled(), SharedHost.class, - List.of("hakonhall"), "2020-12-02", "2021-02-01", - "Specifies whether shared hosts can be provisioned, and if so, the advertised " + - "node resources of the host, the maximum number of containers, etc.", - "Takes effect on next iteration of DynamicProvisioningMaintainer."); - - public static final UnboundListFlag<String> INACTIVE_MAINTENANCE_JOBS = defineListFlag( - "inactive-maintenance-jobs", List.of(), String.class, - List.of("mpolden"), "2020-12-02", "2021-02-01", - "The list of maintenance jobs that are inactive.", - "Takes effect immediately, but any currently running jobs will run until completion."); - public static final UnboundDoubleFlag DEFAULT_TERM_WISE_LIMIT = defineDoubleFlag( "default-term-wise-limit", 1.0, List.of("baldersheim"), "2020-12-02", "2021-02-01", @@ -121,13 +57,6 @@ public class Flags { "Takes effect at redeployment", ZONE_ID, APPLICATION_ID); - public static final UnboundStringFlag JVM_GC_OPTIONS = defineStringFlag( - "jvm-gc-options", "", - List.of("baldersheim"), "2020-12-02", "2021-02-01", - "Sets deafult jvm gc options", - "Takes effect at redeployment", - ZONE_ID, APPLICATION_ID); - public static final UnboundStringFlag FEED_SEQUENCER_TYPE = defineStringFlag( "feed-sequencer-type", "LATENCY", List.of("baldersheim"), "2020-12-02", "2021-02-01", @@ -205,13 +134,6 @@ public class Flags { "Takes effect on next host-admin tick.", HOSTNAME); - public static final UnboundStringFlag ZOOKEEPER_SERVER_VERSION = defineStringFlag( - "zookeeper-server-version", "3.5.6", - List.of("hmusum"), "2020-12-02", "2021-02-01", - "ZooKeeper server version, a jar file zookeeper-server-<ZOOKEEPER_SERVER_VERSION>-jar-with-dependencies.jar must exist", - "Takes effect on restart of Docker container", - NODE_TYPE, APPLICATION_ID, HOSTNAME); - public static final UnboundStringFlag TLS_FOR_ZOOKEEPER_CLIENT_SERVER_COMMUNICATION = defineStringFlag( "tls-for-zookeeper-client-server-communication", "OFF", List.of("hmusum"), "2020-12-02", "2021-02-01", @@ -277,14 +199,6 @@ public class Flags { "Takes effect immediately on new hosts, on next redeploy for applications", APPLICATION_ID); - public static final UnboundBooleanFlag ENABLE_PUBLIC_SIGNUP_FLOW = defineFeatureFlag( - "enable-public-signup-flow", false, - List.of("andreer"), "2020-12-02", "2021-02-01", - "Show the public signup flow for a user in the console", - "takes effect on browser reload of api/user/v1/user", - CONSOLE_USER_EMAIL - ); - public static final UnboundBooleanFlag CONTROLLER_PROVISION_LB = defineFeatureFlag( "controller-provision-lb", false, List.of("mpolden"), "2020-12-02", "2021-02-01", @@ -301,14 +215,6 @@ public class Flags { APPLICATION_ID ); - public static final UnboundIntFlag TENANT_BUDGET_QUOTA = defineIntFlag( - "tenant-budget-quota", -1, - List.of("ogronnesby"), "2020-12-02", "2021-02-01", - "The budget in cents/hr a tenant is allowed spend per instance, as calculated by NodeResources", - "Only takes effect on next deployment, if set to a value other than the default for flag!", - TENANT_ID - ); - public static final UnboundBooleanFlag ONLY_PUBLIC_ACCESS = defineFeatureFlag( "enable-public-only", false, List.of("ogronnesby"), "2020-12-02", "2021-02-01", @@ -316,20 +222,6 @@ public class Flags { "Takes effect on next tick" ); - public static final UnboundListFlag<String> OUTBOUND_BLOCKED_IPV4 = defineListFlag( - "container-outbound-blocked-ipv4", List.of(), String.class, - List.of("ogronnesby"), "2020-12-02", "2021-02-01", - "List of IPs or CIDRs that are blocked for outbound connections", - "Takes effect on next tick" - ); - - public static final UnboundListFlag<String> OUTBOUND_BLOCKED_IPV6 = defineListFlag( - "container-outbound-blocked-ipv6", List.of(), String.class, - List.of("ogronnesby"), "2020-12-02", "2021-02-01", - "List of IPs or CIDRs that are blocked for outbound connections", - "Takes effect on next tick" - ); - public static final UnboundBooleanFlag HIDE_SHARED_ROUTING_ENDPOINT = defineFeatureFlag( "hide-shared-routing-endpoint", false, List.of("tokle"), "2020-12-02", "2021-02-01", @@ -338,13 +230,6 @@ public class Flags { APPLICATION_ID ); - public static final UnboundBooleanFlag SKIP_MAINTENANCE_DEPLOYMENT = defineFeatureFlag( - "node-repository-skip-maintenance-deployment", false, - List.of("hmusum"), "2020-12-02", "2021-02-01", - "Whether PeriodicApplicationMaintainer should skip deployment for an application", - "Takes effect at next run of maintainer", - APPLICATION_ID); - public static final UnboundBooleanFlag USE_ACCESS_CONTROL_CLIENT_AUTHENTICATION = defineFeatureFlag( "use-access-control-client-authentication", false, List.of("tokle"), "2020-12-02", "2021-02-01", diff --git a/flags/src/main/java/com/yahoo/vespa/flags/PermanentFlags.java b/flags/src/main/java/com/yahoo/vespa/flags/PermanentFlags.java index 70f732d5e53..a3e2a11a79c 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/PermanentFlags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/PermanentFlags.java @@ -1,12 +1,22 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.flags; +import com.yahoo.vespa.flags.custom.ClusterCapacity; +import com.yahoo.vespa.flags.custom.SharedHost; + import java.time.Instant; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.List; +import static com.yahoo.vespa.flags.FetchVector.Dimension.APPLICATION_ID; +import static com.yahoo.vespa.flags.FetchVector.Dimension.CONSOLE_USER_EMAIL; +import static com.yahoo.vespa.flags.FetchVector.Dimension.HOSTNAME; +import static com.yahoo.vespa.flags.FetchVector.Dimension.NODE_TYPE; +import static com.yahoo.vespa.flags.FetchVector.Dimension.TENANT_ID; +import static com.yahoo.vespa.flags.FetchVector.Dimension.ZONE_ID; + /** * Definition for permanent feature flags * @@ -16,7 +26,110 @@ public class PermanentFlags { static final List<String> OWNERS = List.of(); static final Instant CREATED_AT = Instant.EPOCH; - static final Instant EXPIRES_AT = Instant.MAX; + static final Instant EXPIRES_AT = ZonedDateTime.of(2100, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC).toInstant(); + + public static final UnboundBooleanFlag USE_ALTERNATIVE_ENDPOINT_CERTIFICATE_PROVIDER = defineFeatureFlag( + "use-alternative-endpoint-certificate-provider", false, + "Whether to use an alternative CA when provisioning new certificates", + "Takes effect only on initial application deployment - not on later certificate refreshes!"); + + public static final UnboundStringFlag JVM_GC_OPTIONS = defineStringFlag( + "jvm-gc-options", "", + "Sets deafult jvm gc options", + "Takes effect at redeployment", + ZONE_ID, APPLICATION_ID); + + public static final UnboundStringFlag DOCKER_VERSION = defineStringFlag( + "docker-version", "1.13.1-102.git7f2769b", + "The version of the docker to use of the format VERSION-REL: The YUM package to be installed will be " + + "2:docker-VERSION-REL.el7.centos.x86_64 in AWS (and without '.centos' otherwise). " + + "If docker-version is not of this format, it must be parseable by YumPackageName::fromString.", + "Takes effect on next tick.", + HOSTNAME); + + public static final UnboundBooleanFlag FLEET_CANARY = defineFeatureFlag( + "fleet-canary", false, + "Whether the host is a fleet canary.", + "Takes effect on next host admin tick.", + HOSTNAME); + + public static final UnboundListFlag<ClusterCapacity> PREPROVISION_CAPACITY = defineListFlag( + "preprovision-capacity", List.of(), ClusterCapacity.class, + "Specifies the resources that ought to be immediately available for additional cluster " + + "allocations. If the resources are not available, additional hosts will be provisioned. " + + "Only applies to dynamically provisioned zones.", + "Takes effect on next iteration of DynamicProvisioningMaintainer."); + + public static final UnboundIntFlag REBOOT_INTERVAL_IN_DAYS = defineIntFlag( + "reboot-interval-in-days", 30, + "No reboots are scheduled 0x-1x reboot intervals after the previous reboot, while reboot is " + + "scheduled evenly distributed in the 1x-2x range (and naturally guaranteed at the 2x boundary).", + "Takes effect on next run of NodeRebooter"); + + public static final UnboundJacksonFlag<SharedHost> SHARED_HOST = defineJacksonFlag( + "shared-host", SharedHost.createDisabled(), SharedHost.class, + "Specifies whether shared hosts can be provisioned, and if so, the advertised " + + "node resources of the host, the maximum number of containers, etc.", + "Takes effect on next iteration of DynamicProvisioningMaintainer."); + + public static final UnboundBooleanFlag SKIP_MAINTENANCE_DEPLOYMENT = defineFeatureFlag( + "node-repository-skip-maintenance-deployment", false, + "Whether PeriodicApplicationMaintainer should skip deployment for an application", + "Takes effect at next run of maintainer", + APPLICATION_ID); + + public static final UnboundListFlag<String> INACTIVE_MAINTENANCE_JOBS = defineListFlag( + "inactive-maintenance-jobs", List.of(), String.class, + "The list of maintenance jobs that are inactive.", + "Takes effect immediately, but any currently running jobs will run until completion."); + + public static final UnboundListFlag<String> OUTBOUND_BLOCKED_IPV4 = defineListFlag( + "container-outbound-blocked-ipv4", List.of(), String.class, + "List of IPs or CIDRs that are blocked for outbound connections", + "Takes effect on next tick"); + + public static final UnboundListFlag<String> OUTBOUND_BLOCKED_IPV6 = defineListFlag( + "container-outbound-blocked-ipv6", List.of(), String.class, + "List of IPs or CIDRs that are blocked for outbound connections", + "Takes effect on next tick"); + + public static final UnboundIntFlag TENANT_BUDGET_QUOTA = defineIntFlag( + "tenant-budget-quota", -1, + "The budget in cents/hr a tenant is allowed spend per instance, as calculated by NodeResources", + "Only takes effect on next deployment, if set to a value other than the default for flag!", + TENANT_ID); + + public static final UnboundDoubleFlag CONTAINER_CPU_CAP = defineDoubleFlag( + "container-cpu-cap", 0, + "Hard limit on how many CPUs a container may use. This value is multiplied by CPU allocated to node, so " + + "to cap CPU at 200%, set this to 2, etc.", + "Takes effect on next node agent tick. Change is orchestrated, but does NOT require container restart", + HOSTNAME, APPLICATION_ID); + + public static final UnboundListFlag<String> DISABLED_HOST_ADMIN_TASKS = defineListFlag( + "disabled-host-admin-tasks", List.of(), String.class, + "List of host-admin task names (as they appear in the log, e.g. root>main>UpgradeTask), or some node-agent " + + "functionality (see NodeAgentTask), that should be skipped", + "Takes effect on next host admin tick", + HOSTNAME, NODE_TYPE); + + public static final UnboundStringFlag DOCKER_IMAGE_REPO = defineStringFlag( + "docker-image-repo", "", + "Override default docker image repo. Docker image version will be Vespa version.", + "Takes effect on next deployment from controller", + ZONE_ID, APPLICATION_ID); + + public static final UnboundStringFlag ZOOKEEPER_SERVER_VERSION = defineStringFlag( + "zookeeper-server-version", "3.5.6", + "ZooKeeper server version, a jar file zookeeper-server-<ZOOKEEPER_SERVER_VERSION>-jar-with-dependencies.jar must exist", + "Takes effect on restart of Docker container", + NODE_TYPE, APPLICATION_ID, HOSTNAME); + + public static final UnboundBooleanFlag ENABLE_PUBLIC_SIGNUP_FLOW = defineFeatureFlag( + "enable-public-signup-flow", false, + "Show the public signup flow for a user in the console", + "takes effect on browser reload of api/user/v1/user", + CONSOLE_USER_EMAIL); private PermanentFlags() {} diff --git a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java index ab9127ebfe4..c952161cf72 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java @@ -7,13 +7,13 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.PermanentFlags; import java.util.List; import java.util.Objects; /** - * Defines properties related to shared hosts, see {@link Flags#SHARED_HOST}. + * Defines properties related to shared hosts, see {@link PermanentFlags#SHARED_HOST}. * * @author hakon */ diff --git a/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java b/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java index 8882a15e526..48ed318af41 100644 --- a/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java +++ b/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java @@ -4,8 +4,6 @@ package com.yahoo.vespa.flags; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.node.BooleanNode; -import com.yahoo.vespa.flags.custom.HostResources; -import com.yahoo.vespa.flags.custom.SharedHost; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -109,17 +107,7 @@ public class FlagsTest { List.of(instance)); } - @Test - public void testSharedHostFlag() { - SharedHost sharedHost = new SharedHost(List.of(new HostResources( - 4.0, 16.0, 50.0, 0.3, - "fast", "local", - 10)), - null); - testGeneric(Flags.SHARED_HOST, sharedHost); - } - - private <T> void testGeneric(UnboundFlag<T, ?, ?> unboundFlag, T value) { + static <T> void testGeneric(UnboundFlag<T, ?, ?> unboundFlag, T value) { FlagSource source = mock(FlagSource.class); Flag<T, ?> flag = unboundFlag.bindTo(source); diff --git a/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java b/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java new file mode 100644 index 00000000000..3f43682cfb9 --- /dev/null +++ b/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java @@ -0,0 +1,25 @@ +package com.yahoo.vespa.flags;// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +import com.yahoo.vespa.flags.custom.HostResources; +import com.yahoo.vespa.flags.custom.SharedHost; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static com.yahoo.vespa.flags.FlagsTest.testGeneric; + +/** + * @author bjorncs + */ +class PermanentFlagsTest { + @Test + public void testSharedHostFlag() { + SharedHost sharedHost = new SharedHost(List.of(new HostResources( + 4.0, 16.0, 50.0, 0.3, + "fast", "local", + 10)), + null); + testGeneric(PermanentFlags.SHARED_HOST, sharedHost); + } + +}
\ No newline at end of file diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java index 6e4d090f830..1ff8c41ade8 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java @@ -9,8 +9,8 @@ import com.yahoo.vespa.athenz.api.AthenzIdentity; import com.yahoo.vespa.athenz.api.AthenzService; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.Acl; import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeSpec; @@ -69,7 +69,7 @@ public class NodeAgentContextImpl implements NodeAgentContext { this.vespaUserOnHost = vespaUserOnHost; this.cpuSpeedup = cpuSpeedup; this.disabledNodeAgentTasks = NodeAgentTask.fromString( - Flags.DISABLED_HOST_ADMIN_TASKS.bindTo(flagSource).with(FetchVector.Dimension.HOSTNAME, node.hostname()).value()); + PermanentFlags.DISABLED_HOST_ADMIN_TASKS.bindTo(flagSource).with(FetchVector.Dimension.HOSTNAME, node.hostname()).value()); } @Override diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index 95dfad4c6d7..ae118e6d541 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -8,7 +8,7 @@ import com.yahoo.config.provision.zone.ZoneApi; import com.yahoo.vespa.flags.DoubleFlag; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.dockerapi.Container; import com.yahoo.vespa.hosted.dockerapi.ContainerResources; import com.yahoo.vespa.hosted.dockerapi.RegistryCredentials; @@ -126,7 +126,7 @@ public class NodeAgentImpl implements NodeAgent { this.healthChecker = healthChecker; this.clock = clock; this.warmUpDuration = warmUpDuration; - this.containerCpuCap = Flags.CONTAINER_CPU_CAP.bindTo(flagSource); + this.containerCpuCap = PermanentFlags.CONTAINER_CPU_CAP.bindTo(flagSource); } @Override diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java index a37a0bad125..680d197b77d 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java @@ -1,8 +1,8 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.admin.nodeagent; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.test.file.TestFileSystem; import org.junit.Test; @@ -88,7 +88,7 @@ public class NodeAgentContextImplTest { private static NodeAgentContext createContextWithDisabledTasks(String... tasks) { InMemoryFlagSource flagSource = new InMemoryFlagSource(); - flagSource.withListFlag(Flags.DISABLED_HOST_ADMIN_TASKS.id(), List.of(tasks), String.class); + flagSource.withListFlag(PermanentFlags.DISABLED_HOST_ADMIN_TASKS.id(), List.of(tasks), String.class); return new NodeAgentContextImpl.Builder("node123").flagSource(flagSource).build(); } } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java index 6a264466569..fd587da5d71 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java @@ -7,8 +7,8 @@ import com.yahoo.config.provision.DockerImage; import com.yahoo.config.provision.NodeResources; import com.yahoo.config.provision.NodeType; import com.yahoo.test.ManualClock; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.dockerapi.Container; import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.dockerapi.ContainerResources; @@ -238,7 +238,7 @@ public class NodeAgentImplTest { inOrder.verify(orchestrator, never()).resume(any()); // Set the feature flag - flagSource.withDoubleFlag(Flags.CONTAINER_CPU_CAP.id(), 2.3); + flagSource.withDoubleFlag(PermanentFlags.CONTAINER_CPU_CAP.id(), 2.3); nodeAgent.doConverge(thirdContext); inOrder.verify(containerOperations).updateContainer(eq(thirdContext), eq(ContainerResources.from(9.2, 4, 16))); diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainer.java index 119f0a69551..e271d5dcd11 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainer.java @@ -13,9 +13,9 @@ import com.yahoo.jdisc.Metric; import com.yahoo.lang.MutableInteger; import com.yahoo.transaction.Mutex; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.JacksonFlag; import com.yahoo.vespa.flags.ListFlag; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.flags.custom.ClusterCapacity; import com.yahoo.vespa.flags.custom.SharedHost; import com.yahoo.vespa.hosted.provision.LockedNodeList; @@ -70,8 +70,8 @@ public class DynamicProvisioningMaintainer extends NodeRepositoryMaintainer { Metric metric) { super(nodeRepository, interval, metric); this.hostProvisioner = hostProvisioner; - this.preprovisionCapacityFlag = Flags.PREPROVISION_CAPACITY.bindTo(flagSource); - this.sharedHostFlag = Flags.SHARED_HOST.bindTo(flagSource); + this.preprovisionCapacityFlag = PermanentFlags.PREPROVISION_CAPACITY.bindTo(flagSource); + this.sharedHostFlag = PermanentFlags.SHARED_HOST.bindTo(flagSource); } @Override diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooter.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooter.java index 214872348a3..96d10415e63 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooter.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooter.java @@ -3,8 +3,8 @@ package com.yahoo.vespa.hosted.provision.maintenance; import com.yahoo.jdisc.Metric; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.IntFlag; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeRepository; import com.yahoo.vespa.hosted.provision.node.History; @@ -32,7 +32,7 @@ public class NodeRebooter extends NodeRepositoryMaintainer { NodeRebooter(NodeRepository nodeRepository, FlagSource flagSource, Metric metric) { super(nodeRepository, Duration.ofMinutes(25), metric); - this.rebootIntervalInDays = Flags.REBOOT_INTERVAL_IN_DAYS.bindTo(flagSource); + this.rebootIntervalInDays = PermanentFlags.REBOOT_INTERVAL_IN_DAYS.bindTo(flagSource); this.random = new Random(nodeRepository.clock().millis()); // seed with clock for test determinism } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java index 289d5a6742a..d20b06becaf 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java @@ -7,7 +7,7 @@ import com.yahoo.jdisc.Metric; import com.yahoo.vespa.flags.BooleanFlag; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeRepository; @@ -70,7 +70,7 @@ public class PeriodicApplicationMaintainer extends ApplicationMaintainer { } private boolean shouldMaintain(ApplicationId id) { - BooleanFlag skipMaintenanceDeployment = Flags.SKIP_MAINTENANCE_DEPLOYMENT.bindTo(flagSource) + BooleanFlag skipMaintenanceDeployment = PermanentFlags.SKIP_MAINTENANCE_DEPLOYMENT.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, id.serializedForm()); return ! skipMaintenanceDeployment.value(); } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/JobControlFlags.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/JobControlFlags.java index 2a2a45186f9..79f4403e534 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/JobControlFlags.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/JobControlFlags.java @@ -3,8 +3,8 @@ package com.yahoo.vespa.hosted.provision.persistence; import com.yahoo.concurrent.maintenance.JobControlState; import com.yahoo.transaction.Mutex; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.ListFlag; +import com.yahoo.vespa.flags.PermanentFlags; import java.util.Set; @@ -20,7 +20,7 @@ public class JobControlFlags implements JobControlState { public JobControlFlags(CuratorDatabaseClient curator, FlagSource flagSource) { this.curator = curator; - this.inactiveJobsFlag = Flags.INACTIVE_MAINTENANCE_JOBS.bindTo(flagSource); + this.inactiveJobsFlag = PermanentFlags.INACTIVE_MAINTENANCE_JOBS.bindTo(flagSource); } @Override diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainerTest.java index cc23f29dde6..c67f6657c7f 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/DynamicProvisioningMaintainerTest.java @@ -15,8 +15,8 @@ import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.Zone; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.flags.custom.ClusterCapacity; import com.yahoo.vespa.flags.custom.SharedHost; import com.yahoo.vespa.hosted.provision.Node; @@ -105,7 +105,7 @@ public class DynamicProvisioningMaintainerTest { @Test public void does_not_deprovision_when_preprovisioning_enabled() { var tester = new DynamicProvisioningTester().addInitialNodes(); - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(1, 1, 3, 2, 1.0)), ClusterCapacity.class); + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(1, 1, 3, 2, 1.0)), ClusterCapacity.class); Optional<Node> failedHost = tester.nodeRepository.getNode("host2"); assertTrue(failedHost.isPresent()); @@ -117,7 +117,7 @@ public class DynamicProvisioningMaintainerTest { @Test public void provision_deficit_and_deprovision_excess() { var tester = new DynamicProvisioningTester().addInitialNodes(); - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(2, 48, 128, 1000, 10.0), new ClusterCapacity(1, 16, 24, 100, 1.0)), ClusterCapacity.class); @@ -149,7 +149,7 @@ public class DynamicProvisioningMaintainerTest { // Makes provisioned hosts 48-128-1000-10 tester.hostProvisioner.provisionSharedHost("host4"); - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(2, 1, 30, 20, 3.0)), ClusterCapacity.class); @@ -171,7 +171,7 @@ public class DynamicProvisioningMaintainerTest { // Add a second cluster equal to the first. It should fit on existing host3 and hostname100. - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(2, 1, 30, 20, 3.0), new ClusterCapacity(2, 1, 30, 20, 3.0)), ClusterCapacity.class); @@ -185,7 +185,7 @@ public class DynamicProvisioningMaintainerTest { // in this test, due to skew), so host3 will be deprovisioned when hostname101 is provisioned. // host3 is a 24-64-100-10 while hostname100 is 48-128-1000-10. - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(2, 1, 30, 20, 3.0), new ClusterCapacity(2, 24, 64, 100, 1.0)), ClusterCapacity.class); @@ -201,7 +201,7 @@ public class DynamicProvisioningMaintainerTest { // If the preprovision capacity is reduced, we should see shared hosts deprovisioned. - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(1, 1, 30, 20, 3.0)), ClusterCapacity.class); @@ -264,7 +264,7 @@ public class DynamicProvisioningMaintainerTest { var tester = new DynamicProvisioningTester().addInitialNodes(); tester.hostProvisioner.provisionSharedHost("host4"); - tester.flagSource.withJacksonFlag(Flags.SHARED_HOST.id(), new SharedHost(null, minCount), SharedHost.class); + tester.flagSource.withJacksonFlag(PermanentFlags.SHARED_HOST.id(), new SharedHost(null, minCount), SharedHost.class); tester.maintainer.maintain(); assertEquals(provisionCount, tester.hostProvisioner.provisionedHosts.size()); assertEquals(deprovisionCount, tester.hostProvisioner.deprovisionedHosts); @@ -289,7 +289,7 @@ public class DynamicProvisioningMaintainerTest { public void test_minimum_capacity() { var tester = new DynamicProvisioningTester(); NodeResources resources1 = new NodeResources(24, 64, 100, 10); - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(2, resources1.vcpu(), resources1.memoryGb(), resources1.diskGb(), resources1.bandwidthGbps())), ClusterCapacity.class); tester.maintainer.maintain(); @@ -309,7 +309,7 @@ public class DynamicProvisioningMaintainerTest { tester.assertNodesUnchanged(); // Must be able to allocate 2 nodes with "no resource requirement" - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(2, 0, 0, 0, 0.0)), ClusterCapacity.class); @@ -330,11 +330,11 @@ public class DynamicProvisioningMaintainerTest { tester.assertNodesUnchanged(); // Clearing flag does nothing - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), List.of(), ClusterCapacity.class); + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(), ClusterCapacity.class); tester.assertNodesUnchanged(); // Increasing the capacity provisions additional hosts - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(3, 0, 0, 0, 0.0)), ClusterCapacity.class); assertEquals(0, tester.provisionedHostsMatching(sharedHostNodeResources)); @@ -347,7 +347,7 @@ public class DynamicProvisioningMaintainerTest { tester.assertNodesUnchanged(); // Requiring >0 capacity does nothing as long as it fits on the 3 hosts - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(3, resources1.vcpu() - applicationNodeResources.vcpu(), resources1.memoryGb() - applicationNodeResources.memoryGb(), @@ -357,7 +357,7 @@ public class DynamicProvisioningMaintainerTest { tester.assertNodesUnchanged(); // But requiring a bit more in the cluster => provisioning of 2 shared hosts. - tester.flagSource.withListFlag(Flags.PREPROVISION_CAPACITY.id(), + tester.flagSource.withListFlag(PermanentFlags.PREPROVISION_CAPACITY.id(), List.of(new ClusterCapacity(3, resources1.vcpu() - applicationNodeResources.vcpu() + 1, resources1.memoryGb() - applicationNodeResources.memoryGb() + 1, diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooterTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooterTest.java index 36d088a59df..2abe5ed7ebf 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooterTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeRebooterTest.java @@ -5,8 +5,8 @@ import com.yahoo.component.Version; import com.yahoo.config.provision.NodeResources; import com.yahoo.config.provision.NodeType; import com.yahoo.vespa.curator.mock.MockCurator; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; +import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeRepository; import com.yahoo.vespa.hosted.provision.provisioning.ProvisioningTester; @@ -142,7 +142,7 @@ public class NodeRebooterTest { } private static ProvisioningTester createTester(Duration rebootInterval, InMemoryFlagSource flagSource) { - flagSource = flagSource.withIntFlag(Flags.REBOOT_INTERVAL_IN_DAYS.id(), (int) rebootInterval.toDays()); + flagSource = flagSource.withIntFlag(PermanentFlags.REBOOT_INTERVAL_IN_DAYS.id(), (int) rebootInterval.toDays()); ProvisioningTester tester = new ProvisioningTester.Builder().flagSource(flagSource).build(); tester.clock().setInstant(Instant.ofEpochMilli(1605522619000L)); // Use a fixed random seed ((MockCurator) tester.getCurator()).setZooKeeperEnsembleConnectionSpec("zk1.host:1,zk2.host:2,zk3.host:3"); |