Skip to content

Commit 0ec9f87

Browse files
removed config reloader
1 parent 9e5ab0f commit 0ec9f87

File tree

12 files changed

+22
-563
lines changed

12 files changed

+22
-563
lines changed

api/operator/v1/vmanomaly_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ type VMAnomalySpec struct {
115115
// +optional
116116
ServiceAccountName string `json:"serviceAccountName,omitempty"`
117117
vmv1beta1.CommonDefaultableParams `json:",inline,omitempty"`
118-
vmv1beta1.CommonConfigReloaderParams `json:",inline,omitempty"`
119118
vmv1beta1.CommonApplicationDeploymentParams `json:",inline,omitempty"`
120119
}
121120

api/operator/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/overlay/crd.yaml

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -20712,104 +20712,6 @@ spec:
2071220712
it helps it to start without secret.
2071320713
priority -> hardcoded ConfigRaw -> ConfigRaw, provided by user -> ConfigSecret.
2071420714
type: string
20715-
configReloadAuthKeySecret:
20716-
description: |-
20717-
ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.
20718-
Given secret reference will be added to the application and vm-config-reloader as volume
20719-
available since v0.57.0 version
20720-
properties:
20721-
key:
20722-
description: The key of the secret to select from. Must be a
20723-
valid secret key.
20724-
type: string
20725-
name:
20726-
default: ""
20727-
description: |-
20728-
Name of the referent.
20729-
This field is effectively required, but due to backwards compatibility is
20730-
allowed to be empty. Instances of this type with an empty value here are
20731-
almost certainly wrong.
20732-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
20733-
type: string
20734-
optional:
20735-
description: Specify whether the Secret or its key must be defined
20736-
type: boolean
20737-
required:
20738-
- key
20739-
type: object
20740-
x-kubernetes-map-type: atomic
20741-
configReloaderExtraArgs:
20742-
additionalProperties:
20743-
type: string
20744-
description: |-
20745-
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
20746-
for example resyncInterval: "30s"
20747-
type: object
20748-
configReloaderImageTag:
20749-
description: ConfigReloaderImageTag defines image:tag for config-reloader
20750-
container
20751-
type: string
20752-
configReloaderResources:
20753-
description: |-
20754-
ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
20755-
if not defined default resources from operator config will be used
20756-
properties:
20757-
claims:
20758-
description: |-
20759-
Claims lists the names of resources, defined in spec.resourceClaims,
20760-
that are used by this container.
20761-
20762-
This is an alpha field and requires enabling the
20763-
DynamicResourceAllocation feature gate.
20764-
20765-
This field is immutable. It can only be set for containers.
20766-
items:
20767-
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
20768-
properties:
20769-
name:
20770-
description: |-
20771-
Name must match the name of one entry in pod.spec.resourceClaims of
20772-
the Pod where this field is used. It makes that resource available
20773-
inside a container.
20774-
type: string
20775-
request:
20776-
description: |-
20777-
Request is the name chosen for a request in the referenced claim.
20778-
If empty, everything from the claim is made available, otherwise
20779-
only the result of this request.
20780-
type: string
20781-
required:
20782-
- name
20783-
type: object
20784-
type: array
20785-
x-kubernetes-list-map-keys:
20786-
- name
20787-
x-kubernetes-list-type: map
20788-
limits:
20789-
additionalProperties:
20790-
anyOf:
20791-
- type: integer
20792-
- type: string
20793-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
20794-
x-kubernetes-int-or-string: true
20795-
description: |-
20796-
Limits describes the maximum amount of compute resources allowed.
20797-
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
20798-
type: object
20799-
requests:
20800-
additionalProperties:
20801-
anyOf:
20802-
- type: integer
20803-
- type: string
20804-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
20805-
x-kubernetes-int-or-string: true
20806-
description: |-
20807-
Requests describes the minimum amount of compute resources required.
20808-
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
20809-
otherwise to an implementation-defined value. Requests cannot exceed Limits.
20810-
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
20811-
type: object
20812-
type: object
2081320715
configSecret:
2081420716
description: |-
2081520717
ConfigSecret is the name of a Kubernetes Secret in the same namespace as the
@@ -22677,12 +22579,6 @@ spec:
2267722579
uses non-root user out of the box
2267822580
drops not needed security permissions
2267922581
type: boolean
22680-
useVMConfigReloader:
22681-
description: |-
22682-
UseVMConfigReloader replaces prometheus-like config-reloader
22683-
with vm one. It uses secrets watch instead of file watch
22684-
which greatly increases speed of config updates
22685-
type: boolean
2268622582
volumeMounts:
2268722583
description: |-
2268822584
VolumeMounts allows configuration of additional VolumeMounts on the output Deployment/StatefulSet definition.

