From 335521deb5c059b5e47268185e35a5a5942165c4 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 12 Mar 2019 19:42:14 +0530 Subject: [PATCH] Fix #1570: change API_APPS_VERSION to apps/v1 Change API_APPS_VERSION to apps/v1 and move deployment fragment creation with apps/v1 apiVersion rather than extensions --- CHANGELOG.md | 1 + .../maven/core/util/kubernetes/KubernetesResourceUtil.java | 6 +++--- it/src/it/custom-environment/expected/kubernetes.yml | 2 +- it/src/it/remote-resources/expected/kubernetes.yml | 2 +- it/src/it/statefulset/expected/kubernetes.yml | 2 +- it/src/it/statefulset/expected/openshift.yml | 2 +- it/src/it/vertx/expected/kubernetes.yml | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2719b7776..d0ada7f3be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ After this we will switch probably to real [Semantic Versioning 2.0.0](http://se * Feature 1498: Allow users to define secrets from annotations * Feature 1498: Allow users to define secrets from annotations * Fix 1522: Remove need to initialize DockerAccess when on Openshift +* Fix 1570: Failure in applying Deployments using fabric8-maven-plugin * Fix 1517: update vmp groupid and vert.x version * Feature 456: Add labels from label-schema.org to the generator images. diff --git a/core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesResourceUtil.java b/core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesResourceUtil.java index 442b7ab07f..7393d7dacd 100644 --- a/core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesResourceUtil.java +++ b/core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesResourceUtil.java @@ -105,7 +105,7 @@ public class KubernetesResourceUtil { public static final String API_VERSION = "v1"; public static final String API_EXTENSIONS_VERSION = "extensions/v1beta1"; - public static final String API_APPS_VERSION = "apps/v1beta1"; + public static final String API_APPS_VERSION = "apps/v1"; public static final String JOB_VERSION = "batch/v1"; public static final String OPENSHIFT_V1_VERSION = "apps.openshift.io/v1"; public static final ResourceVersioning DEFAULT_RESOURCE_VERSIONING = new ResourceVersioning() @@ -249,9 +249,9 @@ private static Map readAndEnrichFragment(PlatformMode platformMo addKind(fragment, kind, file.getName()); String apiVersion = apiVersions.getCoreVersion(); - if (Objects.equals(kind, "Deployment") || Objects.equals(kind, "Ingress")) { + if (Objects.equals(kind, "Ingress")) { apiVersion = apiVersions.getExtensionsVersion(); - } else if (Objects.equals(kind, "StatefulSet")) { + } else if (Objects.equals(kind, "StatefulSet") || Objects.equals(kind, "Deployment")) { apiVersion = apiVersions.getAppsVersion(); } else if (Objects.equals(kind, "Job")) { apiVersion = apiVersions.getJobVersion(); diff --git a/it/src/it/custom-environment/expected/kubernetes.yml b/it/src/it/custom-environment/expected/kubernetes.yml index 9d842e530f..8b76895942 100644 --- a/it/src/it/custom-environment/expected/kubernetes.yml +++ b/it/src/it/custom-environment/expected/kubernetes.yml @@ -32,7 +32,7 @@ items: app: fabric8-maven-sample-custom-environment provider: fabric8 group: io.fabric8 -- apiVersion: extensions/v1beta1 +- apiVersion: apps/v1 kind: Deployment metadata: labels: diff --git a/it/src/it/remote-resources/expected/kubernetes.yml b/it/src/it/remote-resources/expected/kubernetes.yml index 7488e89bda..e5eb75c9ed 100644 --- a/it/src/it/remote-resources/expected/kubernetes.yml +++ b/it/src/it/remote-resources/expected/kubernetes.yml @@ -32,7 +32,7 @@ items: app: fabric8-maven-sample-remote-resources provider: fabric8 group: io.fabric8 -- apiVersion: extensions/v1beta1 +- apiVersion: apps/v1 kind: Deployment metadata: labels: diff --git a/it/src/it/statefulset/expected/kubernetes.yml b/it/src/it/statefulset/expected/kubernetes.yml index 2a8d64268b..83591fa311 100644 --- a/it/src/it/statefulset/expected/kubernetes.yml +++ b/it/src/it/statefulset/expected/kubernetes.yml @@ -37,7 +37,7 @@ items: app: fabric8-maven-sample-statefulset provider: fabric8 group: io.fabric8 -- apiVersion: apps/v1beta1 +- apiVersion: apps/v1 kind: StatefulSet metadata: labels: diff --git a/it/src/it/statefulset/expected/openshift.yml b/it/src/it/statefulset/expected/openshift.yml index 13cc1ab89d..2fba2a2b6e 100644 --- a/it/src/it/statefulset/expected/openshift.yml +++ b/it/src/it/statefulset/expected/openshift.yml @@ -52,7 +52,7 @@ items: to: kind: Service name: fabric8-maven-sample-statefulset -- apiVersion: apps/v1beta1 +- apiVersion: apps/v1 kind: StatefulSet metadata: labels: diff --git a/it/src/it/vertx/expected/kubernetes.yml b/it/src/it/vertx/expected/kubernetes.yml index 3da17f22a6..226a0ca615 100644 --- a/it/src/it/vertx/expected/kubernetes.yml +++ b/it/src/it/vertx/expected/kubernetes.yml @@ -32,7 +32,7 @@ items: app: fabric8-maven-sample-vertx provider: fabric8 group: io.fabric8 -- apiVersion: extensions/v1beta1 +- apiVersion: apps/v1 kind: Deployment metadata: labels: