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

Failure in applying Deployments using fabric8-maven-plugin when using resource fragments #1570

Closed
rohanKanojia opened this issue Mar 12, 2019 · 0 comments

Comments

@rohanKanojia
Copy link
Member

I'm using this fragment in my src/main/fabric8 directory:

spec:
replicas: 1
template:
spec:
volumes:
- name: config
gitRepo:
repository: 'https://github.com/jstrachan/sample-springboot-config.git'
revision: 667ee4db6bc842b127825351e5c9bae5a4fb2147
directory: .
containers:
- volumeMounts:
- name: config
mountPath: /app/config
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
serviceAccount: ribbon

but when I try to deploy this application, I'm getting this error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.056 s
[INFO] Finished at: 2019-03-12T18:39:43+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:4.0-SNAPSHOT:deploy (default-cli) on project fabric8-maven-sample-external-resources: Failed to create Deployment from kubernetes.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.42.18:8443/apis/apps/v1/namespaces/default/deployments. Message: the API version in the data (extensions/v1beta1) does not match the expected API version (apps/v1). Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=the API version in the data (extensions/v1beta1) does not match the expected API version (apps/v1), metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).. Deployment(apiVersion=extensions/v1beta1, kind=Deployment, metadata=ObjectMeta(annotations={fabric8.io/git-commit=9693e61885159ed71dd689abfc9cc9e78150068a, fabric8.io/git-branch=sidecars, fabric8.io/[email protected]:rohanKanojia/fabric8-maven-plugin.git, fabric8.io/scm-url=https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/fabric8-maven-sample-external-resources, fabric8.io/scm-tag=HEAD}, clusterName=null, creationTimestamp=null, deletionGracePeriodSeconds=null, deletionTimestamp=null, finalizers=[], generateName=null, generation=null, initializers=null, labels={app=fabric8-maven-sample-external-resources, provider=fabric8, version=4.0-SNAPSHOT, group=io.fabric8}, name=fabric8-maven-sample-external-resources, namespace=null, ownerReferences=[], resourceVersion=null, selfLink=null, uid=null, additionalProperties={}), spec=DeploymentSpec(minReadySeconds=null, paused=null, progressDeadlineSeconds=null, replicas=1, revisionHistoryLimit=2, selector=LabelSelector(matchExpressions=[], matchLabels={app=fabric8-maven-sample-external-resources, provider=fabric8, group=io.fabric8}, additionalProperties={}), strategy=null, template=PodTemplateSpec(metadata=ObjectMeta(annotations={fabric8.io/git-commit=9693e61885159ed71dd689abfc9cc9e78150068a, fabric8.io/git-branch=sidecars, fabric8.io/scm-tag=HEAD, fabric8.io/[email protected]:rohanKanojia/fabric8-maven-plugin.git, fabric8.io/scm-url=https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/fabric8-maven-sample-external-resources}, clusterName=null, creationTimestamp=null, deletionGracePeriodSeconds=null, deletionTimestamp=null, finalizers=[], generateName=null, generation=null, initializers=null, labels={app=fabric8-maven-sample-external-resources, provider=fabric8, version=4.0-SNAPSHOT, group=io.fabric8}, name=null, namespace=null, ownerReferences=[], resourceVersion=null, selfLink=null, uid=null, additionalProperties={}), spec=PodSpec(activeDeadlineSeconds=null, affinity=null, automountServiceAccountToken=null, containers=[Container(args=[], command=[], env=[EnvVar(name=KUBERNETES_NAMESPACE, value=null, valueFrom=EnvVarSource(configMapKeyRef=null, fieldRef=ObjectFieldSelector(apiVersion=null, fieldPath=metadata.namespace, additionalProperties={}), resourceFieldRef=null, secretKeyRef=null, additionalProperties={}), additionalProperties={})], envFrom=[], image=fabric8/fabric8-maven-sample-external-resources:latest, imagePullPolicy=IfNotPresent, lifecycle=null, livenessProbe=Probe(exec=null, failureThreshold=3, httpGet=HTTPGetAction(host=null, httpHeaders=[], path=/health, port=IntOrString(IntVal=8080, Kind=null, StrVal=null, additionalProperties={}), scheme=HTTP, additionalProperties={}), initialDelaySeconds=180, periodSeconds=null, successThreshold=1, tcpSocket=null, timeoutSeconds=null, additionalProperties={}), name=spring-boot, ports=[ContainerPort(containerPort=8080, hostIP=null, hostPort=null, name=http, protocol=TCP, additionalProperties={}), ContainerPort(containerPort=9779, hostIP=null, hostPort=null, name=prometheus, protocol=TCP, additionalProperties={}), ContainerPort(containerPort=8778, hostIP=null, hostPort=null, name=jolokia, protocol=TCP, additionalProperties={})], readinessProbe=Probe(exec=null, failureThreshold=3, httpGet=HTTPGetAction(host=null, httpHeaders=[], path=/health, port=IntOrString(IntVal=8080, Kind=null, StrVal=null, additionalProperties={}), scheme=HTTP, additionalProperties={}), initialDelaySeconds=10, periodSeconds=null, successThreshold=1, tcpSocket=null, timeoutSeconds=null, additionalProperties={}), resources=null, securityContext=SecurityContext(allowPrivilegeEscalation=null, capabilities=null, privileged=false, procMount=null, readOnlyRootFilesystem=null, runAsGroup=null, runAsNonRoot=null, runAsUser=null, seLinuxOptions=null, additionalProperties={}), stdin=null, stdinOnce=null, terminationMessagePath=null, terminationMessagePolicy=null, tty=null, volumeDevices=[], volumeMounts=[VolumeMount(mountPath=/app/config, mountPropagation=null, name=config, readOnly=null, subPath=null, additionalProperties={})], workingDir=null, additionalProperties={})], dnsConfig=null, dnsPolicy=null, enableServiceLinks=null, hostAliases=[], hostIPC=null, hostNetwork=null, hostPID=null, hostname=null, imagePullSecrets=[], initContainers=[], nodeName=null, nodeSelector=null, priority=null, priorityClassName=null, readinessGates=[], restartPolicy=null, runtimeClassName=null, schedulerName=null, securityContext=null, serviceAccount=ribbon, serviceAccountName=null, shareProcessNamespace=null, subdomain=null, terminationGracePeriodSeconds=null, tolerations=[], volumes=[Volume(awsElasticBlockStore=null, azureDisk=null, azureFile=null, cephfs=null, cinder=null, configMap=null, downwardAPI=null, emptyDir=null, fc=null, flexVolume=null, flocker=null, gcePersistentDisk=null, gitRepo=GitRepoVolumeSource(directory=., repository=https://github.com/jstrachan/sample-springboot-config.git, revision=667ee4db6bc842b127825351e5c9bae5a4fb2147, additionalProperties={}), glusterfs=null, hostPath=null, iscsi=null, name=config, nfs=null, persistentVolumeClaim=null, photonPersistentDisk=null, portworxVolume=null, projected=null, quobyte=null, rbd=null, scaleIO=null, secret=null, storageos=null, vsphereVolume=null, additionalProperties={})], additionalProperties={}), additionalProperties={}), additionalProperties={}), status=null, additionalProperties={}) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

if I apend apiVersion: apps/v1 in my fragment then it works.

How to reproduce

Just try to run this sample on minikube

fabric8-maven-plugin version: 4.0.0-M2
Maven version: Apache Maven 3.5.4

rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Mar 12, 2019
Change API_APPS_VERSION to apps/v1 and move deployment fragment creation
with apps/v1 apiVersion rather than extensions
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Mar 12, 2019
Change API_APPS_VERSION to apps/v1 and move deployment fragment creation
with apps/v1 apiVersion rather than extensions
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Mar 13, 2019
Change API_APPS_VERSION to apps/v1 and move deployment fragment creation
with apps/v1 apiVersion rather than extensions
rohanKanojia added a commit that referenced this issue Mar 13, 2019
Change API_APPS_VERSION to apps/v1 and move deployment fragment creation
with apps/v1 apiVersion rather than extensions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant