Skip to content

Commit 3de1ccd

Browse files
nvazquezPearl1594DaanHooglandsureshanaparti
authored andcommitted
CKS Enhancements (apache#9102)
CKS Enhancements: * Ability to specify different compute or service offerings for different types of CKS cluster nodes – worker, master or etcd * Ability to use CKS ready custom templates for CKS cluster nodes * Add and Remove external nodes to and from a kubernetes cluster Co-authored-by: nvazquez <[email protected]> * Update remove node timeout global setting * CKS/NSX : Missing variables in worker nodes * CKS: Fix ISO attach logic * CKS: Fix ISO attach logic * address comment * Fix Port - Node mapping when cluster is scaled in the presence of external node(s) * CKS: Externalize control and worker node setup wait time and installation attempts * Fix logger * Add missing headers and fix end of line on files * CKS Mark Nodes for Manual Upgrade and Filter Nodes to add to CKS cluster from the same network * Add support to deploy CKS cluster nodes on hosts dedicated to a domain --------- Co-authored-by: Pearl Dsilva <[email protected]> * Support unstacked ETCD --------- Co-authored-by: nvazquez <[email protected]> * Fix CKS cluster scaling and minor UI improvement * Reuse k8s cluster public IP for etcd nodes and rename etcd nodes * Fix DNS resolver issue * Update UDP active monitor to ICMP * Add hypervisor type to CKS cluster creation to fix CKS cluster creation when External hosts added * Fix build * Fix logger * Modify hypervisor param description in the create CKS cluster API * CKS delete fails when external nodes are present * CKS delete fails when external nodes are present * address comment * Improve network rules cleanup on failure adding external nodes to CKS cluster * UI: Fix etcd template was not honoured * UI: Fix etcd template was not honoured * Refactor * CKS: Exclude etcd nodes when calculating port numbers * Fix network cleanup in case of CKS cluster failure * Externalize retries and inverval for NSX segment deletion * Fix CKS scaling when external node(s) present in the cluster * CKS: Fix port numbers displayed against ETCD nodes * Add node version details to every node of k8s cluster - as we now support manual upgrade * Add node version details to every node of k8s cluster - as we now support manual upgrade * update column name * CKS: Exclude etcd nodes when calculating port numbers * update param name * update param * UI: Fix CKS cluster creation templates listing for non admins * CKS: Prevent etcd node start port number to coincide with k8s cluster start port numbers * CKS: Set default kubernetes cluster node version to the kubernetes cluster version on upgrade * CKS: Set default kubernetes cluster node version to the kubernetes cluster version on upgrade * consolidate query * Fix upgrade logic --------- Co-authored-by: nvazquez <[email protected]> * Fix CKS cluster version upgrade * CKS: Fix etcd port numbers being skipped * Fix CKS cluster with etcd nodes on VPC * Move schema and upgrade for 4.20 * Fix logger * Fix after rebasing * Add support for using different CNI plugins with CKS * Add support for using different CNI plugins with CKS * remove unused import * Add UI support and list cni config API * necessary UI changes * add license * changes to support external cni * UI changes * Fix NPE on restarting VPC with additional public IPs * fix merge conflict * add asnumber to create k8s svc layer * support cni framework to use as-numbers * update code * condition to ignore undefined jinja template variables * CKS: Do not pass AS number when network ID is passed * Fix deletion of Userdata / CNI Configuration in projects * CKS: Add CNI configuration details to the response and UI * Explicit events for registering cni configuration * Add Delete cni configuration API * Fix CKS deployment when using VPC tiers with custom ACLs * Fix DNS list on VR * CKS: Use Network offering of the network passed during CKS cluster creation to get the AS number * CKS cluster with guest IP * Fix: Use control node guest IP as join IP for external nodes addition * Fix DNS resolver issue * Improve etcd indexing - start from 1 * CKS: Add external node to a CKS cluster deployed with etcd node(s) successfully * CKS: Add external node to a CKS cluster deployed with etcd node(s) successfully * simplify logic * Tweak setup-kube-system script for baremetal external nodes * Consider cordoned nodes while getting ready nodes * Fix CKS cluster scale calculations * Set token TTL to 0 (no expire) for external etcd * Fix missing quotes * Fix build * Revert PR 9133 * Add calico commands for ens35 interface * Address review comments: plan CKS cluster deployment based on the node type * Add qemu-guest-agent dependency for kvm based templates * Add marvin test for CKS clusters with different offerings per node type * Remove test tag * Add marvin test and fix update template for cks and since annotations * Fix marvin test for adding and removing external nodes * Fix since version on API params * Address review comments * Fix unit test * Address review comments * UI: Make CKS public templates visible to non-admins on CKS cluster creation * Fix linter * Fix merge error * Fix positional parameters on the create kubernetes ISO script and make the ETCD version optional * fix etcd port displayed * Further improvements to CKS (#118) * Multiple nics support on Ubuntu template * Multiple nics support on Ubuntu template * supports allocating IP to the nic when VM is added to another network - no delay * Add option to select DNS or VR IP as resolver on VPC creation * Add API param and UI to select option * Add column on vpc and pass the value on the databags for CsDhcp.py to fix accordingly * Externalize the CKS Configuration, so that end users can tweak the configuration before deploying the cluster * Add new directory to c8 packaging for CKS config * Remove k8s configuration from resources and make it configurable * Revert "Remove k8s configuration from resources and make it configurable" This reverts commit d5997033ebe4ba559e6478a64578b894f8e7d3db. * copy conf to mgmt server and consume them from there * Remove node from cluster * Add missing /opt/bin directory requrired by external nodes * Login to a specific Project view * add indents * Fix CKS HA clusters * Fix build --------- Co-authored-by: Nicolas Vazquez <[email protected]> * Add missing headers * Fix linter * Address more review comments * Fix unit test * Fix scaling case for the same offering * Revert "Login to a specific Project view" This reverts commit 95e3756. * Revert "Fix CKS HA clusters" (#120) This reverts commit 8dac16a. * Apply suggestions from code review about user data Co-authored-by: Suresh Kumar Anaparti <[email protected]> * Update api/src/main/java/org/apache/cloudstack/api/command/user/userdata/BaseRegisterUserDataCmd.java Co-authored-by: Suresh Kumar Anaparti <[email protected]> * Refactor column names and schema path * Fix scaling for non existing previous offering per node type * Update node offering entry if there was an existing offering but a global service offering has been provided on scale --------- Co-authored-by: Pearl Dsilva <[email protected]> Co-authored-by: Daan Hoogland <[email protected]> Co-authored-by: Suresh Kumar Anaparti <[email protected]>
1 parent d219d01 commit 3de1ccd

File tree

142 files changed

+7376
-628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+7376
-628
lines changed

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ public class EventTypes {
293293

294294
//registering userdata events
295295
public static final String EVENT_REGISTER_USER_DATA = "REGISTER.USER.DATA";
296+
public static final String EVENT_REGISTER_CNI_CONFIG = "REGISTER.CNI.CONFIG";
297+
public static final String EVENT_DELETE_CNI_CONFIG = "DELETE.CNI.CONFIG";
296298

297299
//register for user API and secret keys
298300
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ enum Event {
4444
AutoscaleRequested,
4545
ScaleUpRequested,
4646
ScaleDownRequested,
47+
AddNodeRequested,
48+
RemoveNodeRequested,
4749
UpgradeRequested,
4850
OperationSucceeded,
4951
OperationFailed,
@@ -59,6 +61,8 @@ enum State {
5961
Stopped("All resources for the Kubernetes cluster are destroyed, Kubernetes cluster may still have ephemeral resource like persistent volumes provisioned"),
6062
Scaling("Transient state in which resources are either getting scaled up/down"),
6163
Upgrading("Transient state in which cluster is getting upgraded"),
64+
Importing("Transient state in which additional nodes are added as worker nodes to a cluster"),
65+
RemovingNodes("Transient state in which additional nodes are removed from a cluster"),
6266
Alert("State to represent Kubernetes clusters which are not in expected desired state (operationally in active control place, stopped cluster VM's etc)."),
6367
Recovering("State in which Kubernetes cluster is recovering from alert state"),
6468
Destroyed("End state of Kubernetes cluster in which all resources are destroyed, cluster will not be usable further"),
@@ -96,6 +100,17 @@ enum State {
96100
s_fsm.addTransition(State.Upgrading, Event.OperationSucceeded, State.Running);
97101
s_fsm.addTransition(State.Upgrading, Event.OperationFailed, State.Alert);
98102

103+
s_fsm.addTransition(State.Running, Event.AddNodeRequested, State.Importing);
104+
s_fsm.addTransition(State.Alert, Event.AddNodeRequested, State.Importing);
105+
s_fsm.addTransition(State.Importing, Event.OperationSucceeded, State.Running);
106+
s_fsm.addTransition(State.Importing, Event.OperationFailed, State.Running);
107+
s_fsm.addTransition(State.Alert, Event.OperationSucceeded, State.Running);
108+
109+
s_fsm.addTransition(State.Running, Event.RemoveNodeRequested, State.RemovingNodes);
110+
s_fsm.addTransition(State.Alert, Event.RemoveNodeRequested, State.RemovingNodes);
111+
s_fsm.addTransition(State.RemovingNodes, Event.OperationSucceeded, State.Running);
112+
s_fsm.addTransition(State.RemovingNodes, Event.OperationFailed, State.Running);
113+
99114
s_fsm.addTransition(State.Alert, Event.RecoveryRequested, State.Recovering);
100115
s_fsm.addTransition(State.Recovering, Event.OperationSucceeded, State.Running);
101116
s_fsm.addTransition(State.Recovering, Event.OperationFailed, State.Alert);
@@ -142,4 +157,13 @@ enum State {
142157
Long getMaxSize();
143158
Long getSecurityGroupId();
144159
ClusterType getClusterType();
160+
Long getControlNodeServiceOfferingId();
161+
Long getWorkerNodeServiceOfferingId();
162+
Long getEtcdNodeServiceOfferingId();
163+
Long getControlNodeTemplateId();
164+
Long getWorkerNodeTemplateId();
165+
Long getEtcdNodeTemplateId();
166+
Long getEtcdNodeCount();
167+
Long getCniConfigId();
168+
String getCniConfigDetails();
145169
}

api/src/main/java/com/cloud/kubernetes/cluster/KubernetesServiceHelper.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@
1818

1919
import org.apache.cloudstack.acl.ControlledEntity;
2020

21+
import java.util.Map;
22+
2123
import com.cloud.user.Account;
2224
import com.cloud.uservm.UserVm;
2325
import com.cloud.utils.component.Adapter;
2426

2527
public interface KubernetesServiceHelper extends Adapter {
2628

29+
enum KubernetesClusterNodeType {
30+
CONTROL, WORKER, ETCD, DEFAULT
31+
}
32+
2733
ControlledEntity findByUuid(String uuid);
2834
ControlledEntity findByVmId(long vmId);
2935
void checkVmCanBeDestroyed(UserVm userVm);
36+
boolean isValidNodeType(String nodeType);
37+
Map<String, Long> getServiceOfferingNodeTypeMap(Map<String, Map<String, String>> serviceOfferingNodeTypeMap);
38+
Map<String, Long> getTemplateNodeTypeMap(Map<String, Map<String, String>> templateNodeTypeMap);
3039
void cleanupForAccount(Account account);
3140
}

api/src/main/java/com/cloud/network/NetworkService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,6 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
268268
InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId);
269269
InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId);
270270
List<InternalLoadBalancerElementService> getInternalLoadBalancerElements();
271+
272+
boolean handleCksIsoOnNetworkVirtualRouter(Long virtualRouterId, boolean mount) throws ResourceUnavailableException;
271273
}

api/src/main/java/com/cloud/network/vpc/Vpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,6 @@ public enum State {
105105
String getIp6Dns1();
106106

107107
String getIp6Dns2();
108+
109+
boolean useRouterIpAsResolver();
108110
}

api/src/main/java/com/cloud/network/vpc/VpcService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ public interface VpcService {
4848
* @param vpcName
4949
* @param displayText
5050
* @param cidr
51-
* @param networkDomain TODO
51+
* @param networkDomain TODO
5252
* @param ip4Dns1
5353
* @param ip4Dns2
54-
* @param displayVpc TODO
54+
* @param displayVpc TODO
55+
* @param useVrIpResolver
5556
* @return
5657
* @throws ResourceAllocationException TODO
5758
*/
5859
Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
5960
String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu, Integer cidrSize,
60-
Long asNumber, List<Long> bgpPeerIds)
61-
throws ResourceAllocationException;
61+
Long asNumber, List<Long> bgpPeerIds, Boolean useVrIpResolver) throws ResourceAllocationException;
6262

6363
/**
6464
* Persists VPC record in the database

api/src/main/java/com/cloud/server/ManagementService.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@
7070
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
7171
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
7272
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
73+
import org.apache.cloudstack.api.command.user.userdata.DeleteCniConfigurationCmd;
7374
import org.apache.cloudstack.api.command.user.userdata.DeleteUserDataCmd;
7475
import org.apache.cloudstack.api.command.user.userdata.ListUserDataCmd;
76+
import org.apache.cloudstack.api.command.user.userdata.RegisterCniConfigurationCmd;
7577
import org.apache.cloudstack.api.command.user.userdata.RegisterUserDataCmd;
7678
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
7779
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
@@ -393,17 +395,23 @@ public interface ManagementService {
393395
* The api command class.
394396
* @return The list of userdatas found.
395397
*/
396-
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd);
398+
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd, boolean forCks);
399+
400+
/**
401+
* Registers a cni configuration.
402+
*
403+
* @param cmd The api command class.
404+
* @return A VO with the registered user data.
405+
*/
406+
UserData registerCniConfiguration(RegisterCniConfigurationCmd cmd);
397407

