Skip to content

Commit

Permalink
chore: bump sundrio to 0.50.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Sep 2, 2021
1 parent 61e8262 commit 21d68b4
Show file tree
Hide file tree
Showing 215 changed files with 872 additions and 805 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#### Bugs
#### Improvements
#### Dependency Upgrade
* Upgrade Sundrio to 0.50.1
#### New Features
#### _**Note**_: Breaking changes in the API

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,28 @@
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.Quantity;
import io.sundr.builder.internal.functions.TypeAs;
import io.sundr.codegen.functions.ClassTo;
import io.sundr.model.*;
import io.sundr.utils.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;

import static io.sundr.model.utils.Types.BOOLEAN;
import static io.sundr.model.utils.Types.BOOLEAN_REF;

import static io.sundr.model.utils.Types.STRING;
import static io.sundr.model.utils.Types.STRING_REF;

import static io.sundr.model.utils.Types.INT;
import static io.sundr.model.utils.Types.INT_REF;

import static io.sundr.model.utils.Types.LONG;
import static io.sundr.model.utils.Types.LONG_REF;

import static io.sundr.model.utils.Types.DOUBLE;
import static io.sundr.model.utils.Types.DOUBLE_REF;

/**
* Encapsulates the common logic supporting OpenAPI schema generation for CRD generation.
*
Expand All @@ -40,27 +54,16 @@ public abstract class AbstractJsonSchema<T, B> {

private static final Logger LOGGER = LoggerFactory.getLogger(AbstractJsonSchema.class);

protected static final TypeDef QUANTITY = ClassTo.TYPEDEF.apply(Quantity.class);
protected static final TypeDef DURATION = ClassTo.TYPEDEF.apply(Duration.class);
protected static final TypeDef INT_OR_STRING = ClassTo.TYPEDEF.apply(IntOrString.class);

protected static final TypeDef QUANTITY = TypeDef.forName(Quantity.class.getName());
protected static final TypeDef DURATION = TypeDef.forName(Duration.class.getName());
protected static final TypeDef INT_OR_STRING =TypeDef.forName(IntOrString.class.getName());

protected static final TypeDef BOOLEAN = ClassTo.TYPEDEF.apply(Boolean.class);
protected static final TypeDef STRING = ClassTo.TYPEDEF.apply(String.class);
protected static final TypeDef INT = ClassTo.TYPEDEF.apply(Integer.class);
protected static final TypeDef LONG = ClassTo.TYPEDEF.apply(Long.class);
protected static final TypeDef DOUBLE = ClassTo.TYPEDEF.apply(Double.class);
protected static final TypeDef DATE = ClassTo.TYPEDEF.apply(Date.class);
protected static final TypeRef QUANTITY_REF = QUANTITY.toReference();
protected static final TypeRef DURATION_REF = DURATION.toReference();
protected static final TypeRef INT_OR_STRING_REF = INT_OR_STRING.toReference();


protected static final TypeRef BOOLEAN_REF = BOOLEAN.toReference();
protected static final TypeRef STRING_REF = STRING.toReference();
protected static final TypeRef INT_REF = INT.toReference();
protected static final TypeRef LONG_REF = LONG.toReference();
protected static final TypeRef DOUBLE_REF = DOUBLE.toReference();
protected static final TypeDef DATE = TypeDef.forName(Date.class.getName());
protected static final TypeRef DATE_REF = DATE.toReference();

private static final String INT_OR_STRING_MARKER = "int_or_string";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import io.fabric8.kubernetes.api.model.Namespaced;
import io.fabric8.kubernetes.client.CustomResource;
import io.sundr.adapter.api.AdapterContext;
import io.sundr.adapter.api.Adapters;
import io.sundr.adapter.reflect.ReflectionContext;
import io.sundr.builder.TypedVisitor;
import io.sundr.model.ClassRef;
import io.sundr.model.ClassRefBuilder;
Expand Down Expand Up @@ -56,11 +56,10 @@ private Types() {
private static final Logger LOGGER = LoggerFactory.getLogger(Types.class);
private static final String NAMESPACED = Namespaced.class.getName();
public static final String JAVA_LANG_VOID = "java.lang.Void";
public static final ReflectionContext REFLECTION_CONTEXT = new ReflectionContext(DefinitionRepository.getRepository());

public static final AdapterContext REFLECTION_CONTEXT = AdapterContext.create(DefinitionRepository.getRepository());

public static TypeDef typeDefFrom(Class<?> clazz) {
return unshallow(Adapters.adapt(clazz, REFLECTION_CONTEXT));
return unshallow(Adapters.adaptType(clazz, REFLECTION_CONTEXT));
}

public static TypeDef unshallow(TypeDef definition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@

import io.fabric8.crd.example.webserver.WebServerWithSpec;
import io.fabric8.crd.example.webserver.WebServerWithStatusProperty;
import io.sundr.codegen.functions.ClassTo;
import io.sundr.adapter.api.AdapterContext;
import io.sundr.adapter.api.Adapters;
import io.sundr.model.TypeDef;
import io.sundr.model.TypeDefBuilder;
import io.sundr.model.repo.DefinitionRepository;

import org.junit.jupiter.api.Test;

class SpecReplicasPathDetectorTest {

public static final AdapterContext CONTEXT = AdapterContext.create(DefinitionRepository.getRepository());

@Test
public void shoudDetectSpecReplicasPath() throws Exception {
TypeDef def = ClassTo.TYPEDEF.apply(WebServerWithStatusProperty.class);
TypeDef def = Adapters.adaptType(WebServerWithStatusProperty.class, CONTEXT);
SpecReplicasPathDetector detector = new SpecReplicasPathDetector();
def = new TypeDefBuilder(def).accept(detector).build();
assertTrue(detector.getPath().isPresent());
Expand All @@ -39,7 +44,7 @@ public void shoudDetectSpecReplicasPath() throws Exception {

@Test
public void shoudDetectNestedSpecReplicasPath() throws Exception {
TypeDef def = ClassTo.TYPEDEF.apply(WebServerWithSpec.class);
TypeDef def = Adapters.adaptType(WebServerWithSpec.class, CONTEXT);
SpecReplicasPathDetector detector = new SpecReplicasPathDetector();
def = new TypeDefBuilder(def).accept(detector).build();
assertTrue(detector.getPath().isPresent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import io.fabric8.kubernetes.model.annotation.*;
import io.sundr.adapter.api.Adapters;
import io.sundr.adapter.apt.AptContext;
import io.sundr.codegen.CodegenContext;
import io.sundr.model.TypeDef;
import io.sundr.model.repo.DefinitionRepository;

Expand Down Expand Up @@ -62,7 +61,6 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment

// make sure we create the context before using it
AptContext.create(processingEnv.getElementUtils(), processingEnv.getTypeUtils(), DefinitionRepository.getRepository());
CodegenContext.create(processingEnv.getElementUtils(), processingEnv.getTypeUtils());

//Collect all annotated types.
for (TypeElement annotation : annotations) {
Expand All @@ -77,7 +75,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
}

private CustomResourceInfo toCustomResourceInfo(TypeElement customResource) {
TypeDef definition = Adapters.adapt(customResource, AptContext.getContext());
TypeDef definition = Adapters.adaptType(customResource, AptContext.getContext());
definition = Types.unshallow(definition);

if (CustomResourceInfo.DESCRIBE_TYPE_DEFS) {
Expand Down
4 changes: 4 additions & 0 deletions extensions/camel-k/model-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/camel-k/model-v1alpha1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/certmanager/model-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/certmanager/model-v1alpha2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/certmanager/model-v1alpha3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/certmanager/model-v1beta1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/chaosmesh/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/knative/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<dependency>
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/service-catalog/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/tekton/model-triggers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/tekton/model-v1alpha1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/tekton/model-v1beta1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions extensions/volumesnapshot/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>sundr-codegen-velocity-nodeps</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -52,6 +51,8 @@
*/
public class OpenIDConnectionUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(OpenIDConnectionUtils.class);

public static final String EMPTY = "";
public static final String ID_TOKEN_KUBECONFIG = "id-token";
public static final String ISSUER_KUBECONFIG = "idp-issuer-url";
public static final String REFRESH_TOKEN_KUBECONFIG = "refresh-token";
Expand Down Expand Up @@ -240,7 +241,7 @@ static String getParametersFromDiscoveryResponse(Map<String, Object> responseAsJ
} else {
LOGGER.warn("oidc: oidc: discovery object doesn't contain a {}", key);
}
return StringUtils.EMPTY;
return EMPTY;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.fabric8.kubernetes.client.utils.Utils;
import okhttp3.OkHttpClient;
import okhttp3.TlsVersion;
import org.apache.commons.lang.SystemUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import io.fabric8.kubernetes.model.annotation.Version;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import io.sundr.transform.annotations.VelocityTransformation;
import io.sundr.transform.annotations.VelocityTransformations;
import io.sundr.transform.annotations.TemplateTransformation;
import io.sundr.transform.annotations.TemplateTransformations;
import lombok.EqualsAndHashCode;
import lombok.ToString;

Expand All @@ -53,8 +53,8 @@
})
@Version("v1")
@Group("admissionregistration.k8s.io")
@VelocityTransformations({
@VelocityTransformation(value = "/manifest.vm", outputPath = "admissionregistration.properties", gather = true)
@TemplateTransformations({
@TemplateTransformation(value = "/manifest.vm", outputPath = "admissionregistration.properties", gather = true)
})
public class MutatingWebhookConfiguration implements HasMetadata
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import io.fabric8.kubernetes.model.annotation.Version;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import io.sundr.transform.annotations.VelocityTransformation;
import io.sundr.transform.annotations.VelocityTransformations;
import io.sundr.transform.annotations.TemplateTransformation;
import io.sundr.transform.annotations.TemplateTransformations;
import lombok.EqualsAndHashCode;
import lombok.ToString;

Expand All @@ -53,8 +53,8 @@
})
@Version("v1")
@Group("admissionregistration.k8s.io")
@VelocityTransformations({
@VelocityTransformation(value = "/manifest.vm", outputPath = "admissionregistration.properties", gather = true)
@TemplateTransformations({
@TemplateTransformation(value = "/manifest.vm", outputPath = "admissionregistration.properties", gather = true)
})
public class ValidatingWebhookConfiguration implements HasMetadata
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import io.fabric8.kubernetes.model.annotation.Version;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import io.sundr.transform.annotations.VelocityTransformation;
import io.sundr.transform.annotations.VelocityTransformations;
import io.sundr.transform.annotations.TemplateTransformation;
import io.sundr.transform.annotations.TemplateTransformations;
import lombok.EqualsAndHashCode;
import lombok.ToString;

Expand All @@ -53,8 +53,8 @@
})
@Version("v1beta1")
@Group("admissionregistration.k8s.io")
@VelocityTransformations({
@VelocityTransformation(value = "/manifest.vm", outputPath = "admissionregistration.properties", gather = true)
@TemplateTransformations({
@TemplateTransformation(value = "/manifest.vm", outputPath = "admissionregistration.properties", gather = true)
})
public class MutatingWebhookConfiguration implements HasMetadata
{
Expand Down
Loading

0 comments on commit 21d68b4

Please sign in to comment.