From 21897571796b0542159353188e2ce782b64a4de5 Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Mon, 22 Jan 2024 21:25:07 +0800 Subject: [PATCH] delete functionally similar yaml packages Signed-off-by: LiZhenCheng9527 --- go.mod | 2 +- .../application/rollout_helper.go | 2 +- .../testdata/prometheus-additional.yaml | 82 ++++++++++++++----- pkg/plugin/prometheus/util.go | 2 +- pkg/util/policy_test.go | 2 +- 5 files changed, 64 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index ec688a631..efba8f9f8 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,6 @@ require ( github.com/vmware-tanzu/velero v1.11.1 golang.org/x/crypto v0.16.0 gopkg.in/square/go-jose.v2 v2.6.0 - gopkg.in/yaml.v3 v3.0.1 helm.sh/helm/v3 v3.12.3 istio.io/api v0.0.0-20231006162241-350617755635 istio.io/istio v0.0.0-20231011021742-2dddcc9c9238 @@ -246,6 +245,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect istio.io/client-go v1.18.4-0.20231006163629-bd311827a565 // indirect k8s.io/cluster-bootstrap v0.27.8 // indirect k8s.io/gengo v0.0.0-20230306165830-ab3349d207d4 // indirect diff --git a/pkg/fleet-manager/application/rollout_helper.go b/pkg/fleet-manager/application/rollout_helper.go index e0bce3458..21a75918b 100644 --- a/pkg/fleet-manager/application/rollout_helper.go +++ b/pkg/fleet-manager/application/rollout_helper.go @@ -27,9 +27,9 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/yaml" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/yaml" applicationapi "kurator.dev/kurator/pkg/apis/apps/v1alpha1" fleetapi "kurator.dev/kurator/pkg/apis/fleet/v1alpha1" diff --git a/pkg/plugin/prometheus/testdata/prometheus-additional.yaml b/pkg/plugin/prometheus/testdata/prometheus-additional.yaml index ae94c002e..5de4b7520 100644 --- a/pkg/plugin/prometheus/testdata/prometheus-additional.yaml +++ b/pkg/plugin/prometheus/testdata/prometheus-additional.yaml @@ -1,26 +1,64 @@ -- job_name: remote1 - honor_timestamps: false - params: +- BodySizeLimit: 0B + HTTPClientConfig: + enable_http2: true + follow_redirects: true + proxy_url: null + tls_config: + insecure_skip_verify: false + HonorLabels: false + HonorTimestamps: false + JobName: remote1 + KeepDroppedTargets: 0 + LabelLimit: 0 + LabelNameLengthLimit: 0 + LabelValueLengthLimit: 0 + MetricRelabelConfigs: null + MetricsPath: /federate + NativeHistogramBucketLimit: 0 + Params: match[]: - - '{__name__=~".+"}' - metrics_path: /federate - follow_redirects: true - enable_http2: true - static_configs: - - targets: - - remote1.cluster:9090 - labels: + - '{__name__=~".+"}' + RelabelConfigs: null + SampleLimit: 0 + Scheme: "" + ScrapeClassicHistograms: false + ScrapeInterval: 0s + ScrapeTimeout: 0s + ServiceDiscoveryConfigs: + - - labels: cluster: remote1 -- job_name: remote2 - honor_timestamps: false - params: + targets: + - remote1.cluster:9090 + TargetLimit: 0 +- BodySizeLimit: 0B + HTTPClientConfig: + enable_http2: true + follow_redirects: true + proxy_url: null + tls_config: + insecure_skip_verify: false + HonorLabels: false + HonorTimestamps: false + JobName: remote2 + KeepDroppedTargets: 0 + LabelLimit: 0 + LabelNameLengthLimit: 0 + LabelValueLengthLimit: 0 + MetricRelabelConfigs: null + MetricsPath: /federate + NativeHistogramBucketLimit: 0 + Params: match[]: - - '{__name__=~".+"}' - metrics_path: /federate - follow_redirects: true - enable_http2: true - static_configs: - - targets: - - remote2.cluster:9090 - labels: + - '{__name__=~".+"}' + RelabelConfigs: null + SampleLimit: 0 + Scheme: "" + ScrapeClassicHistograms: false + ScrapeInterval: 0s + ScrapeTimeout: 0s + ServiceDiscoveryConfigs: + - - labels: cluster: remote2 + targets: + - remote2.cluster:9090 + TargetLimit: 0 diff --git a/pkg/plugin/prometheus/util.go b/pkg/plugin/prometheus/util.go index bbcb09db8..5f4192da5 100644 --- a/pkg/plugin/prometheus/util.go +++ b/pkg/plugin/prometheus/util.go @@ -24,7 +24,7 @@ import ( "github.com/prometheus/common/model" promcfg "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/discovery" - "gopkg.in/yaml.v3" + "sigs.k8s.io/yaml" ) type endpoint struct { diff --git a/pkg/util/policy_test.go b/pkg/util/policy_test.go index 85cb2fad5..a3f51ff22 100644 --- a/pkg/util/policy_test.go +++ b/pkg/util/policy_test.go @@ -31,9 +31,9 @@ import ( apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/yaml" cmdtesting "k8s.io/kubectl/pkg/cmd/testing" "k8s.io/kubectl/pkg/scheme" + "sigs.k8s.io/yaml" "kurator.dev/kurator/pkg/typemeta" )