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

How to determine which version of victoriametrics the operator will install by default #675

Closed
willemm opened this issue Jun 22, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@willemm
Copy link

willemm commented Jun 22, 2023

Hi,

We're trying to build an automated upgrade pipeline for some applications including VictoriaMetrics operator.
Once the operator is upgraded, we would like to check if it's functioning properly. The easiest way to do this would seem to be to check if all components are up and running, and have the correct version. (e.g. vm_app_version{namespace="victoria-metrics",short_version =~ "^v1.91.0.*"} and up{namespace="victoria-metrics"} == 1) )

However, it seems there is no way to deduce from the operator which version it will be installing by default. The default version is hardcoded into the operator:

Version string `default:"v1.91.0-cluster"`

Note: I do not want to know how to change the version, nor override the default. I want the default version. But I want my automated pipeline to know which version that is.

@Haleygo Haleygo added the question Further information is requested label Jun 23, 2023
@Haleygo
Copy link
Contributor

Haleygo commented Jun 23, 2023

@f41gh7 I think the default version of each components in operator are hidden from the users, and there is no doc to summarize that. Should we maintain it somewhere or expose some of them in operator pod?
For now, we seems to update them to the latest tag when operator released.

@f41gh7
Copy link
Collaborator

f41gh7 commented Jun 23, 2023

@f41gh7 I think the default version of each components in operator are hidden from the users, and there is no doc to summarize that. Should we maintain it somewhere or expose some of them in operator pod? For now, we seems to update them to the latest tag when operator released.

I think, we have to mention at doc how to manage CR objects versions - default values, global operator settings, per CR value. And best practice for it. I recommend to define versions at CR spec definition and manage it via git-ops. As we usually do internally with argo-cd.

For current issue, best option for me looks a --printDefaults flag. That will print out json with defaults. Aka:

./bin/manager --printDefault
{
   "flags": {"logger.Level":  "info"  },
    "config": {
          "vmalert_default": {"version": "v1.90.1","image": "victoriametrics/vmalert" }
 }
}

and other values for the BaseOperatorConf struct.

In this case, automated pipeline could parse it with jq and make some decision.

@Amper Amper self-assigned this Sep 1, 2023
@Amper Amper added the enhancement New feature or request label Sep 1, 2023
Amper added a commit that referenced this issue Sep 2, 2023
…#742)

* add ability to print default values for all operator variables (#675)

* fix review comment
@Amper
Copy link
Contributor

Amper commented Sep 2, 2023

Hey.

In PR #742 implemented the following flags for the operator:

  • -printDefaults - print all variables with their default values and exit
  • -printFormat string - output format for --printDefaults. Can be table, json, yaml or list (default - table).

Examples of output for these flags:

# --printDefaults

This application is configured via the environment. The following environment
variables can be used:

KEY                                                          TYPE                              DEFAULT                                                           REQUIRED    DESCRIPTION
VM_USECUSTOMCONFIGRELOADER                                   True or False                     false                                                                         
VM_CONTAINERREGISTRY                                         String                                                                                                          
VM_CUSTOMCONFIGRELOADERIMAGE                                 String                            victoriametrics/operator:config-reloader-v0.32.0                              
VM_PSPAUTOCREATEENABLED                                      True or False                     false                                                                         
VM_VMALERTDEFAULT_IMAGE                                      String                            victoriametrics/vmalert                                                       
VM_VMALERTDEFAULT_VERSION                                    String                            v1.93.3                                                                       
VM_VMALERTDEFAULT_PORT                                       String                            8080                                                                          
VM_VMALERTDEFAULT_USEDEFAULTRESOURCES                        True or False                     true                                                                          
VM_VMALERTDEFAULT_RESOURCE_LIMIT_MEM                         String                            500Mi                                                                         
VM_VMALERTDEFAULT_RESOURCE_LIMIT_CPU                         String                            200m                                                                          
VM_VMALERTDEFAULT_RESOURCE_REQUEST_MEM                       String                            200Mi                                                                         
VM_VMALERTDEFAULT_RESOURCE_REQUEST_CPU                       String                            50m                                                                           
VM_VMALERTDEFAULT_CONFIGRELOADERCPU                          String                            100m                                                                          
VM_VMALERTDEFAULT_CONFIGRELOADERMEMORY                       String                            25Mi                                                                          
VM_VMALERTDEFAULT_CONFIGRELOADIMAGE                          String                            jimmidyson/configmap-reload:v0.3.0                                            
VM_VMAGENTDEFAULT_IMAGE                                      String                            victoriametrics/vmagent                                                       
VM_VMAGENTDEFAULT_VERSION                                    String                            v1.93.3                                                                       
VM_VMAGENTDEFAULT_CONFIGRELOADIMAGE                          String                            quay.io/prometheus-operator/prometheus-config-reloader:v0.58.0                
VM_VMAGENTDEFAULT_PORT                                       String                            8429                                            
...
#  --printDefaults --printFormat=json
{
    'VM_USECUSTOMCONFIGRELOADER': 'false',
    'VM_CONTAINERREGISTRY': '',
    'VM_CUSTOMCONFIGRELOADERIMAGE': 'victoriametrics/operator:config-reloader-v0.32.0',
    'VM_PSPAUTOCREATEENABLED': 'false',
    'VM_VMALERTDEFAULT_IMAGE': 'victoriametrics/vmalert',
    'VM_VMALERTDEFAULT_VERSION': 'v1.93.3',
    'VM_VMALERTDEFAULT_PORT': '8080',
    'VM_VMALERTDEFAULT_USEDEFAULTRESOURCES': 'true',
    'VM_VMALERTDEFAULT_RESOURCE_LIMIT_MEM': '500Mi',
    'VM_VMALERTDEFAULT_RESOURCE_LIMIT_CPU': '200m',
    'VM_VMALERTDEFAULT_RESOURCE_REQUEST_MEM': '200Mi',
    'VM_VMALERTDEFAULT_RESOURCE_REQUEST_CPU': '50m',
    'VM_VMALERTDEFAULT_CONFIGRELOADERCPU': '100m',
    'VM_VMALERTDEFAULT_CONFIGRELOADERMEMORY': '25Mi',
    'VM_VMALERTDEFAULT_CONFIGRELOADIMAGE': 'jimmidyson/configmap-reload:v0.3.0',
    'VM_VMAGENTDEFAULT_IMAGE': 'victoriametrics/vmagent',
    'VM_VMAGENTDEFAULT_VERSION': 'v1.93.3',
    'VM_VMAGENTDEFAULT_CONFIGRELOADIMAGE': 'quay.io/prometheus-operator/prometheus-config-reloader:v0.58.0',
    'VM_VMAGENTDEFAULT_PORT': '8429',
...
    'VM_DEFAULTLABELS': 'managed-by=vm-operator',
    'VM_LOGLEVEL': '',
    'VM_LOGFORMAT': '',
    'VM_CLUSTERDOMAINNAME': '',
    'VM_PODWAITREADYTIMEOUT': '80s',
    'VM_PODWAITREADYINTERVALCHECK': '5s',
    'VM_PODWAITREADYINITDELAY': '10s',
    'VM_FORCERESYNCINTERVAL': '60s',
    'VM_ENABLESTRICTSECURITY': 'true'
}

The feature is in master and will be released in the next minor release of the operator.

In addition, we have started adding information about the default version of VM components to the Release Notes and CHANGELOG.

@Amper
Copy link
Contributor

Amper commented Sep 12, 2023

Released at v0.38.0

@Amper Amper closed this as completed Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants