Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
EVEREST-496 remove unused vmagent functions
Browse files Browse the repository at this point in the history
  • Loading branch information
recharte committed Feb 7, 2024
1 parent 698d2a5 commit 0dce13f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 231 deletions.
34 changes: 0 additions & 34 deletions pkg/kubernetes/monitoring_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

everestv1alpha1 "github.com/percona/everest-operator/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

const (
Expand Down Expand Up @@ -76,39 +75,6 @@ func (k *Kubernetes) IsMonitoringConfigUsed(ctx context.Context, namespace, moni
return false, nil
}

// SecretNamesFromVMAgent returns a list of secret names as used by VMAgent's remoteWrite password field.
func (k *Kubernetes) SecretNamesFromVMAgent(vmAgent *unstructured.Unstructured) []string {
rws, ok, err := unstructured.NestedSlice(vmAgent.Object, "spec", "remoteWrite")
if err != nil {
// We can ignore the error because it has to be an interface.
k.l.Debug(err)
}
if !ok {
return []string{}
}

res := make([]string, 0, len(rws))
for _, rw := range rws {
rw, ok := rw.(map[string]interface{})
if !ok {
continue
}

secretName, ok, err := unstructured.NestedString(rw, "basicAuth", "password", "name")
if err != nil {
// We can ignore the error because it has to be a string.
k.l.Debug(err)
continue
}
if !ok {
continue
}
res = append(res, secretName)
}

return res
}

// GetMonitoringConfigsBySecretName returns a list of monitoring configs which use
// the provided secret name.
func (k *Kubernetes) GetMonitoringConfigsBySecretName(
Expand Down
197 changes: 0 additions & 197 deletions pkg/kubernetes/vmagent.go

This file was deleted.

0 comments on commit 0dce13f

Please sign in to comment.