Search in sources :

Example 1 with VersionStatus

use of com.yahoo.vespa.hosted.controller.versions.VersionStatus in project vespa by vespa-engine.

the class VersionStatusUpdaterTest method testVersionUpdating.

/**
 * Test that this job updates the status. Test of the content of the update is in VersionStatusTest
 */
@Test
public void testVersionUpdating() {
    ControllerTester tester = new ControllerTester();
    tester.controller().updateVersionStatus(new VersionStatus(Collections.emptyList()));
    assertFalse(tester.controller().versionStatus().systemVersion().isPresent());
    VersionStatusUpdater updater = new VersionStatusUpdater(tester.controller(), Duration.ofMinutes(3), new JobControl(new MockCuratorDb()));
    updater.maintain();
    assertTrue(tester.controller().versionStatus().systemVersion().isPresent());
}
Also used : MockCuratorDb(com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) Test(org.junit.Test)

Example 2 with VersionStatus

use of com.yahoo.vespa.hosted.controller.versions.VersionStatus in project vespa by vespa-engine.

the class VersionStatusSerializerTest method testSerialization.

@Test
public void testSerialization() {
    List<VespaVersion> vespaVersions = new ArrayList<>();
    DeploymentStatistics statistics = new DeploymentStatistics(Version.fromString("5.0"), Arrays.asList(ApplicationId.from("tenant1", "failing1", "default")), Arrays.asList(ApplicationId.from("tenant2", "success1", "default"), ApplicationId.from("tenant2", "success2", "default")), Arrays.asList(ApplicationId.from("tenant1", "failing1", "default"), ApplicationId.from("tenant2", "success2", "default")));
    vespaVersions.add(new VespaVersion(statistics, "dead", Instant.now(), false, Arrays.asList("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal));
    vespaVersions.add(new VespaVersion(statistics, "cafe", Instant.now(), true, Arrays.asList("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal));
    VersionStatus status = new VersionStatus(vespaVersions);
    VersionStatusSerializer serializer = new VersionStatusSerializer();
    VersionStatus deserialized = serializer.fromSlime(serializer.toSlime(status));
    assertEquals(status.versions().size(), deserialized.versions().size());
    for (int i = 0; i < status.versions().size(); i++) {
        VespaVersion a = status.versions().get(i);
        VespaVersion b = deserialized.versions().get(i);
        assertEquals(a.releaseCommit(), b.releaseCommit());
        assertEquals(a.committedAt(), b.committedAt());
        assertEquals(a.isCurrentSystemVersion(), b.isCurrentSystemVersion());
        assertEquals(a.statistics(), b.statistics());
        assertEquals(a.configServerHostnames(), b.configServerHostnames());
        assertEquals(a.confidence(), b.confidence());
    }
}
Also used : DeploymentStatistics(com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) ArrayList(java.util.ArrayList) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus) Test(org.junit.Test)

Example 3 with VersionStatus

use of com.yahoo.vespa.hosted.controller.versions.VersionStatus in project vespa by vespa-engine.

the class ControllerTest method incrementSystemVersion.

/**
 * Adds a new version, higher than the current system version, makes it the system version and returns it
 */
private Version incrementSystemVersion(Controller controller) {
    Version systemVersion = controller.versionStatus().systemVersion().get().versionNumber();
    Version newSystemVersion = new Version(systemVersion.getMajor(), systemVersion.getMinor() + 1, 0);
    VespaVersion newSystemVespaVersion = new VespaVersion(DeploymentStatistics.empty(newSystemVersion), "commit1", Instant.now(), true, Collections.emptyList(), VespaVersion.Confidence.low);
    List<VespaVersion> versions = new ArrayList<>(controller.versionStatus().versions());
    for (int i = 0; i < versions.size(); i++) {
        VespaVersion c = versions.get(i);
        if (c.isCurrentSystemVersion())
            versions.set(i, new VespaVersion(c.statistics(), c.releaseCommit(), c.committedAt(), false, c.configServerHostnames(), c.confidence()));
    }
    versions.add(newSystemVespaVersion);
    controller.updateVersionStatus(new VersionStatus(versions));
    return newSystemVersion;
}
Also used : ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) Version(com.yahoo.component.Version) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) ArrayList(java.util.ArrayList) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus)

Example 4 with VersionStatus

use of com.yahoo.vespa.hosted.controller.versions.VersionStatus in project vespa by vespa-engine.

the class VersionStatusUpdater method maintain.

@Override
protected void maintain() {
    try {
        VersionStatus newStatus = VersionStatus.compute(controller());
        controller().updateVersionStatus(newStatus);
    } catch (UncheckedIOException e) {
        log.warning("Failed to compute version status. This is likely a transient error: " + e.getMessage());
    }
}
Also used : UncheckedIOException(java.io.UncheckedIOException) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus)

Example 5 with VersionStatus

use of com.yahoo.vespa.hosted.controller.versions.VersionStatus in project vespa by vespa-engine.

the class Controller method updateVersionStatus.

/**
 * Replace the current version status by a new one
 */
public void updateVersionStatus(VersionStatus newStatus) {
    VersionStatus currentStatus = versionStatus();
    if (newStatus.systemVersion().isPresent() && !newStatus.systemVersion().equals(currentStatus.systemVersion())) {
        log.info("Changing system version from " + printableVersion(currentStatus.systemVersion()) + " to " + printableVersion(newStatus.systemVersion()));
    }
    curator.writeVersionStatus(newStatus);
    // Removes confidence overrides for versions that no longer exist in the system
    removeConfidenceOverride(version -> newStatus.versions().stream().noneMatch(vespaVersion -> vespaVersion.versionNumber().equals(version)));
}
Also used : AthenzClientFactory(com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory) ArtifactRepository(com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository) NodeRepositoryClientInterface(com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeRepositoryClientInterface) Organization(com.yahoo.vespa.hosted.controller.api.integration.organization.Organization) Version(com.yahoo.component.Version) EntityService(com.yahoo.vespa.hosted.controller.api.integration.entity.EntityService) PropertyId(com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId) Inject(com.google.inject.Inject) DeploymentId(com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId) Vtag(com.yahoo.component.Vtag) ConfigServerClient(com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerClient) GitHub(com.yahoo.vespa.hosted.controller.api.integration.github.GitHub) Chef(com.yahoo.vespa.hosted.controller.api.integration.chef.Chef) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) JsonNode(com.fasterxml.jackson.databind.JsonNode) RoutingGenerator(com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator) MetricsService(com.yahoo.vespa.hosted.controller.api.integration.MetricsService) AthenzDomain(com.yahoo.vespa.athenz.api.AthenzDomain) ControllerDb(com.yahoo.vespa.hosted.controller.persistence.ControllerDb) Predicate(java.util.function.Predicate) CuratorDb(com.yahoo.vespa.hosted.controller.persistence.CuratorDb) ZoneRegistry(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry) Logger(java.util.logging.Logger) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) Property(com.yahoo.vespa.hosted.controller.api.identifiers.Property) ApplicationView(com.yahoo.vespa.serviceview.bindings.ApplicationView) Objects(java.util.Objects) List(java.util.List) RotationStatus(com.yahoo.vespa.hosted.controller.api.integration.routing.RotationStatus) AbstractComponent(com.yahoo.component.AbstractComponent) SystemName(com.yahoo.config.provision.SystemName) Clock(java.time.Clock) Optional(java.util.Optional) NameService(com.yahoo.vespa.hosted.controller.api.integration.dns.NameService) RotationsConfig(com.yahoo.vespa.hosted.rotation.config.RotationsConfig) GlobalRoutingService(com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus)

Aggregations

VersionStatus (com.yahoo.vespa.hosted.controller.versions.VersionStatus)5 Version (com.yahoo.component.Version)3 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)3 SystemName (com.yahoo.config.provision.SystemName)2 DeploymentId (com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId)2 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Inject (com.google.inject.Inject)1 AbstractComponent (com.yahoo.component.AbstractComponent)1 Vtag (com.yahoo.component.Vtag)1 ValidationId (com.yahoo.config.application.api.ValidationId)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 ApplicationName (com.yahoo.config.provision.ApplicationName)1 Environment (com.yahoo.config.provision.Environment)1 InstanceName (com.yahoo.config.provision.InstanceName)1 RegionName (com.yahoo.config.provision.RegionName)1 TenantName (com.yahoo.config.provision.TenantName)1 AthenzDomain (com.yahoo.vespa.athenz.api.AthenzDomain)1