use of org.onosproject.k8snode.api.K8sNodeAdminService in project onos by opennetworkinglab.
the class K8sSyncRulesCommand method doExecute.
@Override
protected void doExecute() {
K8sNodeAdminService adminService = get(K8sNodeAdminService.class);
if (adminService == null) {
error("Failed to re-install flow rules for kubernetes networking.");
return;
}
adminService.completeNodes().forEach(node -> syncRulesBaseForNode(adminService, node));
print("Successfully requested re-installing flow rules.");
}
use of org.onosproject.k8snode.api.K8sNodeAdminService in project onos by opennetworkinglab.
the class K8sNodeInitCommand method doExecute.
@Override
protected void doExecute() {
K8sNodeService nodeService = get(K8sNodeService.class);
K8sNodeAdminService nodeAdminService = get(K8sNodeAdminService.class);
if ((!isAll && !isIncomplete && hostnames == null) || (isAll && isIncomplete) || (isIncomplete && hostnames != null) || (hostnames != null && isAll)) {
print("Please specify one of hostname, --all, and --incomplete options.");
return;
}
if (isAll) {
hostnames = nodeService.nodes().stream().map(K8sNode::hostname).toArray(String[]::new);
} else if (isIncomplete) {
hostnames = nodeService.nodes().stream().filter(node -> node.state() != COMPLETE).map(K8sNode::hostname).toArray(String[]::new);
}
for (String hostname : hostnames) {
K8sNode node = nodeService.node(hostname);
if (node == null) {
print("Unable to find %s", hostname);
continue;
}
print("Initializing %s", hostname);
K8sNode updated = node.updateState(INIT);
nodeAdminService.updateNode(updated);
}
print("Done.");
}
Aggregations