docs/api.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,6 @@ Appears in: [VMAnomaly](#vmanomaly)
740740
| claimTemplates<a href="#vmanomalyspec-claimtemplates" id="vmanomalyspec-claimtemplates">#</a><br/>_[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#persistentvolumeclaim-v1-core) array_ | _(Required)_<br/>ClaimTemplates allows adding additional VolumeClaimTemplates for VMAnomaly |
741741
| configMaps<a href="#vmanomalyspec-configmaps" id="vmanomalyspec-configmaps">#</a><br/>_string array_ | _(Optional)_<br/>ConfigMaps is a list of ConfigMaps in the same namespace as the Application<br />object, which shall be mounted into the Application container<br />at /etc/vm/configs/CONFIGMAP_NAME folder |
742742
| configRawYaml<a href="#vmanomalyspec-configrawyaml" id="vmanomalyspec-configrawyaml">#</a><br/>_string_ | _(Optional)_<br/>ConfigRawYaml - raw configuration for anomaly,<br />it helps it to start without secret.<br />priority -> hardcoded ConfigRaw -> ConfigRaw, provided by user -> ConfigSecret. |
743-
| configReloadAuthKeySecret<a href="#vmanomalyspec-configreloadauthkeysecret" id="vmanomalyspec-configreloadauthkeysecret">#</a><br/>_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_<br/>ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.<br />Given secret reference will be added to the application and vm-config-reloader as volume<br />available since v0.57.0 version |
744-
| configReloaderExtraArgs<a href="#vmanomalyspec-configreloaderextraargs" id="vmanomalyspec-configreloaderextraargs">#</a><br/>_object (keys:string, values:string)_ | _(Optional)_<br/>ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container<br />for example resyncInterval: "30s" |
745-
| configReloaderImageTag<a href="#vmanomalyspec-configreloaderimagetag" id="vmanomalyspec-configreloaderimagetag">#</a><br/>_string_ | _(Optional)_<br/>ConfigReloaderImageTag defines image:tag for config-reloader container |
746-
| configReloaderResources<a href="#vmanomalyspec-configreloaderresources" id="vmanomalyspec-configreloaderresources">#</a><br/>_[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | _(Optional)_<br/>ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/<br />if not defined default resources from operator config will be used |
747743
| configSecret<a href="#vmanomalyspec-configsecret" id="vmanomalyspec-configsecret">#</a><br/>_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_<br/>ConfigSecret is the name of a Kubernetes Secret in the same namespace as the<br />VMAnomaly object, which contains configuration for this VMAnomaly,<br />configuration must be inside secret key: anomaly.yaml.<br />It must be created by user.<br />instance. Defaults to 'vmanomaly-<anomaly-name>'<br />The secret is mounted into /etc/anomaly/config. |
748744
| containers<a href="#vmanomalyspec-containers" id="vmanomalyspec-containers">#</a><br/>_[Container](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#container-v1-core) array_ | _(Optional)_<br/>Containers property allows to inject additions sidecars or to patch existing containers.<br />It can be useful for proxies, backup, etc. |
749745
| disableAutomountServiceAccountToken<a href="#vmanomalyspec-disableautomountserviceaccounttoken" id="vmanomalyspec-disableautomountserviceaccounttoken">#</a><br/>_boolean_ | _(Optional)_<br/>DisableAutomountServiceAccountToken whether to disable serviceAccount auto mount by Kubernetes (available from v0.54.0).<br />Operator will conditionally create volumes and volumeMounts for containers if it requires k8s API access.<br />For example, vmagent and vm-config-reloader requires k8s API access.<br />Operator creates volumes with name: "kube-api-access", which can be used as volumeMount for extraContainers if needed.<br />And also adds VolumeMounts at /var/run/secrets/kubernetes.io/serviceaccount. |
@@ -792,7 +788,6 @@ Appears in: [VMAnomaly](#vmanomaly)
792788
| topologySpreadConstraints<a href="#vmanomalyspec-topologyspreadconstraints" id="vmanomalyspec-topologyspreadconstraints">#</a><br/>_[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#topologyspreadconstraint-v1-core) array_ | _(Optional)_<br/>TopologySpreadConstraints embedded kubernetes pod configuration option,<br />controls how pods are spread across your cluster among failure-domains<br />such as regions, zones, nodes, and other user-defined topology domains<br />https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/ |
793789
| useDefaultResources<a href="#vmanomalyspec-usedefaultresources" id="vmanomalyspec-usedefaultresources">#</a><br/>_boolean_ | _(Optional)_<br/>UseDefaultResources controls resource settings<br />By default, operator sets built-in resource requirements |
794790
| useStrictSecurity<a href="#vmanomalyspec-usestrictsecurity" id="vmanomalyspec-usestrictsecurity">#</a><br/>_boolean_ | _(Optional)_<br/>UseStrictSecurity enables strict security mode for component<br />it restricts disk writes access<br />uses non-root user out of the box<br />drops not needed security permissions |
795-
| useVMConfigReloader<a href="#vmanomalyspec-usevmconfigreloader" id="vmanomalyspec-usevmconfigreloader">#</a><br/>_boolean_ | _(Optional)_<br/>UseVMConfigReloader replaces prometheus-like config-reloader<br />with vm one. It uses secrets watch instead of file watch<br />which greatly increases speed of config updates |
796791
| volumeMounts<a href="#vmanomalyspec-volumemounts" id="vmanomalyspec-volumemounts">#</a><br/>_[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core) array_ | _(Optional)_<br/>VolumeMounts allows configuration of additional VolumeMounts on the output Deployment/StatefulSet definition.<br />VolumeMounts specified will be appended to other VolumeMounts in the Application container |
797792
| volumes<a href="#vmanomalyspec-volumes" id="vmanomalyspec-volumes">#</a><br/>_[Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volume-v1-core) array_ | _(Required)_<br/>Volumes allows configuration of additional volumes on the output Deployment/StatefulSet definition.<br />Volumes specified will be appended to other volumes that are generated.<br />/ +optional |
798793
| writer<a href="#vmanomalyspec-writer" id="vmanomalyspec-writer">#</a><br/>_[VMAnomalyWritersSpec](#vmanomalywritersspec)_ | _(Required)_<br/>Metrics destination for VMAnomaly<br />See https://docs.victoriametrics.com/anomaly-detection/components/writer/ |
@@ -1149,7 +1144,7 @@ Appears in: [VLAgentSpec](#vlagentspec), [VLInsert](#vlinsert), [VLSelect](#vlse
11491144

11501145

11511146

1152-
Appears in: [VMAgentSpec](#vmagentspec), [VMAlertSpec](#vmalertspec), [VMAlertmanagerSpec](#vmalertmanagerspec), [VMAnomalySpec](#vmanomalyspec), [VMAuthSpec](#vmauthspec)
1147+
Appears in: [VMAgentSpec](#vmagentspec), [VMAlertSpec](#vmalertspec), [VMAlertmanagerSpec](#vmalertmanagerspec), [VMAuthSpec](#vmauthspec)
11531148

11541149
| Field | Description |
11551150
| --- | --- |

internal/controller/operator/factory/build/defaults.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ func addVMAnomalyDefaults(objI any) {
283283
},
284284
}
285285
}
286-
addDefaultsToConfigReloader(&cr.Spec.CommonConfigReloaderParams, ptr.Deref(cr.Spec.UseDefaultResources, false), &cv)
287286
}
288287

289288
func addVLSingleDefaults(objI any) {

internal/controller/operator/factory/finalize/vmanomaly.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ import (
55

66
appsv1 "k8s.io/api/apps/v1"
77
corev1 "k8s.io/api/core/v1"
8-
rbacv1 "k8s.io/api/rbac/v1"
9-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
108
"sigs.k8s.io/controller-runtime/pkg/client"
119

1210
vmv1 "github.com/VictoriaMetrics/operator/api/operator/v1"
13-
"github.com/VictoriaMetrics/operator/internal/config"
1411
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/build"
1512
)
1613

@@ -33,36 +30,6 @@ func OnVMAnomalyDelete(ctx context.Context, rclient client.Client, cr *vmv1.VMAn
3330
return err
3431
}
3532
}
36-
// remove vmagents service discovery rbac.
37-
if config.IsClusterWideAccessAllowed() {
38-
if err := removeFinalizeObjByName(ctx, rclient, &rbacv1.ClusterRoleBinding{}, cr.GetClusterRoleName(), cr.GetNamespace()); err != nil {
39-
return err
40-
}
41-
if err := removeFinalizeObjByName(ctx, rclient, &rbacv1.ClusterRole{}, cr.GetClusterRoleName(), cr.GetNamespace()); err != nil {
42-
return err
43-
}
44-
if err := SafeDelete(ctx, rclient, &rbacv1.ClusterRoleBinding{ObjectMeta: metav1.ObjectMeta{Name: cr.GetClusterRoleName(), Namespace: cr.GetNamespace()}}); err != nil {
45-
return err
46-
}
47-
48-
if err := SafeDelete(ctx, rclient, &rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: cr.GetClusterRoleName(), Namespace: cr.GetNamespace()}}); err != nil {
49-
return err
50-
}
51-
} else {
52-
if err := removeFinalizeObjByName(ctx, rclient, &rbacv1.RoleBinding{}, cr.GetClusterRoleName(), cr.GetNamespace()); err != nil {
53-
return err
54-
}
55-
if err := removeFinalizeObjByName(ctx, rclient, &rbacv1.Role{}, cr.GetClusterRoleName(), cr.GetNamespace()); err != nil {
56-
return err
57-
}
58-
if err := SafeDelete(ctx, rclient, &rbacv1.RoleBinding{ObjectMeta: metav1.ObjectMeta{Name: cr.GetClusterRoleName(), Namespace: cr.GetNamespace()}}); err != nil {
59-
return err
60-
}
61-
62-
if err := SafeDelete(ctx, rclient, &rbacv1.Role{ObjectMeta: metav1.ObjectMeta{Name: cr.GetClusterRoleName(), Namespace: cr.GetNamespace()}}); err != nil {
63-
return err
64-
}
65-
}
6633
if err := deleteSA(ctx, rclient, cr); err != nil {
6734
return err
6835
}

