diff --git a/builder/src/main/java/cz/xtf/builder/builders/BuildConfigBuilder.java b/builder/src/main/java/cz/xtf/builder/builders/BuildConfigBuilder.java index 2b15ca62..2bd2525d 100644 --- a/builder/src/main/java/cz/xtf/builder/builders/BuildConfigBuilder.java +++ b/builder/src/main/java/cz/xtf/builder/builders/BuildConfigBuilder.java @@ -19,13 +19,14 @@ import io.fabric8.kubernetes.api.model.Quantity; import io.fabric8.openshift.api.model.BinaryBuildSource; import io.fabric8.openshift.api.model.BuildConfig; -import io.fabric8.openshift.api.model.BuildConfigFluent.SpecNested; +import io.fabric8.openshift.api.model.BuildConfigFluent; +import io.fabric8.openshift.api.model.BuildConfigSpecFluent; import io.fabric8.openshift.api.model.BuildSourceBuilder; import io.fabric8.openshift.api.model.BuildTriggerPolicy; import io.fabric8.openshift.api.model.BuildTriggerPolicyBuilder; import io.fabric8.openshift.api.model.GitBuildSourceBuilder; import io.fabric8.openshift.api.model.ImageSourceBuilder; -import io.fabric8.openshift.api.model.ImageSourceFluent.FromNested; +import io.fabric8.openshift.api.model.ImageSourceFluent; import io.fabric8.openshift.api.model.SecretBuildSourceBuilder; public class BuildConfigBuilder extends AbstractBuilder implements ResourceLimitBuilder { @@ -183,7 +184,7 @@ public BuildConfig build() { if (imageSource != null) { final ImageSourceBuilder isb = new ImageSourceBuilder(); - FromNested from = isb.withNewFrom() + ImageSourceFluent.FromNested from = isb.withNewFrom() .withName(imageSource.getName()) .withKind(imageSource.getKind()); if (imageSource.getNamespace() != null) { @@ -200,7 +201,8 @@ public BuildConfig build() { .withMetadata(metadataBuilder().build()); // spec - final SpecNested spec = builder.withNewSpec(); + final BuildConfigFluent.SpecNested spec = builder + .withNewSpec(); // limits final List requests = computingResources.values().stream().filter(x -> x.getRequests() != null) @@ -208,7 +210,7 @@ public BuildConfig build() { final List limits = computingResources.values().stream().filter(x -> x.getLimits() != null) .collect(Collectors.toList()); if (!requests.isEmpty() || !limits.isEmpty()) { - io.fabric8.openshift.api.model.BuildConfigSpecFluent.ResourcesNested> resources = spec + BuildConfigSpecFluent.SpecNested>.ResourcesNested.SpecNested> resources = spec .withNewResources(); if (!requests.isEmpty()) { resources.withRequests( diff --git a/builder/src/main/java/cz/xtf/builder/builders/ImageStreamBuilder.java b/builder/src/main/java/cz/xtf/builder/builders/ImageStreamBuilder.java index 816b45d9..494c3a55 100644 --- a/builder/src/main/java/cz/xtf/builder/builders/ImageStreamBuilder.java +++ b/builder/src/main/java/cz/xtf/builder/builders/ImageStreamBuilder.java @@ -107,7 +107,7 @@ public ImageStreamBuilder addTag(String tag, String sourceUrl, boolean insecure, .withName(tag); if (StringUtils.isNotBlank(sourceUrl)) { - trb.withImportPolicy(new TagImportPolicy(insecure, SCHEDULED)); + trb.withImportPolicy(new TagImportPolicy("Legacy", insecure, SCHEDULED)); trb.withNewFrom() .withKind("DockerImage") diff --git a/builder/src/main/java/cz/xtf/builder/builders/RoleBindingBuilder.java b/builder/src/main/java/cz/xtf/builder/builders/RoleBindingBuilder.java index 5476ad07..ce2afc80 100644 --- a/builder/src/main/java/cz/xtf/builder/builders/RoleBindingBuilder.java +++ b/builder/src/main/java/cz/xtf/builder/builders/RoleBindingBuilder.java @@ -94,7 +94,7 @@ public RoleBindingBuilder roleRefNamespace(String roleRefNamespace) { @Override public RoleBinding build() { - RoleBindingFluent.SubjectsNested subject = new io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder() + RoleBindingFluent.SubjectsNested subject = new io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder() .withNewMetadata() .withName(this.getName()) .endMetadata() @@ -105,7 +105,7 @@ public RoleBinding build() { if (subjectNamespace != null && !subjectNamespace.isEmpty()) subject.withNamespace(subjectNamespace); - RoleBindingFluent.RoleRefNested roleRef = subject + RoleBindingFluent.RoleRefNested roleRef = subject .endSubject() .withNewRoleRef() .withKind(roleRefKind) diff --git a/builder/src/main/java/cz/xtf/builder/builders/pod/ConfigMapVolume.java b/builder/src/main/java/cz/xtf/builder/builders/pod/ConfigMapVolume.java index 9a9d28ef..e7e66829 100644 --- a/builder/src/main/java/cz/xtf/builder/builders/pod/ConfigMapVolume.java +++ b/builder/src/main/java/cz/xtf/builder/builders/pod/ConfigMapVolume.java @@ -24,7 +24,7 @@ public ConfigMapVolume(String name, String configMapName, String defaultMode) { @Override protected void addVolumeParameters(VolumeBuilder builder) { - VolumeFluent.ConfigMapNested cfm = builder.withNewConfigMap(); + VolumeFluent.ConfigMapNested cfm = builder.withNewConfigMap(); cfm.withName(configMapName); if (defaultMode != null) { int defaultModeIntVal = 0; diff --git a/builder/src/main/java/cz/xtf/builder/builders/pod/ContainerBuilder.java b/builder/src/main/java/cz/xtf/builder/builders/pod/ContainerBuilder.java index 6fc79a77..aeb57539 100644 --- a/builder/src/main/java/cz/xtf/builder/builders/pod/ContainerBuilder.java +++ b/builder/src/main/java/cz/xtf/builder/builders/pod/ContainerBuilder.java @@ -28,7 +28,7 @@ import cz.xtf.builder.builders.route.TransportProtocol; import io.fabric8.kubernetes.api.model.ConfigMapKeySelectorBuilder; import io.fabric8.kubernetes.api.model.Container; -import io.fabric8.kubernetes.api.model.ContainerFluent.ResourcesNested; +import io.fabric8.kubernetes.api.model.ContainerFluent; import io.fabric8.kubernetes.api.model.ContainerPortBuilder; import io.fabric8.kubernetes.api.model.EnvVar; import io.fabric8.kubernetes.api.model.EnvVarSource; @@ -251,7 +251,8 @@ public Container build() { final List limits = computingResources.values().stream().filter(x -> x.getLimits() != null) .collect(Collectors.toList()); if (!requests.isEmpty() || !limits.isEmpty()) { - ResourcesNested resources = builder.withNewResources(); + ContainerFluent.ResourcesNested resources = builder + .withNewResources(); if (!requests.isEmpty()) { resources.withRequests( requests.stream().collect(Collectors.toMap( diff --git a/builder/src/main/java/cz/xtf/builder/builders/pod/SecretVolume.java b/builder/src/main/java/cz/xtf/builder/builders/pod/SecretVolume.java index ddf9bffd..2dbbee2c 100644 --- a/builder/src/main/java/cz/xtf/builder/builders/pod/SecretVolume.java +++ b/builder/src/main/java/cz/xtf/builder/builders/pod/SecretVolume.java @@ -28,7 +28,7 @@ public String getSecretName() { @Override protected void addVolumeParameters(VolumeBuilder builder) { - final VolumeFluent.SecretNested volumeBuilderSecretNested = builder.withNewSecret() + final VolumeFluent.SecretNested volumeBuilderSecretNested = builder.withNewSecret() .withSecretName(getSecretName()); if (items != null) { diff --git a/core/src/main/java/cz/xtf/core/openshift/OpenShift.java b/core/src/main/java/cz/xtf/core/openshift/OpenShift.java index 40d4e3a2..d7929e7d 100644 --- a/core/src/main/java/cz/xtf/core/openshift/OpenShift.java +++ b/core/src/main/java/cz/xtf/core/openshift/OpenShift.java @@ -50,6 +50,7 @@ import io.fabric8.kubernetes.api.model.GenericKubernetesResourceList; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.KubernetesList; +import io.fabric8.kubernetes.api.model.KubernetesResourceList; import io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder; import io.fabric8.kubernetes.api.model.Node; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; @@ -72,9 +73,12 @@ import io.fabric8.kubernetes.api.model.rbac.Subject; import io.fabric8.kubernetes.api.model.rbac.SubjectBuilder; import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.KubernetesClientBuilder; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.LocalPortForward; import io.fabric8.kubernetes.client.dsl.LogWatch; +import io.fabric8.kubernetes.client.dsl.base.ResourceDefinitionContext; +import io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperationsImpl; import io.fabric8.openshift.api.model.Build; import io.fabric8.openshift.api.model.BuildConfig; import io.fabric8.openshift.api.model.BuildRequest; @@ -88,16 +92,17 @@ import io.fabric8.openshift.api.model.Route; import io.fabric8.openshift.api.model.RouteSpecBuilder; import io.fabric8.openshift.api.model.Template; +import io.fabric8.openshift.client.NamespacedOpenShiftClient; +import io.fabric8.openshift.client.NamespacedOpenShiftClientAdapter; import io.fabric8.openshift.client.OpenShiftConfig; import io.fabric8.openshift.client.OpenShiftConfigBuilder; import io.fabric8.openshift.client.ParameterValue; -import io.fabric8.openshift.client.impl.OpenShiftClientImpl; import lombok.extern.slf4j.Slf4j; import rx.Observable; import rx.observables.StringObservable; @Slf4j -public class OpenShift extends OpenShiftClientImpl { +public class OpenShift extends NamespacedOpenShiftClientAdapter { private static ServiceLoader crdContextProviderLoader; private static volatile String routeSuffix; @@ -187,7 +192,7 @@ private static OpenShift get(OpenShiftConfig openShiftConfig) { // check whether such a client already exists Optional optionalOpenShift = namespaceToOpenshiftClientMap .get(openShiftConfig.getNamespace()).stream() - .filter(oc -> isEqualOpenshiftConfig(openShiftConfig, oc.getConfiguration())) + .filter(oc -> isEqualOpenshiftConfig(openShiftConfig, (OpenShiftConfig) oc.getConfiguration())) .findFirst(); if (optionalOpenShift.isPresent()) { @@ -215,8 +220,9 @@ protected static synchronized ServiceLoader> HasMetadataOperationsImpl newHasMetadataOperation( + ResourceDefinitionContext rdContext, Class resourceType, Class listClass) { + return new HasMetadataOperationsImpl<>(this, rdContext, resourceType, listClass); + } } diff --git a/pom.xml b/pom.xml index 40de2449..dc4415c0 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 4.5.13 - 6.4.1 + 6.8.1 2.8.0 3.11 1.21