Skip to content

Commit e92f594

Browse files
committed
Merge remote-tracking branch 'upstream/main' into improve/config-resources
2 parents f036d8a + 5b7c3b4 commit e92f594

File tree

143 files changed

+7382
-636
lines changed

Some content is hidden

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

143 files changed

+7382
-636
lines changed

INSTALL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Set up Maven (3.9.10):
2828
# echo export PATH=/usr/local/maven/bin:${PATH} >> ~/.bashrc # or .zshrc or .profile
2929
# source ~/.bashrc
3030

31-
Setup up NodeJS (LTS):
31+
Setup up Node.js 16:
3232

33-
# curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
33+
# curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
3434
# sudo yum install nodejs
3535
# sudo npm install -g @vue/cli npm-check-updates
3636

@@ -104,13 +104,13 @@ To install dependencies.
104104

105105
To build the project.
106106

107-
$ npm build
107+
$ npm run build
108108

109109
For Development Mode.
110110

111111
$ npm start
112112

113-
Make sure to set CS_URL=http://localhost:8080/client on .env.local file on ui.
113+
Make sure to set `CS_URL=http://localhost:8080` on the `.env.local` file on UI.
114114

115115
You should be able to run the management server on http://localhost:5050
116116

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

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

290290
//registering userdata events
291291
public static final String EVENT_REGISTER_USER_DATA = "REGISTER.USER.DATA";
292+
public static final String EVENT_REGISTER_CNI_CONFIG = "REGISTER.CNI.CONFIG";
293+
public static final String EVENT_DELETE_CNI_CONFIG = "DELETE.CNI.CONFIG";
292294

293295
//register for user API and secret keys
294296
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java renamed to api/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java

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
@@ -62,8 +62,10 @@
6262
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
6363
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
6464
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
65+
import org.apache.cloudstack.api.command.user.userdata.DeleteCniConfigurationCmd;
6566
import org.apache.cloudstack.api.command.user.userdata.DeleteUserDataCmd;
6667
import org.apache.cloudstack.api.command.user.userdata.ListUserDataCmd;
68+
import org.apache.cloudstack.api.command.user.userdata.RegisterCniConfigurationCmd;
6769
import org.apache.cloudstack.api.command.user.userdata.RegisterUserDataCmd;
6870
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
6971
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
@@ -369,17 +371,23 @@ public interface ManagementService {
369371
* The api command class.
370372
* @return The list of userdatas found.
371373
*/
372-
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd);
374+
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd, boolean forCks);
375+
376+
/**
377+
* Registers a cni configuration.
378+
*
379+
* @param cmd The api command class.
380+
* @return A VO with the registered user data.
381+
*/
382+
UserData registerCniConfiguration(RegisterCniConfigurationCmd cmd);
373383

374384
/**
375385
* Registers a userdata.
376386
*
377-
* @param cmd
378-
* The api command class.
387+
* @param cmd The api command class.
379388
* @return A VO with the registered userdata.
380389
*/
381390
UserData registerUserData(RegisterUserDataCmd cmd);
382-
383391
/**
384392
* Deletes a userdata.
385393
*
@@ -389,6 +397,14 @@ public interface ManagementService {
389397
*/
390398
boolean deleteUserData(DeleteUserDataCmd cmd);
391399

400+
/**
401+
* Deletes user data.
402+
*
403+
* @param cmd
404+
* The api command class.
405+
* @return True on success. False otherwise.
406+
*/
407+
boolean deleteCniConfiguration(DeleteCniConfigurationCmd cmd);
392408
/**
393409
* Search registered key pairs for the logged in user.
394410
*

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

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

6060

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

62-
boolean detachIso(long vmId, boolean forced);
63-
64-
boolean attachIso(long isoId, long vmId, boolean forced);
70+
/**
71+
* Attach ISO to a VM
72+
* @param isoId id of the ISO to attach
73+
* @param vmId id of the VM to attach the ISO to
74+
* @param extraParams: forced, isVirtualRouter
75+
* @return true when operation succeeds, false if not
76+
*/
77+
boolean attachIso(long isoId, long vmId, Boolean... extraParams);
6578

6679
/**
6780
* 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();

0 commit comments

Comments
 (0)