internal/controller/operator/factory/vmanomaly/config.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package vmanomaly
22

33
import (
4-
"bytes"
5-
"compress/gzip"
64
"context"
75
"crypto/sha256"
86
"encoding/hex"
@@ -20,15 +18,6 @@ import (
2018
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/vmanomaly/config"
2119
)
2220

23-
func gzipConfig(buf *bytes.Buffer, conf []byte) error {
24-
w := gzip.NewWriter(buf)
25-
defer w.Close()
26-
if _, err := w.Write(conf); err != nil {
27-
return err
28-
}
29-
return nil
30-
}
31-
3221
// CreateOrUpdateConfig builds configuration for VMAnomaly
3322
func CreateOrUpdateConfig(ctx context.Context, rclient client.Client, cr *vmv1.VMAnomaly, childObject client.Object) error {
3423
var prevCR *vmv1.VMAnomaly
@@ -53,19 +42,10 @@ func createOrUpdateConfig(ctx context.Context, rclient client.Client, cr, prevCR
5342
if err != nil {
5443
return "", err
5544
}
56-
secretConfigKey := configEnvsubstFilename
57-
if reloadSupported(cr) {
58-
secretConfigKey = gzippedFilename
59-
var buf bytes.Buffer
60-
if err = gzipConfig(&buf, data); err != nil {
61-
return "", fmt.Errorf("cannot gzip config for vmanomaly: %w", err)
62-
}
63-
data = buf.Bytes()
64-
}
6545
newSecretConfig := &corev1.Secret{
6646
ObjectMeta: build.ResourceMeta(build.SecretConfigResourceKind, cr),
6747
Data: map[string][]byte{
68-
secretConfigKey: data,
48+
configEnvsubstFilename: data,
6949
},
7050
}
7151

0 commit comments

Comments
 (0)