Skip to content

Commit

Permalink
Merge pull request #369 from VictoriaMetrics/gh-366
Browse files Browse the repository at this point in the history
gh-366 changes update order for sts
  • Loading branch information
f41gh7 committed Nov 5, 2021
2 parents 0f4368b + 864f2a1 commit 670ea1e
Show file tree
Hide file tree
Showing 6 changed files with 713 additions and 92 deletions.
4 changes: 2 additions & 2 deletions api/v1beta1/vmagent_types.go
Expand Up @@ -162,8 +162,8 @@ type VMAgentSpec struct {
// +optional
VMAgentExternalLabelName *string `json:"vmAgentExternalLabelName,omitempty"`

// ExternalLabels The labels to add to any time series or alerts when communicating with
// external systems (federation, remote storage, etc).
// ExternalLabels The labels to add to any time series scraped by vmagent.
// it doesn't affect metrics ingested directly by push API's
// +optional
ExternalLabels map[string]string `json:"externalLabels,omitempty"`
// RemoteWrite list of victoria metrics /some other remote write system
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/vmagent_webhook.go
Expand Up @@ -40,7 +40,7 @@ func checkRelabelConfigs(src []RelabelConfig) error {
return fmt.Errorf("cannot parse relabelConfigs as yaml: %w", err)
}
prc = envtemplate.Replace(prc)
if _, err := promrelabel.ParseRelabelConfigsData(prc); err != nil {
if _, err := promrelabel.ParseRelabelConfigsData(prc, false); err != nil {
return fmt.Errorf("cannot parse relabelConfigs: %w", err)
}
return nil
Expand Down
10 changes: 6 additions & 4 deletions controllers/factory/k8stools/sts.go
Expand Up @@ -34,6 +34,12 @@ func HandleSTSUpdate(ctx context.Context, rclient client.Client, cr STSOptions,
return err
}

if !isRecreated {
if err := rclient.Update(ctx, newSts); err != nil {
return fmt.Errorf("cannot perform update on sts: %s, err: %w", newSts.Name, err)
}
}

if err := performRollingUpdateOnSts(ctx, isRecreated, rclient, newSts.Name, newSts.Namespace, cr.SelectorLabels(), c); err != nil {
return fmt.Errorf("cannot update statefulset for vmalertmanager: %w", err)
}
Expand All @@ -42,10 +48,6 @@ func HandleSTSUpdate(ctx context.Context, rclient client.Client, cr STSOptions,
return err
}

if !isRecreated {
return rclient.Update(ctx, newSts)
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion docs/api.MD
Expand Up @@ -669,7 +669,7 @@ VMAgentSpec defines the desired state of VMAgent
| ignoreNamespaceSelectors | IgnoreNamespaceSelectors if set to true will ignore NamespaceSelector settings from the podscrape and vmservicescrape configs, and they will only discover endpoints within their current namespace. Defaults to false. | bool | false |
| enforcedNamespaceLabel | EnforcedNamespaceLabel enforces adding a namespace label of origin for each alert and metric that is user created. The label value will always be the namespace of the object that is being created. | string | false |
| vmAgentExternalLabelName | VMAgentExternalLabelName Name of vmAgent external label used to denote vmAgent instance name. Defaults to the value of `prometheus`. External label will _not_ be added when value is set to empty string (`\"\"`). | *string | false |
| externalLabels | ExternalLabels The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, etc). | map[string]string | false |
| externalLabels | ExternalLabels The labels to add to any time series scraped by vmagent. it doesn't affect metrics ingested directly by push API's | map[string]string | false |
| remoteWrite | RemoteWrite list of victoria metrics /some other remote write system for vm it must looks like: http://victoria-metrics-single:8429/api/v1/write or for cluster different url https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/app/vmagent#splitting-data-streams-among-multiple-systems | [][VMAgentRemoteWriteSpec](#vmagentremotewritespec) | true |
| remoteWriteSettings | RemoteWriteSettings defines global settings for all remoteWrite urls. | *[VMAgentRemoteWriteSettings](#vmagentremotewritesettings) | false |
| relabelConfig | RelabelConfig ConfigMap with global relabel config -remoteWrite.relabelConfig This relabeling is applied to all the collected metrics before sending them to remote storage. | *v1.ConfigMapKeySelector | false |
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Expand Up @@ -3,30 +3,30 @@ module github.com/VictoriaMetrics/operator
go 1.16

require (
github.com/VictoriaMetrics/VictoriaMetrics v1.60.0
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/VictoriaMetrics/VictoriaMetrics v1.68.0
github.com/fsnotify/fsnotify v1.4.9
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/go-logr/logr v0.4.0
github.com/go-test/deep v1.0.7
github.com/hashicorp/go-version v1.3.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/prometheus-operator/prometheus-operator v0.48.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.48.1
github.com/prometheus-operator/prometheus-operator/pkg/client v0.48.1
github.com/prometheus-operator/prometheus-operator v0.52.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.52.0
github.com/prometheus-operator/prometheus-operator/pkg/client v0.52.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
go.uber.org/zap v1.17.0
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023
go.uber.org/zap v1.19.1
golang.org/x/net v0.0.0-20211020060615-d418f374d309
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.21.1
k8s.io/apiextensions-apiserver v0.21.1 // indirect
k8s.io/apimachinery v0.21.1
k8s.io/api v0.22.3
k8s.io/apiextensions-apiserver v0.22.3
k8s.io/apimachinery v0.22.3
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog/v2 v2.8.0
k8s.io/utils v0.0.0-20210527160623-6fdb442a123b
k8s.io/klog/v2 v2.10.0
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
sigs.k8s.io/controller-runtime v0.9.0

)
Expand Down

0 comments on commit 670ea1e

Please sign in to comment.