Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMUser: when using the operator's CRD object as targetRefs, an url_prefix must be generated considering useAsDefault #960

Closed
Looka149 opened this issue May 22, 2024 · 0 comments · Fixed by #961

Comments

@Looka149
Copy link
Contributor

Looka149 commented May 22, 2024

Hi. There seems to be some unintended behavior related to vmuser.

When useAsDefault is disabled:
When creating Victoriametrics Operator CRD, a port named http is always created by the Operator. In vmagent or some CRDs, the default port can be modified through .spec.port, And this value is used for the port and targetPort of the service. When a Victoriametrics Operator CRD is specified through vmuser's .spec.targetRefs.crd, the operator generates a url_prefix config using the above port.

When useAsDefault is enabled:
If useAsDefault of Victoriametrics Operator CRD is enabled, the service's port and targetPort may be different. However, vmuser still generates the url_prefix by referring to .spec.port or the default port value. This causes inaccessibility issues.

example)

VMAlert manifest with useAsDefault

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlert
...
spec:
  serviceSpec:
    metadata:
      name: vmalert-main
    spec:
      ports:
      - name: http
        port: 80
        protocol: TCP
        targetPort: 8080
      type: LoadBalancer
    useAsDefault: true
...

VMUser manifest with VMAlert target

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
  name: test-vmalert
...
spec:
  targetRefs:
  - crd:
      kind: VMAlert
      name: main
      namespace: monitoring
...

VMAuth config generated by operator

users:
- url_prefix:
  - http://vmalert-main.monitoring.svc:8080  # should be 80
  username: test-vmalert
@Looka149 Looka149 changed the title VMUser: when using the operator's CRD object, an url_prefix must be generated considering useAsDefault VMUser: when using the operator's CRD object as targetRefs, an url_prefix must be generated considering useAsDefault May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant