blob: 19ea3232667955fd9917e5deb1db29a39c6d7158 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.tenant.Tenant;
import java.time.Duration;
public class TenantRoleMaintainer extends ControllerMaintainer {
public TenantRoleMaintainer(Controller controller, Duration tenantRoleMaintainer) {
super(controller, tenantRoleMaintainer);
}
@Override
protected double maintain() {
var roleService = controller().serviceRegistry().roleService();
var tenants = controller().tenants().asList();
// Create separate athenz service for all tenants
tenants.forEach(roleService::createTenantRole);
var tenantsWithRoles = tenants.stream()
.map(Tenant::name)
.toList();
roleService.maintainRoles(tenantsWithRoles);
return 1.0;
}
}
|