Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
<yorc.k8s.types.version>3.1.0</yorc.k8s.types.version>
<yorc.os.types.version>3.1.0</yorc.os.types.version>
<yorc.slurm.types.version>3.0.0</yorc.slurm.types.version>
<yorc.maas.types.version>1.0.0</yorc.maas.types.version>

<!-- Tests -->
<mockito.version>1.10.19</mockito.version>
<springockito.version>1.0.9</springockito.version>

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/alien4cloud/paas/yorc/YorcPluginFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class YorcPluginFactory implements IOrchestratorPluginFactory<YorcOrchest
public static final String AWS = "AWS";
public static final String GOOGLE = "Google Cloud";
public static final String HOSTS_POOL = "HostsPool";
public static final String MAAS = "MAAS";

public static final String MONITORING_TIME_INTERVAL = "monitoring_time_interval";

Expand Down Expand Up @@ -116,7 +117,8 @@ public LocationSupport getLocationSupport() {
OPENSTACK,
SLURM,
KUBERNETES,
HOSTS_POOL
HOSTS_POOL,
MAAS,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ protected ILocationConfiguratorPlugin newInstanceBasedOnLocation(String location
case YorcPluginFactory.HOSTS_POOL:
configurer = applicationContext.getBean(YorcHostsPoolLocationConfigurer.class);
break;
case YorcPluginFactory.MAAS:
configurer = applicationContext.getBean(YorcMaasLocationConfigurer.class);
break;
default:
log.warn("The \"%s\" location type is not handled", locationType);
log.warn("The "+locationType+" location type is not handled");
}
return configurer;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package alien4cloud.paas.yorc.location;

import alien4cloud.model.deployment.matching.MatchingConfiguration;
import alien4cloud.model.orchestrators.locations.LocationResourceTemplate;
import alien4cloud.orchestrators.plugin.ILocationResourceAccessor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
* Configure resources for the maas location type.
*/
@Slf4j
@Component
@Scope("prototype")
public class YorcMaasLocationConfigurer extends AbstractLocationConfigurer {

private static final String IMAGE_ID_PROP = "image_id";
private static final String FLAVOR_ID_PROP = "instance_type";

@Override
public List<String> getResourcesTypes() {
return getAllResourcesTypes();
}

@Override
public Map<String, MatchingConfiguration> getMatchingConfigurations() {
return getMatchingConfigurations("maas/resources-matching-config.yml");
}

@Override
protected String[] getLocationArchivePaths() {
return new String[]{"maas/resources"};
}

}
16 changes: 16 additions & 0 deletions src/main/resources/maas/resources-matching-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

matching_configurations:
# yorc.nodes.aws.Compute:
# capabilities:
# - host:
# properties:
# - num_cpus: { less_or_equal: 0 } # we match if the template value is less or equal that the location resource value
# - cpu_frequency: { less_or_equal: 0 Hz }
# - mem_size: { less_or_equal: 0 B }
# - disk_size: { less_or_equal: 0 B }
# - os:
# properties:
# - architecture: { equal: "" }
# - type: { equal: "" }
# - distribution: { equal: "" }
# - version: { less_or_equal: "" }
74 changes: 74 additions & 0 deletions src/main/resources/maas/resources/resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
tosca_definitions_version: ${alien4cloud.dsl.version}

template_name: yorc-maas-types
template_author: Yorc
template_version: ${yorc.hp.types.version}


# Note: If we reference a dependency using project.version then this component should
# be versioned as project.version too otherwise we will have issues on snapshots
# versions (our type not snapshot referencing a snapshot version)
imports:
- tosca-normative-types:${tosca.normative.types.version}
- yorc-types:${yorc.types.version}

node_types:
yorc.nodes.maas.Compute:
derived_from: yorc.nodes.Compute
properties:
distro_series:
type: string
required: false
description: If present, this parameter specifies the OS the machine will use. Else the MASS default OS will be use.
arch :
type: string
required: false
description: Architecture of the returned machine (e.g. 'i386/generic', 'amd64', 'armhf/highbank', etc.).
erase:
type: boolean
required: false
description: Erase the disk when undeploying. if neither secure_erase nor quick_erase are specified, MAAS will overwrite the whole disk with null bytes. This can be very slow.
secure_erase:
type: boolean
required: false
description: Use the drive's secure erase feature if available. In some cases, this can be much faster than overwriting the drive. Some drives implement secure erasure by overwriting themselves so this could still be slow.
quick_erase:
type: boolean
required: false
description: Wipe 2MiB at the start and at the end of the drive to make data recovery inconvenient and unlikely to happen by accident. This is not secure.
tags:
type: string
required: false
description: Comma separated list of tags that the machine must match in order to be acquired. If multiple tag names are specified, the machine must be tagged with all of them.
not_tags:
type: string
required: false
description: Comma separated list of tags that the machine must NOT match. If multiple tag names are specified, the machine must NOT be tagged with ANY of them.
capabilities:
host:
type: tosca.capabilities.Container

##############################################
# Abstract resources used for auto-config
##############################################
yorc.nodes.maas.Image:
abstract: true
derived_from: tosca.nodes.Root
description: MAAS OS image available
properties:
id:
type: string
capabilities:
os:
type: tosca.capabilities.OperatingSystem

yorc.nodes.maas.Machines:
abstract: true
derived_from: tosca.nodes.Root
description: MAAS machines description. (cpu_frequency is not handled by MAAS for now)
properties:
id:
type: string
capabilities:
host:
type: tosca.capabilities.Container