Skip to content
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

Integrate other 1st release features #63

Merged
merged 23 commits into from
Jun 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8b2f66b
Add basic Image ID substitution in TOSCA template
lorenzo-biava Jun 13, 2016
e0e4b7e
Fix image choice to follow vanilla image + Ansible fallback mode
lorenzo-biava Jun 15, 2016
0c9e80c
Add image substitution to IM Update deployment logic
lorenzo-biava Jun 16, 2016
b92a709
Fix integration tests (CloudProviderRanker was using MockServer)
lorenzo-biava Jun 17, 2016
f3ec935
Fix IM deploy failure message going lost
lorenzo-biava Jun 17, 2016
7772f7c
Add chosen Cloud Provider data to DeploymentMessage
lorenzo-biava Jun 20, 2016
4cfaa45
Fix #64: Replace `orchestrator_url` property in `ElasticCluster` nodes
lorenzo-biava Jun 20, 2016
5781965
Update dependencies to stable (workflow-manager, chronos-client)
lorenzo-biava Jun 20, 2016
645f2b3
Fix CheckStyle
lorenzo-biava Jun 20, 2016
e715a65
Merge remote-tracking branch 'origin/develop' into feat/53-image-ids
lorenzo-biava Jun 23, 2016
870590d
Improve Images match with tag in name check and case-insensitive meta
lorenzo-biava Jun 23, 2016
4db64cc
Retrieve Provider's Service's Image list from CMDB (plus tests)
lorenzo-biava Jun 23, 2016
e163ce1
Filter Cloud Providers based on Images required in Deployment
lorenzo-biava Jun 23, 2016
698c71a
Merge pull request #67 from indigo-dc/feat/53-image-ids
lorenzo-biava Jun 23, 2016
17cb4a3
Fix failing tests (updated demo Service IDs)
lorenzo-biava Jun 23, 2016
0d280ef
Extracted, generated (with stub) and persisted chosen CP endpoint
lorenzo-biava Jun 20, 2016
a2c2478
Add OAuth2 authentication
Jun 23, 2016
0f2849c
Remove cloud site hardcoded choice
Jun 23, 2016
8c617f9
Merge pull request #68 from indigo-dc/feat/51-use-selected-cloud-prov…
alberto-brigandi Jun 23, 2016
e5c7f24
Fix Image match (was not prioritizing image name match correctly)
lorenzo-biava Jun 23, 2016
bf1235c
Merge branch 'master' into develop
lorenzo-biava Jun 23, 2016
fde867f
Update dependencies to stable (alien4cloud)
lorenzo-biava Jun 23, 2016
bde496b
Fix CheckStyle
lorenzo-biava Jun 23, 2016
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
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
INDIGO Orchestrator
============================

This is the orchestrator of the PaaS layer, a core component of the INDIGO project. It receives high-level deployment requests and coordinates the deployment process over the IaaS platforms or Mesos.
This is the Orchestrator of the PaaS layer, a core component of the INDIGO project. It receives high-level deployment requests and coordinates the deployment process over the IaaS platforms or Mesos.

You can find the REST APIs docs [orchestrator-rest-doc] (http://indigo-dc.github.io/orchestrator/restdocs/).

Expand Down Expand Up @@ -55,30 +55,32 @@ docker build -t indigodatacloud/orchestrator /path/to/the/docker/folder
1.3 RUNNING
--------------
### With MySQL dockerized on the same host
The orchestrator can be run in 3 steps:
The Orchestrator can be run in 3 steps:

1. Run the MySQL deployments database with the command
1. Run the MySQL deployments database with the command:

```
sudo docker run --name databaseOrchestrator -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=orchestrator -d mysql:5.7
```

2. Run the MySQL workflow database with the command
2. Run the MySQL workflow database with the command:

```
sudo docker run --name databaseWorkflow -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=workflow -d mysql:5.7
```

3. Run the orchestrator with the command
3. Run the Orchestrator with the command:

**`IMPORTANT`**: Remember to replace `ORCHESTRATOR_URL` with the base URL which the Orchestrator is available to (it MUST be accessible for the ElasticCluster callbacks!).

```
sudo docker run --name orchestrator --link databaseWorkflow:databaseWorkflow --link databaseOrchestrator:databaseOrchestrator \
-p 80:8080 -d indigodatacloud/orchestrator
-p 80:8080 -e ORCHESTRATOR_URL="<public_orchestrator_url, like http://localhost:80>" -d indigodatacloud/orchestrator
```

### With external databases

The orchestrator can also be run using already deployed DBs; you just need to start it with the command
The Orchestrator can also be run using already deployed DBs; you just need to start it with the command
```
sudo docker run --name orchestrator1 -h orchestrator1 -e ORCHESTRATOR_DB_ENDPOINT=DOMAIN_NAME:PORT \
-e ORCHESTRATOR_DB_NAME=SCHEMA_NAME -e ORCHESTRATOR_DB_USER=DB_USER -e ORCHESTRATOR_DB_PWD=DB_USER_PASSWORD \
Expand All @@ -89,7 +91,7 @@ using as parameters (`DOMAIN_NAME`, `PORT`, `SCHEMA_NAME`, `DB_USER`, `DB_USER_P

1.4 CONFIGURING
--------------
Besides those used to link the orchestrator to the DBs, there are other environment variables that can be set in order to configure the orchestrator behaviour.
Besides those used to link the Orchestrator to the database, there are other environment variables that can be set in order to configure the Orchestrator behaviour.

### Configure security
1. `SECURITY_ENABLE`: if set to `true` enable AAI OAuth2 authentication and authorization
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ ENV ORCHESTRATOR_DB_ENDPOINT="databaseorchestrator:3306" \
ORCHESTRATOR_DB_NAME=orchestrator \
ORCHESTRATOR_DB_USER=root \
ORCHESTRATOR_DB_PWD=root \
ORCHESTRATOR_URL="" \
WORKFLOW_DB_ENDPOINT="databaseworkflow:3306" \
WORKFLOW_DB_NAME=workflow \
WORKFLOW_DB_USER=root \
WORKFLOW_DB_PWD=root
WORKFLOW_DB_PWD=root

ENV IM_URL="" \
PROXY_DIR="" \
Expand Down
1 change: 1 addition & 0 deletions docker/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ java -jar /usr/share/java/saxon.jar -o:$JBOSS_HOME/standalone/configuration/$JBO
orchestrator.DB.name=$ORCHESTRATOR_DB_NAME \
orchestrator.DB.user=$ORCHESTRATOR_DB_USER \
orchestrator.DB.pwd=$ORCHESTRATOR_DB_PWD \
orchestrator.url=$ORCHESTRATOR_URL \
workflow.DB.endpoint=$WORKFLOW_DB_ENDPOINT \
workflow.DB.name=$WORKFLOW_DB_NAME \
workflow.DB.user=$WORKFLOW_DB_USER \
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<jsonpath.version>2.1.0</jsonpath.version>
<snippetsDirectory>${project.build.directory}\generated-snippets</snippetsDirectory>
<checkstyle-plugin.version>2.17</checkstyle-plugin.version>
<workflow-manager.version>0.0.3-SNAPSHOT</workflow-manager.version>
<alien4cloud.version>1.1.0-INDIGO2-SNAPSHOT</alien4cloud.version>
<chronos-client.version>0.0.1-SNAPSHOT</chronos-client.version>
<workflow-manager.version>0.0.3-FINAL</workflow-manager.version>
<alien4cloud.version>1.1.0-INDIGO2-ALPHA.1</alien4cloud.version>
<chronos-client.version>0.0.1-BETA.1</chronos-client.version>
</properties>

<distributionManagement>
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/it/reply/orchestrator/dal/entity/Deployment.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.reply.orchestrator.dal.entity;

import it.reply.orchestrator.dto.CloudProviderEndpoint;
import it.reply.orchestrator.enums.DeploymentProvider;
import it.reply.orchestrator.enums.Status;
import it.reply.orchestrator.enums.Task;
Expand Down Expand Up @@ -52,6 +53,9 @@ public class Deployment extends AbstractResourceEntity {
@Column(name = "template", columnDefinition = "LONGTEXT")
private String template;

@Column(name = "cloudProviderEndpoint", columnDefinition = "TEXT")
private String cloudProviderEndpoint;

/**
* The user's inputs to the template.
*/
Expand Down Expand Up @@ -192,6 +196,38 @@ public synchronized void setParameters(Map<String, Object> parameters) {
this.unserializedParameters = null;
}

/**
*
* @return .
*/
public synchronized CloudProviderEndpoint getCloudProviderEndpoint() {

CloudProviderEndpoint cpe = null;

if (cloudProviderEndpoint != null) {
try {
cpe = JsonUtility.deserializeJson(cloudProviderEndpoint, CloudProviderEndpoint.class);
} catch (IOException ex) {
throw new RuntimeException("Failed to deserialize CloudProviderEndpoint in JSON", ex);
}
}
return cpe;
}

/**
* .
*
*/
public synchronized void setCloudProviderEndpoint(CloudProviderEndpoint cpe) {
if (cpe != null) {
try {
cloudProviderEndpoint = JsonUtility.serializeJson(cpe);
} catch (IOException ex) {
throw new RuntimeException("Failed to serialize CloudProviderEndpoint in JSON", ex);
}
}
}

public Map<String, String> getOutputs() {
return outputs;
}
Expand Down
27 changes: 25 additions & 2 deletions src/main/java/it/reply/orchestrator/dto/CloudProvider.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package it.reply.orchestrator.dto;

import it.reply.orchestrator.dto.cmdb.Image;
import it.reply.orchestrator.dto.cmdb.Provider;
import it.reply.orchestrator.dto.cmdb.Service;
import it.reply.orchestrator.dto.cmdb.Type;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
Expand All @@ -24,6 +27,7 @@ public class CloudProvider implements Serializable {

private Provider cmdbProviderData;
private Map<String, Service> cmdbProviderServices = new HashMap<>();
private List<Image> cmdbProviderImages = new ArrayList<>();

public CloudProvider() {
}
Expand Down Expand Up @@ -64,9 +68,28 @@ public void setCmdbProviderServices(Map<String, Service> cmdbProviderServices) {
this.cmdbProviderServices = cmdbProviderServices;
}

public List<Image> getCmdbProviderImages() {
return cmdbProviderImages;
}

public void setCmdbProviderImages(List<Image> cmdbProviderImages) {
this.cmdbProviderImages = cmdbProviderImages;
}

/**
* Look for a Service in the current Provider of the given Type.
*
* @param type
* the type.
* @return the Service if found, <tt>null</tt> otherwise.
*/
public Service getCmbdProviderServiceByType(Type type) {
// FIXME implement getCmbdProviderServiceByType
throw new UnsupportedOperationException("NOT IMPLEMENTED");
for (Service service : cmdbProviderServices.values()) {
if (service.getData().getType().equals(type)) {
return service;
}
}
return null;
}

}
55 changes: 55 additions & 0 deletions src/main/java/it/reply/orchestrator/dto/CloudProviderEndpoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package it.reply.orchestrator.dto;

import java.io.Serializable;

/**
* This class holds information to connect (and authenticate) to a CloudProvider.
*
* @author l.biava
*
*/
public class CloudProviderEndpoint implements Serializable {

private static final long serialVersionUID = -2585914648218602033L;

public enum IaaSType {
// @formatter:off
OPENSTACK, OPENNEBULA
// @formatter:on
}

private String imEndpoint;
private String cpEndpoint;
private IaaSType iaasType;

public String getImEndpoint() {
return imEndpoint;
}

public void setImEndpoint(String imEndpoint) {
this.imEndpoint = imEndpoint;
}

public String getCpEndpoint() {
return cpEndpoint;
}

public void setCpEndpoint(String cpEndpoint) {
this.cpEndpoint = cpEndpoint;
}

public IaaSType getIaasType() {
return iaasType;
}

public void setIaasType(IaaSType iaasType) {
this.iaasType = iaasType;
}

@Override
public String toString() {
return "CloudProviderEndpoint [imEndpoint=" + imEndpoint + ", cpEndpoint=" + cpEndpoint
+ ", iaasType=" + iaasType + "]";
}

}
120 changes: 120 additions & 0 deletions src/main/java/it/reply/orchestrator/dto/cmdb/CmdbHasManyList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package it.reply.orchestrator.dto.cmdb;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Generated;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({ "total_rows", "offset", "rows" })
public class CmdbHasManyList<ROWT> {

@JsonProperty("total_rows")
private Long totalRows;
@JsonProperty("offset")
private Long offset;
@JsonProperty("rows")
private List<ROWT> rows = new ArrayList<>();
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

@JsonProperty("total_rows")
public Long getTotalRows() {
return totalRows;
}

@JsonProperty("total_rows")
public void setTotalRows(Long totalRows) {
this.totalRows = totalRows;
}

public CmdbHasManyList<ROWT> withTotalRows(Long totalRows) {
this.totalRows = totalRows;
return this;
}

@JsonProperty("offset")
public Long getOffset() {
return offset;
}

@JsonProperty("offset")
public void setOffset(Long offset) {
this.offset = offset;
}

public CmdbHasManyList<ROWT> withOffset(Long offset) {
this.offset = offset;
return this;
}

@JsonProperty("rows")
public List<ROWT> getRows() {
return rows;
}

@JsonProperty("rows")
public void setRows(List<ROWT> rows) {
this.rows = rows;
}

public CmdbHasManyList<ROWT> withRows(List<ROWT> rows) {
this.rows = rows;
return this;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

public CmdbHasManyList<ROWT> withAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
return this;
}

@Override
public int hashCode() {
return new HashCodeBuilder().append(totalRows).append(offset).append(rows)
.append(additionalProperties).toHashCode();
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof CmdbHasManyList<?>) == false) {
return false;
}
@SuppressWarnings("unchecked")
CmdbHasManyList<ROWT> rhs = ((CmdbHasManyList<ROWT>) other);
return new EqualsBuilder().append(totalRows, rhs.totalRows).append(offset, rhs.offset)
.append(rows, rhs.rows).append(additionalProperties, rhs.additionalProperties).isEquals();
}

}
Loading