-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: conversion hooks integration tests (#25)
- Loading branch information
Showing
39 changed files
with
738 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.javaoperatorsdk</groupId> | ||
<artifactId>admission-controller-framework-samples</artifactId> | ||
<version>0.2.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>io.javaoperatorsdk.admissioncontroller.sample</groupId> | ||
<artifactId>sample-commons</artifactId> | ||
<name>Admission Controller Framework - Samples - Commons</name> | ||
|
||
<properties> | ||
<java.version>11</java.version> | ||
<spring-boot-dependencies.version>2.6.6</spring-boot-dependencies.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.javaoperatorsdk</groupId> | ||
<artifactId>admission-controller-framework-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>crd-generator-apt</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${spring-boot-dependencies.version}</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
.../io/javaoperatorsdk/webhook/sample/commons/customresource/MultiVersionCustomResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.customresource; | ||
|
||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.Kind; | ||
import io.fabric8.kubernetes.model.annotation.ShortNames; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
|
||
@Group("sample.javaoperatorsdk") | ||
@Version(value = "v1", storage = false) | ||
@Kind("MultiVersionCustomResource") | ||
@ShortNames("tcr") | ||
public class MultiVersionCustomResource | ||
extends CustomResource<MultiVersionCustomResourceSpec, MultiVersionCustomResourceStatus> { | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...javaoperatorsdk/webhook/sample/commons/customresource/MultiVersionCustomResourceSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.customresource; | ||
|
||
public class MultiVersionCustomResourceSpec { | ||
|
||
private int value; | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public MultiVersionCustomResourceSpec setValue(int value) { | ||
this.value = value; | ||
return this; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...vaoperatorsdk/webhook/sample/commons/customresource/MultiVersionCustomResourceSpecV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.customresource; | ||
|
||
public class MultiVersionCustomResourceSpecV2 { | ||
|
||
private String value; | ||
|
||
private String additionalValue; | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public MultiVersionCustomResourceSpecV2 setValue(String value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public String getAdditionalValue() { | ||
return additionalValue; | ||
} | ||
|
||
public void setAdditionalValue(String additionalValue) { | ||
this.additionalValue = additionalValue; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...vaoperatorsdk/webhook/sample/commons/customresource/MultiVersionCustomResourceStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.customresource; | ||
|
||
public class MultiVersionCustomResourceStatus { | ||
|
||
private Boolean ready; | ||
|
||
public Boolean getReady() { | ||
return ready; | ||
} | ||
|
||
public MultiVersionCustomResourceStatus setReady(Boolean ready) { | ||
this.ready = ready; | ||
return this; | ||
} | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
...operatorsdk/webhook/sample/commons/customresource/MultiVersionCustomResourceStatusV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.customresource; | ||
|
||
|
||
public class MultiVersionCustomResourceStatusV2 { | ||
|
||
private Boolean ready; | ||
|
||
private String message; | ||
|
||
public Boolean getReady() { | ||
return ready; | ||
} | ||
|
||
public MultiVersionCustomResourceStatusV2 setReady(Boolean ready) { | ||
this.ready = ready; | ||
return this; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public MultiVersionCustomResourceStatusV2 setMessage(String message) { | ||
this.message = message; | ||
return this; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...o/javaoperatorsdk/webhook/sample/commons/customresource/MultiVersionCustomResourceV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.customresource; | ||
|
||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.Kind; | ||
import io.fabric8.kubernetes.model.annotation.ShortNames; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
|
||
@Group("sample.javaoperatorsdk") | ||
@Version(value = "v2") | ||
@Kind("MultiVersionCustomResource") | ||
@ShortNames("tcr") | ||
public class MultiVersionCustomResourceV2 | ||
extends CustomResource<MultiVersionCustomResourceSpecV2, MultiVersionCustomResourceStatusV2> { | ||
} |
27 changes: 27 additions & 0 deletions
27
...commons/src/main/java/io/javaoperatorsdk/webhook/sample/commons/mapper/AsyncV1Mapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.mapper; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.CompletionStage; | ||
|
||
import io.javaoperatorsdk.webhook.conversion.AsyncMapper; | ||
import io.javaoperatorsdk.webhook.conversion.TargetVersion; | ||
import io.javaoperatorsdk.webhook.sample.commons.customresource.MultiVersionCustomResource; | ||
import io.javaoperatorsdk.webhook.sample.commons.customresource.MultiVersionCustomResourceV2; | ||
|
||
@TargetVersion("v1") | ||
public class AsyncV1Mapper | ||
implements AsyncMapper<MultiVersionCustomResource, MultiVersionCustomResourceV2> { | ||
|
||
private V1Mapper mapper = new V1Mapper(); | ||
|
||
@Override | ||
public CompletionStage<MultiVersionCustomResourceV2> toHub(MultiVersionCustomResource resource) { | ||
return CompletableFuture.completedStage(mapper.toHub(resource)); | ||
} | ||
|
||
@Override | ||
public CompletionStage<MultiVersionCustomResource> fromHub( | ||
MultiVersionCustomResourceV2 testCustomResourceV2) { | ||
return CompletableFuture.completedStage(mapper.fromHub(testCustomResourceV2)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...commons/src/main/java/io/javaoperatorsdk/webhook/sample/commons/mapper/AsyncV2Mapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.javaoperatorsdk.webhook.sample.commons.mapper; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.CompletionStage; | ||
|
||
import io.javaoperatorsdk.webhook.conversion.AsyncMapper; | ||
import io.javaoperatorsdk.webhook.conversion.TargetVersion; | ||
import io.javaoperatorsdk.webhook.sample.commons.customresource.MultiVersionCustomResourceV2; | ||
|
||
@TargetVersion("v2") | ||
public class AsyncV2Mapper | ||
implements AsyncMapper<MultiVersionCustomResourceV2, MultiVersionCustomResourceV2> { | ||
|
||
private V2Mapper mapper = new V2Mapper(); | ||
|
||
@Override | ||
public CompletionStage<MultiVersionCustomResourceV2> toHub( | ||
MultiVersionCustomResourceV2 resource) { | ||
return CompletableFuture.completedStage(mapper.toHub(resource)); | ||
} | ||
|
||
@Override | ||
public CompletionStage<MultiVersionCustomResourceV2> fromHub( | ||
MultiVersionCustomResourceV2 multiVersionCustomResourceV2) { | ||
return CompletableFuture.completedStage(mapper.fromHub(multiVersionCustomResourceV2)); | ||
} | ||
} |
Oops, something went wrong.