-
Notifications
You must be signed in to change notification settings - Fork 1.3k
NSX Integration fixes #8906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSX Integration fixes #8906
Changes from 9 commits
523620f
3579806
f228c7a
a899648
968235a
bcc8ff2
f44b8aa
e79d771
4e57cc9
0163da4
0903ba6
2726987
c393973
587f6fe
459c23b
89aa0a5
9733984
9c1df1d
7e0007b
d2c386c
0a31b13
70f70b2
665b698
738f934
66ee5da
09159af
d1a6038
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,8 @@ | |
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| import com.cloud.kubernetes.cluster.KubernetesClusterService; | ||
| import com.cloud.network.rules.FirewallManager; | ||
| import com.cloud.offering.NetworkOffering; | ||
| import com.cloud.offerings.dao.NetworkOfferingDao; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
|
|
@@ -136,6 +138,8 @@ public class KubernetesClusterResourceModifierActionWorker extends KubernetesClu | |
| @Inject | ||
| protected RulesService rulesService; | ||
| @Inject | ||
| protected FirewallManager firewallManager; | ||
| @Inject | ||
| protected PortForwardingRulesDao portForwardingRulesDao; | ||
| @Inject | ||
| protected ResourceManager resourceManager; | ||
|
|
@@ -171,6 +175,11 @@ private String getKubernetesNodeConfig(final String joinIp, final boolean ejectI | |
| final String joinIpKey = "{{ k8s_control_node.join_ip }}"; | ||
| final String clusterTokenKey = "{{ k8s_control_node.cluster.token }}"; | ||
| final String ejectIsoKey = "{{ k8s.eject.iso }}"; | ||
| final String installWaitTime = "{{ k8s.install.wait.time }}"; | ||
| final String installReattemptsCount = "{{ k8s.install.reattempts.count }}"; | ||
|
|
||
| final Long waitTime = KubernetesClusterService.KubernetesWorkerNodeInstallAttemptWait.value(); | ||
| final Long reattempts = KubernetesClusterService.KubernetesWorkerNodeInstallReattempts.value(); | ||
| String pubKey = "- \"" + configurationDao.getValue("ssh.publickey") + "\""; | ||
| String sshKeyPair = kubernetesCluster.getKeyPair(); | ||
| if (StringUtils.isNotEmpty(sshKeyPair)) { | ||
|
|
@@ -183,7 +192,8 @@ private String getKubernetesNodeConfig(final String joinIp, final boolean ejectI | |
| k8sNodeConfig = k8sNodeConfig.replace(joinIpKey, joinIp); | ||
| k8sNodeConfig = k8sNodeConfig.replace(clusterTokenKey, KubernetesClusterUtil.generateClusterToken(kubernetesCluster)); | ||
| k8sNodeConfig = k8sNodeConfig.replace(ejectIsoKey, String.valueOf(ejectIso)); | ||
|
|
||
| k8sNodeConfig = k8sNodeConfig.replace(installWaitTime, String.valueOf(waitTime)); | ||
| k8sNodeConfig = k8sNodeConfig.replace(installReattemptsCount, String.valueOf(reattempts)); | ||
| k8sNodeConfig = updateKubeConfigWithRegistryDetails(k8sNodeConfig); | ||
|
|
||
| return k8sNodeConfig; | ||
|
|
@@ -551,9 +561,12 @@ protected void removePortForwardingRules(final IpAddress publicIp, final Network | |
| for (PortForwardingRuleVO pfRule : pfRules) { | ||
| if (startPort <= pfRule.getSourcePortStart() && pfRule.getSourcePortStart() <= endPort) { | ||
| portForwardingRulesDao.remove(pfRule.getId()); | ||
| logger.trace("Marking PF rule " + pfRule + " with Revoke state"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this log message is a bit of a regression, does it really need to change?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, refactored |
||
| pfRule.setState(FirewallRule.State.Revoke); | ||
|
|
||
| } | ||
| } | ||
| rulesService.applyPortForwardingRules(publicIp.getId(), account); | ||
| firewallManager.applyRules(pfRules, false, true); | ||
| } | ||
|
|
||
| protected void removeLoadBalancingRule(final IpAddress publicIp, final Network network, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,6 +139,9 @@ private String getKubernetesControlNodeConfig(final String controlNodeIp, final | |
| final String clusterToken = "{{ k8s_control_node.cluster.token }}"; | ||
| final String clusterInitArgsKey = "{{ k8s_control_node.cluster.initargs }}"; | ||
| final String ejectIsoKey = "{{ k8s.eject.iso }}"; | ||
| final String installWaitTime = "{{ k8s.install.wait.time }}"; | ||
| final String installReattemptsCount = "{{ k8s.install.reattempts.count }}"; | ||
|
|
||
| final List<String> addresses = new ArrayList<>(); | ||
| addresses.add(controlNodeIp); | ||
| if (!serverIp.equals(controlNodeIp)) { | ||
|
|
@@ -150,6 +153,8 @@ private String getKubernetesControlNodeConfig(final String controlNodeIp, final | |
| final String tlsClientCert = CertUtils.x509CertificateToPem(certificate.getClientCertificate()); | ||
| final String tlsPrivateKey = CertUtils.privateKeyToPem(certificate.getPrivateKey()); | ||
| final String tlsCaCert = CertUtils.x509CertificatesToPem(certificate.getCaCertificates()); | ||
| final Long waitTime = KubernetesClusterService.KubernetesControlNodeInstallAttemptWait.value(); | ||
| final Long reattempts = KubernetesClusterService.KubernetesControlNodeInstallReattempts.value(); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(apiServerCert, tlsClientCert.replace("\n", "\n ")); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(apiServerKey, tlsPrivateKey.replace("\n", "\n ")); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(caCert, tlsCaCert.replace("\n", "\n ")); | ||
|
|
@@ -161,6 +166,8 @@ private String getKubernetesControlNodeConfig(final String controlNodeIp, final | |
| pubKey += "\n - \"" + sshkp.getPublicKey() + "\""; | ||
| } | ||
| } | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(installWaitTime, String.valueOf(waitTime)); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(installReattemptsCount, String.valueOf(reattempts)); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(sshPubKey, pubKey); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(clusterToken, KubernetesClusterUtil.generateClusterToken(kubernetesCluster)); | ||
| String initArgs = ""; | ||
|
|
@@ -241,6 +248,11 @@ private String getKubernetesAdditionalControlNodeConfig(final String joinIp, fin | |
| final String sshPubKey = "{{ k8s.ssh.pub.key }}"; | ||
| final String clusterHACertificateKey = "{{ k8s_control_node.cluster.ha.certificate.key }}"; | ||
| final String ejectIsoKey = "{{ k8s.eject.iso }}"; | ||
| final String installWaitTime = "{{ k8s.install.wait.time }}"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for all these CKS logic using the settings values |
||
| final String installReattemptsCount = "{{ k8s.install.reattempts.count }}"; | ||
|
|
||
| final Long waitTime = KubernetesClusterService.KubernetesControlNodeInstallAttemptWait.value(); | ||
| final Long reattempts = KubernetesClusterService.KubernetesControlNodeInstallReattempts.value(); | ||
| String pubKey = "- \"" + configurationDao.getValue("ssh.publickey") + "\""; | ||
| String sshKeyPair = kubernetesCluster.getKeyPair(); | ||
| if (StringUtils.isNotEmpty(sshKeyPair)) { | ||
|
|
@@ -249,6 +261,8 @@ private String getKubernetesAdditionalControlNodeConfig(final String joinIp, fin | |
| pubKey += "\n - \"" + sshkp.getPublicKey() + "\""; | ||
| } | ||
| } | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(installWaitTime, String.valueOf(waitTime)); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(installReattemptsCount, String.valueOf(reattempts)); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(sshPubKey, pubKey); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(joinIpKey, joinIp); | ||
| k8sControlNodeConfig = k8sControlNodeConfig.replace(clusterTokenKey, KubernetesClusterUtil.generateClusterToken(kubernetesCluster)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these settings shouldn't be part of this PR but for #9102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is just externalizing the already present in the CKS scripts. So it wouldn't cause any issues. Unless you still want to me to revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should fix only NSX related issues on this PR and we could add the externalize settings on the other PR