operator icon indicating copy to clipboard operation
operator copied to clipboard

object values should not be overwritten

Open uhthomas opened this issue 1 year ago • 4 comments

I've deployed a VMCluster and set the cpu limit to 1000m.

https://github.com/uhthomas/automata/blob/15654a5e2dea23101bf7a358e1f07e76eda5dab8/k8s/unwind/vm/vm_cluster_list.cue#L39

The operator changes this to "1", which breaks my deployment. It should just leave the value alone.

error: Apply failed with 3 conflicts: conflicts with "manager" using operator.victoriametrics.com/v1beta1:
validatingwebhookconfiguration.admissionregistration.k8s.io/vm-operator serverside-applied
- .spec.vminsert.resources.limits.cpu
- .spec.vmselect.resources.limits.cpu
- .spec.vmstorage.resources.limits.cpu
Please review the fields above--they currently have other managers. Here
are the ways you can resolve this warning:
* If you intend to manage all of these fields, please re-run the apply
  command with the `--force-conflicts` flag.
* If you do not intend to manage all of the fields, please edit your
  manifest to remove references to the fields that should keep their
  current managers.
* You may co-own fields by updating your manifest to match the existing
  value; in this case, you'll become the manager if the other manager(s)
  stop managing the field (remove it from their configuration).
See https://kubernetes.io/docs/reference/using-api/server-side-apply/#conflicts
Error: Process completed with exit code 1.

uhthomas avatar Jul 02 '23 00:07 uhthomas

Hello! I don't think this is caused by operator, opeartor only pass the customize resources setting to deployment/statefulset controller, the unit parse is done by default.

Haleygo avatar Jul 03 '23 02:07 Haleygo

Hello! I don't think this is caused by operator, opeartor only pass the customize resources setting to deployment/statefulset controller, the unit parse is done by default.

Other resources like deployments do not have this behaviour, the vm operator is definitely doing something strange.

uhthomas avatar Jul 03 '23 09:07 uhthomas

Other resources like deployments do not have this behaviour, the vm operator is definitely doing something strange.

echo '
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: 1000m
            memory: 1000m
' | kubectl apply -f -

If you apply this deployment, you will see "1" instead of "1000m" under both deployment and pod.

Haleygo avatar Jul 03 '23 10:07 Haleygo

@uhthomas this issue is still relevant?

Amper avatar Aug 25 '23 09:08 Amper