Skip to content

Commit

Permalink
Merge pull request #31 from softonic/feat/upgrade-deprecated-api-vers…
Browse files Browse the repository at this point in the history
…ions

Feat/upgrade deprecated api versions
  • Loading branch information
santinoncs authored Aug 11, 2022
2 parents 602e4ae + 5400dbd commit 969e16d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion chart/rate-limit-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/auth_proxy_client_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-reader
Expand Down
11 changes: 6 additions & 5 deletions controllers/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions controllers/decommission.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controllers

import (
"context"

v1 "k8s.io/api/core/v1"
"k8s.io/klog"

Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion controllers/envoyfilterobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -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], "/")
Expand Down
5 changes: 3 additions & 2 deletions controllers/ratelimit_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 969e16d

Please sign in to comment.