devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.17k stars 351 forks source link

Unable to use server-side apply #2857

Open mwienk opened 1 month ago

mwienk commented 1 month ago

What happened?
Some kubernetes applications need to use a server-side apply to circumvent API limitations, most notably the annotations field being longer than 262144 bytes, which might happen when you apply CRDs. For example, applying the cloud native postgres operator (cnpg) requires a server-side apply.

Though we have the possibility to add --server-side in the applyArgs, this flag is incompatible with the --force flag, which is used by default, failing the devspace dev command.

I received the following output:

info Using namespace 'my-project'
info Using kube context 'rancher-desktop'
my-project deploy:cnpg Applying manifests with kubectl...
my-project deploy:cnpg error: --force cannot be used with --server-side
my-project create_deployments: error deploying cnpg: error: --force cannot be used with --server-side
my-project  error executing 'kubectl --context rancher-desktop apply --force -f - --server-side': 
my-project Please make sure the command `kubectl apply` does work locally with manifest `https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.23/releases/cnpg-1.23.1.yaml`

What did you expect to happen instead?
I would like to use a server-side apply when I set --server-side flag.

How can we reproduce the bug? (as minimally and precisely as possible)

My devspace.yaml:

version: v2beta1
name: my-project

pipelines:
  dev:
    run: |-
      create_deployments --all

deployments:
  cnpg:
    kubectl:
      applyArgs:
        - "--server-side"
      manifests:
        - https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.23/releases/cnpg-1.23.1.yaml

Local Environment:

Anything else we need to know?