Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Moved to pre-build tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
jordigilh authored and openshift-merge-robot committed Jul 27, 2023
1 parent e767232 commit 3299079
Show file tree
Hide file tree
Showing 73 changed files with 581 additions and 626 deletions.
5 changes: 5 additions & 0 deletions prebuilt-tasks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@
<version>${fabric8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>generator-annotations</artifactId>
<version>${fabric8.version}</version>
</dependency>

<!-- This specific version is needed for openshift server mock -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.redhat.parodos.examples.vmmigration;
package com.redhat.parodos.vmmigration;

import java.util.List;

import com.redhat.parodos.examples.vmmigration.assessment.VmMigrationWorkFlowTask;
import com.redhat.parodos.examples.vmmigration.checker.MigrationStatusWorkFlowChecker;
import com.redhat.parodos.examples.vmmigration.checker.PlanStatusWorkFlowChecker;
import com.redhat.parodos.examples.vmmigration.constants.Constants;
import com.redhat.parodos.examples.vmmigration.task.CreateMigrationWorkFlowTask;
import com.redhat.parodos.vmmigration.assessment.VmMigrationWorkFlowTask;
import com.redhat.parodos.vmmigration.checker.MigrationStatusWorkFlowChecker;
import com.redhat.parodos.vmmigration.checker.PlanStatusWorkFlowChecker;
import com.redhat.parodos.vmmigration.constants.Constants;
import com.redhat.parodos.vmmigration.task.CreateMigrationWorkFlowTask;
import com.redhat.parodos.workflow.annotation.Assessment;
import com.redhat.parodos.workflow.annotation.Checker;
import com.redhat.parodos.workflow.annotation.Infrastructure;
Expand All @@ -20,10 +20,8 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource("classpath:git.properties")
public class VmMigrationWorkFlowConfiguration {

// Assessment workflow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.redhat.parodos.examples.vmmigration.assessment;
package com.redhat.parodos.vmmigration.assessment;

import java.util.List;

import com.redhat.parodos.examples.vmmigration.constants.Constants;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.Plan;
import com.redhat.parodos.examples.vmmigration.util.Kubernetes;
import com.redhat.parodos.vmmigration.constants.Constants;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.Plan;
import com.redhat.parodos.vmmigration.util.Kubernetes;
import com.redhat.parodos.workflow.context.WorkContextDelegate;
import com.redhat.parodos.workflow.exception.MissingParameterException;
import com.redhat.parodos.workflow.option.WorkFlowOption;
Expand Down Expand Up @@ -55,7 +55,6 @@ public WorkReport execute(WorkContext workContext) {
String caCert = getOptionalParameterValue(Constants.KUBERNETES_CA_CERT_PARAMETER_NAME, "");
String vmName = getRequiredParameterValue(Constants.VM_NAME_PARAMETER_NAME);

Config config = Kubernetes.buildKubernetesClient(apiUrl, token, caCert);
try (KubernetesClient client = getKubernetesClient(apiUrl, token, caCert)) {
// Create forklift plan
Plan plan = Kubernetes.createPlan(vmName, storageName, networkName, namespaceName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.redhat.parodos.examples.vmmigration.checker;
package com.redhat.parodos.vmmigration.checker;

import java.util.List;

import com.redhat.parodos.examples.vmmigration.constants.Constants;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.Migration;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.MigrationStatus;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions;
import com.redhat.parodos.examples.vmmigration.util.Kubernetes;
import com.redhat.parodos.vmmigration.constants.Constants;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.Migration;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.MigrationStatus;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions;
import com.redhat.parodos.vmmigration.util.Kubernetes;
import com.redhat.parodos.workflow.exception.MissingParameterException;
import com.redhat.parodos.workflow.task.checker.BaseWorkFlowCheckerTask;
import com.redhat.parodos.workflows.work.DefaultWorkReport;
Expand Down Expand Up @@ -34,7 +34,7 @@ public WorkReport checkWorkFlowStatus(WorkContext workContext) {
String token = getRequiredParameterValue(Constants.KUBERNETES_TOKEN_PARAMETER_NAME);
String caCert = getOptionalParameterValue(Constants.KUBERNETES_CA_CERT_PARAMETER_NAME, "");

try (KubernetesClient client = getKubernetesClient(apiUrl, token, caCert)) {
try (KubernetesClient client = getKubernetesClient(apiUrl, token, caCert)) {

MixedOperation<Migration, KubernetesResourceList<Migration>, Resource<Migration>> migrationClient = client
.resources(Migration.class);
Expand All @@ -58,8 +58,9 @@ public WorkReport checkWorkFlowStatus(WorkContext workContext) {
return new DefaultWorkReport(WorkStatus.FAILED, workContext);
}

public KubernetesClient getKubernetesClient(String apiUrl, String token, String caCert) {
public KubernetesClient getKubernetesClient(String apiUrl, String token, String caCert) {
Config config = Kubernetes.buildKubernetesClient(apiUrl, token, caCert);
return new KubernetesClientBuilder().withConfig(config).build();
}

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.redhat.parodos.examples.vmmigration.checker;
package com.redhat.parodos.vmmigration.checker;

import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;

import com.redhat.parodos.examples.vmmigration.constants.Constants;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.Plan;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.PlanStatus;
import com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planstatus.Conditions;
import com.redhat.parodos.examples.vmmigration.util.Kubernetes;
import com.redhat.parodos.vmmigration.constants.Constants;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.Plan;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.PlanStatus;
import com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planstatus.Conditions;
import com.redhat.parodos.vmmigration.util.Kubernetes;
import com.redhat.parodos.workflow.exception.MissingParameterException;
import com.redhat.parodos.workflow.task.checker.BaseWorkFlowCheckerTask;
import com.redhat.parodos.workflows.work.DefaultWorkReport;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redhat.parodos.examples.vmmigration.constants;
package com.redhat.parodos.vmmigration.constants;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1;
package com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1;

@io.fabric8.kubernetes.model.annotation.Version(value = "v1beta1", storage = true, served = true)
@io.fabric8.kubernetes.model.annotation.Group("forklift.konveyor.io")
@io.fabric8.kubernetes.model.annotation.Singular("migration")
@io.fabric8.kubernetes.model.annotation.Plural("migrations")
@javax.annotation.processing.Generated("io.fabric8.java.generator.CRGeneratorRunner")
public class Migration extends
io.fabric8.kubernetes.client.CustomResource<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.MigrationSpec, com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.MigrationStatus>
io.fabric8.kubernetes.client.CustomResource<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.MigrationSpec, com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.MigrationStatus>
implements io.fabric8.kubernetes.api.model.Namespaced {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1;
package com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1;

@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
@com.fasterxml.jackson.annotation.JsonPropertyOrder({ "cancel", "cutover", "plan" })
Expand All @@ -13,14 +13,14 @@ public class MigrationSpec implements io.fabric8.kubernetes.api.model.Kubernetes
@com.fasterxml.jackson.annotation.JsonProperty("cancel")
@com.fasterxml.jackson.annotation.JsonPropertyDescription("List of VMs which will have their imports canceled.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Cancel> cancel;
private java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Cancel> cancel;

public java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Cancel> getCancel() {
public java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Cancel> getCancel() {
return cancel;
}

public void setCancel(
java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Cancel> cancel) {
java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Cancel> cancel) {
this.cancel = cancel;
}

Expand Down Expand Up @@ -48,14 +48,13 @@ public void setCutover(String cutover) {
@io.fabric8.generator.annotation.Required()
@com.fasterxml.jackson.annotation.JsonPropertyDescription("Reference to the associated Plan.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Plan plan;
private com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Plan plan;

public com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Plan getPlan() {
public com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Plan getPlan() {
return plan;
}

public void setPlan(
com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Plan plan) {
public void setPlan(com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationspec.Plan plan) {
this.plan = plan;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1;
package com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1;

@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
@com.fasterxml.jackson.annotation.JsonPropertyOrder({ "completed", "conditions", "observedGeneration", "started",
Expand Down Expand Up @@ -30,14 +30,14 @@ public void setCompleted(String completed) {
@com.fasterxml.jackson.annotation.JsonProperty("conditions")
@com.fasterxml.jackson.annotation.JsonPropertyDescription("List of conditions.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions> conditions;
private java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions> conditions;

public java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions> getConditions() {
public java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions> getConditions() {
return conditions;
}

public void setConditions(
java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions> conditions) {
java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Conditions> conditions) {
this.conditions = conditions;
}

Expand Down Expand Up @@ -79,14 +79,14 @@ public void setStarted(String started) {
@com.fasterxml.jackson.annotation.JsonProperty("vms")
@com.fasterxml.jackson.annotation.JsonPropertyDescription("VM status")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Vms> vms;
private java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Vms> vms;

public java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Vms> getVms() {
public java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Vms> getVms() {
return vms;
}

public void setVms(
java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Vms> vms) {
java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.migrationstatus.Vms> vms) {
this.vms = vms;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1;
package com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1;

@io.fabric8.kubernetes.model.annotation.Version(value = "v1beta1", storage = true, served = true)
@io.fabric8.kubernetes.model.annotation.Group("forklift.konveyor.io")
@io.fabric8.kubernetes.model.annotation.Singular("plan")
@io.fabric8.kubernetes.model.annotation.Plural("plans")
@javax.annotation.processing.Generated("io.fabric8.java.generator.CRGeneratorRunner")
public class Plan extends
io.fabric8.kubernetes.client.CustomResource<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.PlanSpec, com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.PlanStatus>
io.fabric8.kubernetes.client.CustomResource<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.PlanSpec, com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.PlanStatus>
implements io.fabric8.kubernetes.api.model.Namespaced {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1;
package com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1;

@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
@com.fasterxml.jackson.annotation.JsonPropertyOrder({ "archived", "description", "map", "provider", "targetNamespace",
Expand Down Expand Up @@ -47,13 +47,13 @@ public void setDescription(String description) {
@io.fabric8.generator.annotation.Required()
@com.fasterxml.jackson.annotation.JsonPropertyDescription("Resource mapping.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Map map;
private com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Map map;

public com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Map getMap() {
public com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Map getMap() {
return map;
}

public void setMap(com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Map map) {
public void setMap(com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Map map) {
this.map = map;
}

Expand All @@ -64,14 +64,14 @@ public void setMap(com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forkl
@io.fabric8.generator.annotation.Required()
@com.fasterxml.jackson.annotation.JsonPropertyDescription("Providers.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Provider provider;
private com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Provider provider;

public com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Provider getProvider() {
public com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Provider getProvider() {
return provider;
}

public void setProvider(
com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Provider provider) {
com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Provider provider) {
this.provider = provider;
}

Expand All @@ -98,14 +98,14 @@ public void setTargetNamespace(String targetNamespace) {
@com.fasterxml.jackson.annotation.JsonProperty("transferNetwork")
@com.fasterxml.jackson.annotation.JsonPropertyDescription("The network attachment definition that should be used for disk transfer.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.TransferNetwork transferNetwork;
private com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.TransferNetwork transferNetwork;

public com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.TransferNetwork getTransferNetwork() {
public com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.TransferNetwork getTransferNetwork() {
return transferNetwork;
}

public void setTransferNetwork(
com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.TransferNetwork transferNetwork) {
com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.TransferNetwork transferNetwork) {
this.transferNetwork = transferNetwork;
}

Expand All @@ -116,14 +116,14 @@ public void setTransferNetwork(
@io.fabric8.generator.annotation.Required()
@com.fasterxml.jackson.annotation.JsonPropertyDescription("List of VMs.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Vms> vms;
private java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Vms> vms;

public java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Vms> getVms() {
public java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Vms> getVms() {
return vms;
}

public void setVms(
java.util.List<com.redhat.parodos.examples.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Vms> vms) {
java.util.List<com.redhat.parodos.vmmigration.dto.io.konveyor.forklift.v1beta1.planspec.Vms> vms) {
this.vms = vms;
}

Expand Down
Loading

0 comments on commit 3299079

Please sign in to comment.