398408
/**
399409
* Registers a userdata.
400410
*
401-
* @param cmd
402-
* The api command class.
411+
* @param cmd The api command class.
403412
* @return A VO with the registered userdata.
404413
*/
405414
UserData registerUserData(RegisterUserDataCmd cmd);
406-
407415
/**
408416
* Deletes a userdata.
409417
*
@@ -413,6 +421,14 @@ public interface ManagementService {
413421
*/
414422
boolean deleteUserData(DeleteUserDataCmd cmd);
415423

424+
/**
425+
* Deletes user data.
426+
*
427+
* @param cmd
428+
* The api command class.
429+
* @return True on success. False otherwise.
430+
*/
431+
boolean deleteCniConfiguration(DeleteCniConfigurationCmd cmd);
416432
/**
417433
* Search registered key pairs for the logged in user.
418434
*

api/src/main/java/com/cloud/template/TemplateApiService.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,23 @@ public interface TemplateApiService {
6262
VirtualMachineTemplate prepareTemplate(long templateId, long zoneId, Long storageId);
6363

6464

65+
/**
66+
* Detach ISO from VM
67+
* @param vmId id of the VM
68+
* @param isoId id of the ISO (when passed). If it is not passed, it will get it from user_vm table
69+
* @param extraParams forced, isVirtualRouter
70+
* @return true when operation succeeds, false if not
71+
*/
72+
boolean detachIso(long vmId, Long isoId, Boolean... extraParams);
6573

66-
boolean detachIso(long vmId, boolean forced);
67-
68-
boolean attachIso(long isoId, long vmId, boolean forced);
74+
/**
75+
* Attach ISO to a VM
76+
* @param isoId id of the ISO to attach
77+
* @param vmId id of the VM to attach the ISO to
78+
* @param extraParams: forced, isVirtualRouter
79+
* @return true when operation succeeds, false if not
80+
*/
81+
boolean attachIso(long isoId, long vmId, Boolean... extraParams);
6982

7083
/**
7184
* Deletes a template

api/src/main/java/com/cloud/template/VirtualMachineTemplate.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ public enum TemplateFilter {
145145

146146
boolean isDeployAsIs();
147147

148+
boolean isForCks();
149+
148150
Long getUserDataId();
149151

150152
UserData.UserDataOverridePolicy getUserDataOverridePolicy();

api/src/main/java/com/cloud/user/UserData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ public enum UserDataOverridePolicy {
2929
String getUserData();
3030

3131
String getParams();
32+
boolean isForCks();
3233
}

0 commit comments

Comments
 (0)