From 74a4341a26d557ec6bc43acb909b3acd5f7f1f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20N=C3=BA=C3=B1ez-Cacho=20Solans?= Date: Thu, 11 Aug 2022 11:59:14 +0200 Subject: [PATCH 1/3] modify old info by infof --- controllers/actions.go | 11 ++++++----- controllers/decommission.go | 5 +++-- controllers/envoyfilterobject.go | 2 +- controllers/ratelimit_controller.go | 5 +++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/controllers/actions.go b/controllers/actions.go index cdeb6b9..e9f2008 100644 --- a/controllers/actions.go +++ b/controllers/actions.go @@ -3,17 +3,18 @@ package controllers import ( "context" "encoding/json" + "reflect" + "regexp" + "strconv" + "time" + "github.com/ghodss/yaml" networkingv1alpha1 "github.com/softonic/rate-limit-operator/api/v1alpha1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog" - "reflect" - "regexp" "sigs.k8s.io/controller-runtime/pkg/client" - "strconv" - "time" "github.com/softonic/rate-limit-operator/api/istio_v1alpha3" ) @@ -186,7 +187,7 @@ func (r *RateLimitReconciler) getDestinationClusterFromVirtualService(namespace virtualService, err := r.getVirtualService(namespace, nameVirtualService) if err != nil { - klog.Infof("Virtualservice %s does not exists. Error:", nameVirtualService, err) + klog.Infof("Virtualservice %s does not exists. Error: %s", nameVirtualService, err) return "", err } else { klog.Infof("found the %s", nameVirtualService) diff --git a/controllers/decommission.go b/controllers/decommission.go index e50d2df..a2cf08b 100644 --- a/controllers/decommission.go +++ b/controllers/decommission.go @@ -2,6 +2,7 @@ package controllers import ( "context" + v1 "k8s.io/api/core/v1" "k8s.io/klog" @@ -121,12 +122,12 @@ func (r *RateLimitReconciler) decomissionDeploymentVolumes(sources []v1.VolumePr func (r *RateLimitReconciler) removeVolumeFromDeployment(sources []v1.VolumeProjection, volumes []v1.Volume) error { for _, v := range r.DeploymentRL.Spec.Template.Spec.Volumes { - klog.Info("Volumes already deployed in deployment are: %v", v) + klog.Infof("Volumes already deployed in deployment are: %v", v) if v.Name == "commonconfig-volume" && len(v.VolumeSource.Projected.Sources) > 1 { i := 0 klog.Info("Entering first for: there are more than 1 sources and the volume is the correct one") for _, n := range v.VolumeSource.Projected.Sources { - klog.Info("the source is: %v", n) + klog.Infof("the source is: %v", n) for _, p := range sources { if n.ConfigMap.Name == p.ConfigMap.Name { } else { diff --git a/controllers/envoyfilterobject.go b/controllers/envoyfilterobject.go index 62d3401..50126e9 100644 --- a/controllers/envoyfilterobject.go +++ b/controllers/envoyfilterobject.go @@ -36,7 +36,7 @@ func (r *RateLimitReconciler) prepareUpdateEnvoyFilterObjects(rateLimitInstance virtualService, err := r.getVirtualService(namespace, nameVirtualService) if err != nil { - klog.Infof("Virtualservice does not exists", err) + klog.Infof("Virtualservice does not exists. Error: %v", err) } gatewayIngress := strings.Split(virtualService.Spec.Gateways[0], "/") diff --git a/controllers/ratelimit_controller.go b/controllers/ratelimit_controller.go index 271a2ed..7caea32 100644 --- a/controllers/ratelimit_controller.go +++ b/controllers/ratelimit_controller.go @@ -18,10 +18,11 @@ package controllers import ( "context" - "k8s.io/apimachinery/pkg/types" "os" "sync" + "k8s.io/apimachinery/pkg/types" + appsv1 "k8s.io/api/apps/v1" "github.com/go-logr/logr" @@ -101,7 +102,7 @@ func (r *RateLimitReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { volumeProjectedSources := constructVolumeSources(baseName) - klog.Info("The volumeProjectedSources is: %v", volumeProjectedSources) + klog.Infof("The volumeProjectedSources is: %v", volumeProjectedSources) // DECOMMISSION From 561d7f2d5f829ec7a4b7437be1cb8611fc1ad642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20N=C3=BA=C3=B1ez-Cacho=20Solans?= Date: Thu, 11 Aug 2022 11:59:32 +0200 Subject: [PATCH 2/3] deprecated apiVersions --- chart/rate-limit-operator/templates/clusterrole.yaml | 2 +- config/rbac/auth_proxy_client_clusterrole.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chart/rate-limit-operator/templates/clusterrole.yaml b/chart/rate-limit-operator/templates/clusterrole.yaml index 63bafc4..0cb3c3a 100644 --- a/chart/rate-limit-operator/templates/clusterrole.yaml +++ b/chart/rate-limit-operator/templates/clusterrole.yaml @@ -132,7 +132,7 @@ rules: --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ include "rate-limit-operator.fullname" . }}-metrics-reader diff --git a/config/rbac/auth_proxy_client_clusterrole.yaml b/config/rbac/auth_proxy_client_clusterrole.yaml index 7d62534..bd4af13 100644 --- a/config/rbac/auth_proxy_client_clusterrole.yaml +++ b/config/rbac/auth_proxy_client_clusterrole.yaml @@ -1,4 +1,4 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: metrics-reader From 5400dbdfbfa65a94ab3b31c2d76be025a0bee36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20N=C3=BA=C3=B1ez-Cacho=20Solans?= Date: Thu, 11 Aug 2022 12:00:17 +0200 Subject: [PATCH 3/3] update golang.org/x/sys --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 8e0a782..8d92fff 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/onsi/ginkgo v1.12.1 github.com/onsi/gomega v1.10.1 + golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect google.golang.org/genproto v0.0.0-20200731012542-8145dea6a485 gopkg.in/yaml.v2 v2.3.0 k8s.io/api v0.18.8 diff --git a/go.sum b/go.sum index 597a4fe..a195b7f 100644 --- a/go.sum +++ b/go.sum @@ -1443,6 +1443,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f h1:Fqb3ao1hUmOR3GkUOg/Y+BadLwykBIzs5q8Ez2SbHyc= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 h1:v1W7bwXHsnLLloWYTVEdvGvA7BHMeBYsPcF0GLDxIRs= +golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=