Search in sources :

Example 1 with RotationLock

use of com.yahoo.vespa.hosted.controller.rotation.RotationLock in project vespa by vespa-engine.

the class DnsMaintainer method maintain.

@Override
protected void maintain() {
    try (RotationLock lock = rotationRepository().lock()) {
        Map<RotationId, Rotation> unassignedRotations = rotationRepository().availableRotations(lock);
        unassignedRotations.values().forEach(this::removeDnsAlias);
    }
}
Also used : RotationLock(com.yahoo.vespa.hosted.controller.rotation.RotationLock) RotationId(com.yahoo.vespa.hosted.controller.rotation.RotationId) ApplicationRotation(com.yahoo.vespa.hosted.controller.application.ApplicationRotation) Rotation(com.yahoo.vespa.hosted.controller.rotation.Rotation)

Example 2 with RotationLock

use of com.yahoo.vespa.hosted.controller.rotation.RotationLock in project vespa by vespa-engine.

the class ApplicationController method withRotation.

/**
 * Makes sure the application has a global rotation, if eligible.
 */
private LockedApplication withRotation(LockedApplication application, ZoneId zone) {
    if (zone.environment() == Environment.prod && application.deploymentSpec().globalServiceId().isPresent()) {
        try (RotationLock rotationLock = rotationRepository.lock()) {
            Rotation rotation = rotationRepository.getRotation(application, rotationLock);
            application = application.with(rotation.id());
            // store assigned rotation even if deployment fails
            store(application);
            registerRotationInDns(rotation, application.rotation().get().dnsName());
            registerRotationInDns(rotation, application.rotation().get().secureDnsName());
        }
    }
    return application;
}
Also used : RotationLock(com.yahoo.vespa.hosted.controller.rotation.RotationLock) Rotation(com.yahoo.vespa.hosted.controller.rotation.Rotation)

Example 3 with RotationLock

use of com.yahoo.vespa.hosted.controller.rotation.RotationLock in project vespa by vespa-engine.

the class MetricsReporter method reportRemainingRotations.

private void reportRemainingRotations() {
    try (RotationLock lock = controller().applications().rotationRepository().lock()) {
        int availableRotations = controller().applications().rotationRepository().availableRotations(lock).size();
        metric.set(remainingRotations, availableRotations, metric.createContext(Collections.emptyMap()));
    }
}
Also used : RotationLock(com.yahoo.vespa.hosted.controller.rotation.RotationLock)

Aggregations

RotationLock (com.yahoo.vespa.hosted.controller.rotation.RotationLock)3 Rotation (com.yahoo.vespa.hosted.controller.rotation.Rotation)2 ApplicationRotation (com.yahoo.vespa.hosted.controller.application.ApplicationRotation)1 RotationId (com.yahoo.vespa.hosted.controller.rotation.RotationId)1