Closed shayfisher closed 3 years ago
Hello, all values from BaseOperatorConf can be replaced with env variables according to vars.MD file https://github.com/VictoriaMetrics/operator/blob/master/vars.MD
So, in your case replace VM_VMAGENTDEFAULT_CONFIGRELOADIMAGE=quay.io/coreos/prometheus-config-reloader:v0.42.0
and VM_VMALERTDEFAULT_CONFIGRELOADIMAGE=jimmidyson/configmap-reload:v0.3.0
with needed values at operator deployment.
Env for the config-reloader container is set inline - https://github.com/VictoriaMetrics/operator/blob/41319bd3449a3422f77455551d5a01e6fa1d1d10/controllers/factory/vmagent.go#L491 whereas the vmagent container uses the envs slice that is read from cr.Spec.ExtraEnvs . Could you change the Env field for the config-reloader container so that it will contain the same refrence, e.g: Env: envs,
This way I could have set: extraEnvs:
Am I missing something with your suggestion?
Thanks!
You have to change operator deployment, not VMAgent crd object.
Let me give you and example, it depends on your deployment way, but i will use kubectl for simplicity.
Operator base deployment file localated at https://github.com/VictoriaMetrics/operator/blob/master/config/manager/manager.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: vm-operator
namespace: monitoring-system
labels:
control-plane: vm-operator
spec:
selector:
matchLabels:
control-plane: vm-operator
replicas: 1
template:
metadata:
labels:
control-plane: vm-operator
spec:
serviceAccountName: vm-operator
containers:
- name: manager
command:
- manager
args:
- "--enable-leader-election"
image: manager
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
value: ""
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: "vm-operator"
You have to change it to:
apiVersion: apps/v1
kind: Deployment
metadata:
name: vm-operator
namespace: monitoring-system
labels:
control-plane: vm-operator
spec:
selector:
matchLabels:
control-plane: vm-operator
replicas: 1
template:
metadata:
labels:
control-plane: vm-operator
spec:
serviceAccountName: vm-operator
containers:
- name: manager
command:
- manager
args:
- "--enable-leader-election"
image: manager
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
value: ""
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: "vm-operator"
- name: VM_VMAGENTDEFAULT_CONFIGRELOADIMAGE
value: my-local-image-name:latest
- name: VM_VMALERTDEFAULT_CONFIGRELOADIMAGE
value: my-local-image-name:latest
And apply new deployment version.
After that, vmalert and vmagent config reload containers must use correct images.
Got it. Thanks
Hi, Currently the prometheus-config-reloader image name is set as a default value in here: https://github.com/VictoriaMetrics/operator/blob/6d7f1a8d14ee0ae11db1ce45cbb1b32e84886647/internal/config/config.go#L42 and also there is a setting of this one: https://github.com/VictoriaMetrics/operator/blob/6d7f1a8d14ee0ae11db1ce45cbb1b32e84886647/internal/config/config.go#L37 Basically when you instantiate the VMAgent and append the container you get the value from VMAgentDefault struct. I'm trying to run victoriametrics on a network disconnected environment and therefore I need to download the images in advance and put them in a local docker registry. This configuration prevents me from doing so. Could you add this and other "static default" images as part of the CRD so I will be able to configure it via CR ? Thanks!