Merge remote-tracking branch 'apache/4.18' into 4.19

This commit is contained in:
Abhishek Kumar 2024-02-26 12:01:26 +05:30
commit 2a56c61ade
3 changed files with 18 additions and 14 deletions

View File

@ -221,6 +221,10 @@ write_files:
fi
kubeadm join {{ k8s_control_node.join_ip }}:6443 --token {{ k8s_control_node.cluster.token }} --control-plane --certificate-key {{ k8s_control_node.cluster.ha.certificate.key }} --discovery-token-unsafe-skip-ca-verification
mkdir -p /root/.kube
cp -i /etc/kubernetes/admin.conf /root/.kube/config
chown $(id -u):$(id -g) /root/.kube/config
sudo touch /home/cloud/success
echo "true" > /home/cloud/success

View File

@ -1587,7 +1587,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
private SetMonitorServiceCommand createMonitorServiceCommand(DomainRouterVO router, List<MonitorServiceTO> services,
boolean reconfigure, boolean deleteFromProcessedCache) {
boolean reconfigure, boolean deleteFromProcessedCache, Map<String, String> routerHealthCheckConfig) {
final SetMonitorServiceCommand command = new SetMonitorServiceCommand(services);
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
@ -1605,7 +1605,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
command.setAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_EXCLUDED, excludedTests);
command.setHealthChecksConfig(getRouterHealthChecksConfig(router));
command.setHealthChecksConfig(routerHealthCheckConfig);
command.setReconfigureAfterUpdate(reconfigure);
command.setDeleteFromProcessedCache(deleteFromProcessedCache); // As part of updating
return command;
@ -1630,7 +1630,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
s_logger.info("Updating data for router health checks for router " + router.getUuid());
Answer origAnswer = null;
try {
SetMonitorServiceCommand command = createMonitorServiceCommand(router, null, true, true);
SetMonitorServiceCommand command = createMonitorServiceCommand(router, null, true, true, getRouterHealthChecksConfig(router));
origAnswer = _agentMgr.easySend(router.getHostId(), command);
} catch (final Exception e) {
s_logger.error("Error while sending update data for health check to router: " + router.getInstanceName(), e);
@ -1745,7 +1745,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
}
private Map<String, String> getRouterHealthChecksConfig(final DomainRouterVO router) {
protected Map<String, String> getRouterHealthChecksConfig(final DomainRouterVO router) {
Map<String, String> data = new HashMap<>();
List<DomainRouterJoinVO> routerJoinVOs = domainRouterJoinDao.searchByIds(router.getId());
StringBuilder vmsData = new StringBuilder();
@ -1759,16 +1759,14 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
SearchBuilder<UserVmJoinVO> sbvm = userVmJoinDao.createSearchBuilder();
sbvm.and("networkId", sbvm.entity().getNetworkId(), SearchCriteria.Op.EQ);
sbvm.and("state", sbvm.entity().getState(), SearchCriteria.Op.EQ);
SearchCriteria<UserVmJoinVO> scvm = sbvm.create();
scvm.setParameters("networkId", routerJoinVO.getNetworkId());
scvm.setParameters("state", VirtualMachine.State.Running);
List<UserVmJoinVO> vms = userVmJoinDao.search(scvm, null);
boolean isDhcpSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dhcp);
boolean isDnsSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dns);
for (UserVmJoinVO vm : vms) {
if (vm.getState() != VirtualMachine.State.Running) {
continue;
}
vmsData.append("vmName=").append(vm.getName())
.append(",macAddress=").append(vm.getMacAddress())
.append(",ip=").append(vm.getIpAddress())
@ -2310,6 +2308,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
final Provider provider = getVrProvider(router);
final List<Long> routerGuestNtwkIds = _routerDao.getRouterNetworks(router.getId());
Map <String, String> routerHealthChecksConfig = getRouterHealthChecksConfig(router);
for (final Long guestNetworkId : routerGuestNtwkIds) {
final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, router.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(
guestNetworkId, router.getId()));
@ -2318,7 +2317,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
if (reprogramGuestNtwks) {
finalizeIpAssocForNetwork(cmds, router, provider, guestNetworkId, null);
finalizeNetworkRulesForNetwork(cmds, router, provider, guestNetworkId);
finalizeMonitorService(cmds, profile, router, provider, guestNetworkId, true);
finalizeMonitorService(cmds, profile, router, provider, guestNetworkId, true, routerHealthChecksConfig);
}
finalizeUserDataAndDhcpOnStart(cmds, router, provider, guestNetworkId);
@ -2332,7 +2331,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
protected void finalizeMonitorService(final Commands cmds, final VirtualMachineProfile profile, final DomainRouterVO router, final Provider provider,
final long networkId, boolean onStart) {
final long networkId, boolean onStart, Map<String, String> routerHealthCheckConfig) {
final NetworkOffering offering = _networkOfferingDao.findById(_networkDao.findById(networkId).getNetworkOfferingId());
if (offering.isRedundantRouter()) {
// service monitoring is currently not added in RVR
@ -2382,7 +2381,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
// As part of aggregate command we don't need to reconfigure if onStart and persist in processed cache. Subsequent updates are not needed.
SetMonitorServiceCommand command = createMonitorServiceCommand(router, servicesTO, !onStart, false);
SetMonitorServiceCommand command = createMonitorServiceCommand(router, servicesTO, !onStart, false, routerHealthCheckConfig);
command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(networkId, router.getId()));
if (!isMonitoringServicesEnabled) {
command.setAccessDetail(SetMonitorServiceCommand.ROUTER_MONITORING_ENABLED, isMonitoringServicesEnabled.toString());

View File

@ -499,8 +499,9 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
throw new CloudRuntimeException("Cannot find related provider of virtual router provider: " + vrProvider.getType().toString());
}
Map<String, String> routerHealthCheckConfig = getRouterHealthChecksConfig(domainRouterVO);
if (reprogramGuestNtwks && publicNics.size() > 0) {
finalizeMonitorService(cmds, profile, domainRouterVO, provider, publicNics.get(0).second().getId(), true);
finalizeMonitorService(cmds, profile, domainRouterVO, provider, publicNics.get(0).second().getId(), true, routerHealthCheckConfig);
}
for (final Pair<Nic, Network> nicNtwk : guestNics) {
@ -512,7 +513,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
if (reprogramGuestNtwks) {
finalizeIpAssocForNetwork(cmds, domainRouterVO, provider, guestNetworkId, vlanMacAddress);
finalizeNetworkRulesForNetwork(cmds, domainRouterVO, provider, guestNetworkId);
finalizeMonitorService(cmds, profile, domainRouterVO, provider, guestNetworkId, true);
finalizeMonitorService(cmds, profile, domainRouterVO, provider, guestNetworkId, true, routerHealthCheckConfig);
}
finalizeUserDataAndDhcpOnStart(cmds, domainRouterVO, provider, guestNetworkId);
@ -571,7 +572,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
finalizeNetworkRulesForNetwork(cmds, router, provider, networkId);
}
finalizeMonitorService(cmds, getVirtualMachineProfile(router), router, provider, networkId, false);
finalizeMonitorService(cmds, getVirtualMachineProfile(router), router, provider, networkId, false, getRouterHealthChecksConfig(router));
return _nwHelper.sendCommandsToRouter(router, cmds);
}