operator icon indicating copy to clipboard operation
operator copied to clipboard

VMOperator drops Ingress created without using it

Open thunderbird86 opened this issue 2 years ago • 2 comments

Describe the bug

VMOperator drops Ingress created without using it if it has the same name as an operator-managed resource. Probably it can be related not only to Ingress but to other resources too

To Reproduce

Deploy resource using VMOperater e.g. vmauth

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
  name: vmauth-sample
spec:
  replicaCount: 1
  resources:
    limits:
      cpu: 500m
      memory: 850Mi
    requests:
      cpu: 250m
      memory: 350Mi
  selectAllByDefault: true

Deploy Ingress using kubectl

---
apiVersion: v1
kind: Service
metadata:
  name: vmauth-sample
spec:
  type: ClusterIP
  ports:
    - name: service
      port: 8427
      protocol: TCP
      targetPort: 8427
  selector:
    app.kubernetes.io/name: vmauth

Expectation

Both resources work fine

Actual Result

VMOperator drops ingress

thunderbird86 avatar Sep 20 '23 09:09 thunderbird86

It would be great to store dynamic linked resources ( ingress, hpa, psp, pdb, rbac policy) at resource annotation. And perform 3-way merge ( new config state, cluster config state, annotations config state) like kubectl does.

f41gh7 avatar Sep 21 '23 10:09 f41gh7

Finally, I found the cause of VMOperator dropping my ingresses. This affected us too, and renaming ingresses solved the problem. Maybe it is a good practice to give all the resources unique names, regardless of their kind.

I suggest parsing Kubernetes resources together with their name (like "ingress/vmauth-sample" instead of just "vmauth-sample") in the operator's internals.

user81230 avatar Dec 08 '23 08:12 user81230