Skip to content

Commit 5ce4846

Browse files
start setting up NIMBLE
1 parent 71f47d6 commit 5ce4846

9 files changed

Lines changed: 257 additions & 0 deletions

File tree

client/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,11 @@
622622
<artifactId>cloud-plugin-maintenance</artifactId>
623623
<version>${project.version}</version>
624624
</dependency>
625+
<dependency>
626+
<groupId>org.apache.cloudstack</groupId>
627+
<artifactId>cloud-plugin-iac-nimble</artifactId>
628+
<version>${project.version}</version>
629+
</dependency>
625630
<dependency>
626631
<groupId>org.apache.cloudstack</groupId>
627632
<artifactId>cloud-engine-storage-object</artifactId>

plugins/iac/nimble/pom.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
21+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<artifactId>cloud-plugin-iac-nimble</artifactId>
24+
<name>Apache CloudStack Plugin - Native IaC Management, Build and Launch Engine (NIMBLE)</name>
25+
<parent>
26+
<groupId>org.apache.cloudstack</groupId>
27+
<artifactId>cloudstack-plugins</artifactId>
28+
<version>4.22.0.0</version>
29+
<relativePath>../../pom.xml</relativePath>
30+
</parent>
31+
</project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command;
18+
19+
import org.apache.cloudstack.acl.RoleType;
20+
import org.apache.cloudstack.api.APICommand;
21+
import org.apache.cloudstack.api.BaseListCmd;
22+
import org.apache.cloudstack.api.response.IacResourceTypesResponse;
23+
import org.apache.cloudstack.nimble.NimbleService;
24+
25+
import javax.inject.Inject;
26+
27+
@APICommand(name = "listIacResourceTypes",
28+
description = "Lists available IaC resource types, such as TOSCA's node, relationship and capacity types.",
29+
responseObject = IacResourceTypesResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
30+
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
31+
public class ListIacResourceTypesCmd extends BaseListCmd {
32+
@Inject
33+
private NimbleService nimbleService;
34+
35+
@Override
36+
public void execute() {
37+
nimbleService.listIacResourceTypes();
38+
}
39+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.response;
18+
19+
import org.apache.cloudstack.api.BaseResponseWithAnnotations;
20+
import org.apache.cloudstack.api.EntityReference;
21+
22+
@EntityReference(value = {})
23+
public class IacResourceTypesResponse extends BaseResponseWithAnnotations {
24+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.nimble;
18+
19+
import com.cloud.utils.component.ManagerBase;
20+
import org.apache.cloudstack.api.command.ListIacResourceTypesCmd;
21+
import org.apache.cloudstack.framework.config.ConfigKey;
22+
23+
import javax.naming.ConfigurationException;
24+
import java.util.ArrayList;
25+
import java.util.List;
26+
import java.util.Map;
27+
import java.util.concurrent.ExecutorService;
28+
import java.util.concurrent.Executors;
29+
30+
public class NimbleManagerImpl extends ManagerBase implements NimbleService {
31+
private ExecutorService nimbleExecutorPool;
32+
33+
@Override
34+
public void listIacResourceTypes() {
35+
logger.info("All set :) -> let's finish this!!!");
36+
}
37+
38+
@Override
39+
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
40+
super.configure(name, params);
41+
42+
int nimbleServicePoolSize = NimbleService.NimbleServicePoolSize.value();
43+
logger.debug("Configuring NIMBLE's fixed thread pool with [{}] threads.", nimbleServicePoolSize);
44+
nimbleExecutorPool = Executors.newFixedThreadPool(nimbleServicePoolSize);
45+
46+
return true;
47+
}
48+
49+
@Override
50+
public boolean stop() {
51+
logger.info("Stopping NIMBLE's manager.");
52+
53+
if (nimbleExecutorPool != null) {
54+
logger.debug("Shutting down NIMBLE's fixed thread pool.");
55+
nimbleExecutorPool.shutdown();
56+
}
57+
58+
return true;
59+
}
60+
61+
@Override
62+
public List<Class<?>> getCommands() {
63+
List<Class<?>> commands = new ArrayList<>();
64+
if (!NimbleServiceEnabled.value()) {
65+
return commands;
66+
}
67+
return List.of(ListIacResourceTypesCmd.class);
68+
}
69+
70+
@Override
71+
public String getConfigComponentName() {
72+
return NimbleService.class.getSimpleName();
73+
}
74+
75+
@Override
76+
public ConfigKey<?>[] getConfigKeys() {
77+
return new ConfigKey<?>[] { NimbleServiceEnabled, NimbleServicePoolSize };
78+
}
79+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.nimble;
18+
19+
import com.cloud.utils.component.PluggableService;
20+
import org.apache.cloudstack.framework.config.ConfigKey;
21+
import org.apache.cloudstack.framework.config.Configurable;
22+
23+
public interface NimbleService extends PluggableService, Configurable {
24+
ConfigKey<Boolean> NimbleServiceEnabled = new ConfigKey<>("Advanced", Boolean.class,
25+
"nimble.service.enabled", "false",
26+
"Indicates whether NIMBLE (Native IaC Management, Build & Launch Engine) is enabled.", false);
27+
28+
ConfigKey<Integer> NimbleServicePoolSize = new ConfigKey<>("Advanced", Integer.class, "nimble.service.pool.size", "1",
29+
"Number of threads in the global pool used to execute NIMBLE node template provisioning tasks. " +
30+
"This pool is initialized during NIMBLE startup using the configured value. Administrators should " +
31+
"tune this setting based on service utilization to optimize provisioning performance.",
32+
true, NimbleServiceEnabled.key());
33+
34+
void listIacResourceTypes();
35+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
name=nimble
18+
parent=api
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<beans xmlns="http://www.springframework.org/schema/beans"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://www.springframework.org/schema/beans
22+
http://www.springframework.org/schema/beans/spring-beans.xsd">
23+
<bean id="nimbleManager" class="org.apache.cloudstack.nimble.NimbleManagerImpl" />
24+
</beans>

plugins/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
<module>hypervisors/ucs</module>
9494
<module>hypervisors/xenserver</module>
9595

96+
<module>iac/nimble</module>
97+
9698
<module>integrations/cloudian</module>
9799
<module>integrations/prometheus</module>
98100
<module>integrations/kubernetes-service</module>

0 commit comments

Comments
 (0)