From b719427337ed33c83b08c687c0a3d3b2afe2f196 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 11 Sep 2024 14:42:44 +0800 Subject: [PATCH 01/14] Add validation for primaryScalerReplicas counts Signed-off-by: Aufar Gilbran --- artifacts/flagger/crd.yaml | 6 ++++-- charts/flagger/crds/crd.yaml | 6 ++++-- kustomize/base/flagger/crd.yaml | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 99940df06..d7184dc24 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -129,9 +129,11 @@ spec: type: object properties: minReplicas: - type: number + type: integer + minimum: 1 maxReplicas: - type: number + type: integer + minimum: 1 ingressRef: description: Ingress selector type: object diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index 99940df06..d7184dc24 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -129,9 +129,11 @@ spec: type: object properties: minReplicas: - type: number + type: integer + minimum: 1 maxReplicas: - type: number + type: integer + minimum: 1 ingressRef: description: Ingress selector type: object diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 99940df06..d7184dc24 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -129,9 +129,11 @@ spec: type: object properties: minReplicas: - type: number + type: integer + minimum: 1 maxReplicas: - type: number + type: integer + minimum: 1 ingressRef: description: Ingress selector type: object From 9941843385ed85c81075fb8e49f4ec572b74dfb6 Mon Sep 17 00:00:00 2001 From: Mingjie Li Date: Fri, 18 Oct 2024 19:52:02 +0200 Subject: [PATCH 02/14] fix #1712 : sort gateway api header fileter to fix canary restart Signed-off-by: Mingjie Li --- pkg/router/gateway_api.go | 18 ++++++ pkg/router/gateway_api_test.go | 88 ++++++++------------------ pkg/router/gateway_api_v1beta1.go | 17 +++++ pkg/router/gateway_api_v1beta1_test.go | 40 ++++++++++++ 4 files changed, 100 insertions(+), 63 deletions(-) diff --git a/pkg/router/gateway_api.go b/pkg/router/gateway_api.go index dd4ecd49f..b16075e93 100644 --- a/pkg/router/gateway_api.go +++ b/pkg/router/gateway_api.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "reflect" + "sort" "strings" flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" @@ -647,10 +648,23 @@ func (gwr *GatewayAPIRouter) mergeMatchConditions(analysis, service []v1.HTTPRou return merged } +func sortFiltersV1(headers []v1.HTTPHeader) { + + if headers != nil { + sort.Slice(headers, func(i, j int) bool { + if headers[i].Name == headers[j].Name { + return headers[i].Value < headers[j].Value + } + return headers[i].Name < headers[j].Name + }) + } +} + func (gwr *GatewayAPIRouter) makeFilters(canary *flaggerv1.Canary) []v1.HTTPRouteFilter { var filters []v1.HTTPRouteFilter if canary.Spec.Service.Headers != nil { + if canary.Spec.Service.Headers.Request != nil { requestHeaderFilter := v1.HTTPRouteFilter{ Type: v1.HTTPRouteFilterRequestHeaderModifier, @@ -663,6 +677,7 @@ func (gwr *GatewayAPIRouter) makeFilters(canary *flaggerv1.Canary) []v1.HTTPRout Value: val, }) } + sortFiltersV1(requestHeaderFilter.RequestHeaderModifier.Add) for name, val := range canary.Spec.Service.Headers.Request.Set { requestHeaderFilter.RequestHeaderModifier.Set = append(requestHeaderFilter.RequestHeaderModifier.Set, v1.HTTPHeader{ Name: v1.HTTPHeaderName(name), @@ -670,6 +685,7 @@ func (gwr *GatewayAPIRouter) makeFilters(canary *flaggerv1.Canary) []v1.HTTPRout }) } + sortFiltersV1(requestHeaderFilter.RequestHeaderModifier.Set) for _, name := range canary.Spec.Service.Headers.Request.Remove { requestHeaderFilter.RequestHeaderModifier.Remove = append(requestHeaderFilter.RequestHeaderModifier.Remove, name) } @@ -688,12 +704,14 @@ func (gwr *GatewayAPIRouter) makeFilters(canary *flaggerv1.Canary) []v1.HTTPRout Value: val, }) } + sortFiltersV1(responseHeaderFilter.ResponseHeaderModifier.Add) for name, val := range canary.Spec.Service.Headers.Response.Set { responseHeaderFilter.ResponseHeaderModifier.Set = append(responseHeaderFilter.ResponseHeaderModifier.Set, v1.HTTPHeader{ Name: v1.HTTPHeaderName(name), Value: val, }) } + sortFiltersV1(responseHeaderFilter.ResponseHeaderModifier.Set) for _, name := range canary.Spec.Service.Headers.Response.Remove { responseHeaderFilter.ResponseHeaderModifier.Remove = append(responseHeaderFilter.ResponseHeaderModifier.Remove, name) diff --git a/pkg/router/gateway_api_test.go b/pkg/router/gateway_api_test.go index b03b5ab8e..88b34fdda 100644 --- a/pkg/router/gateway_api_test.go +++ b/pkg/router/gateway_api_test.go @@ -24,7 +24,9 @@ import ( flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" v1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" + istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -276,13 +278,18 @@ func TestGatewayAPIRouter_Routes(t *testing.T) { }) } -func TestGatewayAPIRouter_getSessionAffinityRouteRules(t *testing.T) { +func TestGatewayAPIRouter_makeFilters(t *testing.T) { canary := newTestGatewayAPICanary() mocks := newFixture(canary) - cookieKey := "flagger-cookie" - canary.Spec.Analysis.SessionAffinity = &flaggerv1.SessionAffinity{ - CookieName: cookieKey, - MaxAge: 300, + canary.Spec.Service.Headers = &istiov1beta1.Headers{ + Response: &istiov1beta1.HeaderOperations{ + Set: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + Add: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + }, + Request: &istiov1beta1.HeaderOperations{ + Set: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + Add: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + }, } router := &GatewayAPIRouter{ @@ -290,65 +297,20 @@ func TestGatewayAPIRouter_getSessionAffinityRouteRules(t *testing.T) { kubeClient: mocks.kubeClient, logger: mocks.logger, } - _, pSvcName, cSvcName := canary.GetServiceNames() - weightedRouteRule := &v1.HTTPRouteRule{ - BackendRefs: []v1.HTTPBackendRef{ - { - BackendRef: router.makeBackendRef(pSvcName, initialPrimaryWeight, canary.Spec.Service.Port), - }, - { - BackendRef: router.makeBackendRef(cSvcName, initialCanaryWeight, canary.Spec.Service.Port), - }, - }, - } - rules, err := router.getSessionAffinityRouteRules(canary, 10, weightedRouteRule) - require.NoError(t, err) - assert.Equal(t, len(rules), 2) - assert.True(t, strings.HasPrefix(canary.Status.SessionAffinityCookie, cookieKey)) - - stickyRule := rules[0] - cookieMatch := stickyRule.Matches[0].Headers[0] - assert.Equal(t, *cookieMatch.Type, v1.HeaderMatchRegularExpression) - assert.Equal(t, string(cookieMatch.Name), cookieHeader) - assert.Contains(t, cookieMatch.Value, cookieKey) - - assert.Equal(t, len(stickyRule.BackendRefs), 2) - for _, backendRef := range stickyRule.BackendRefs { - if string(backendRef.BackendRef.Name) == pSvcName { - assert.Equal(t, *backendRef.BackendRef.Weight, int32(0)) - } - if string(backendRef.BackendRef.Name) == cSvcName { - assert.Equal(t, *backendRef.BackendRef.Weight, int32(100)) - } + + ignoreCmpOptions := []cmp.Option{ + cmpopts.IgnoreFields(v1.BackendRef{}, "Weight"), + cmpopts.EquateEmpty(), } - weightedRule := rules[1] - var found bool - for _, backendRef := range weightedRule.BackendRefs { - if string(backendRef.Name) == cSvcName { - found = true - filter := backendRef.Filters[0] - assert.Equal(t, filter.Type, v1.HTTPRouteFilterResponseHeaderModifier) - assert.NotNil(t, filter.ResponseHeaderModifier) - assert.Equal(t, string(filter.ResponseHeaderModifier.Add[0].Name), setCookieHeader) - assert.Equal(t, filter.ResponseHeaderModifier.Add[0].Value, fmt.Sprintf("%s; %s=%d", canary.Status.SessionAffinityCookie, maxAgeAttr, 300)) - } + filters := router.makeFilters(canary) + + for i := 0; i < 10; i++ { + newFilters := router.makeFilters(canary) + filtersDiff := cmp.Diff( + filters, newFilters, + ignoreCmpOptions..., + ) + assert.Equal(t, "", filtersDiff) } - assert.True(t, found) - - rules, err = router.getSessionAffinityRouteRules(canary, 0, weightedRouteRule) - assert.Empty(t, canary.Status.SessionAffinityCookie) - assert.Contains(t, canary.Status.PreviousSessionAffinityCookie, cookieKey) - - stickyRule = rules[0] - cookieMatch = stickyRule.Matches[0].Headers[0] - assert.Equal(t, *cookieMatch.Type, v1.HeaderMatchRegularExpression) - assert.Equal(t, string(cookieMatch.Name), cookieHeader) - assert.Contains(t, cookieMatch.Value, cookieKey) - - assert.Equal(t, stickyRule.Filters[0].Type, v1.HTTPRouteFilterResponseHeaderModifier) - headerModifier := stickyRule.Filters[0].ResponseHeaderModifier - assert.NotNil(t, headerModifier) - assert.Equal(t, string(headerModifier.Add[0].Name), setCookieHeader) - assert.Equal(t, headerModifier.Add[0].Value, fmt.Sprintf("%s; %s=%d", canary.Status.PreviousSessionAffinityCookie, maxAgeAttr, -1)) } diff --git a/pkg/router/gateway_api_v1beta1.go b/pkg/router/gateway_api_v1beta1.go index 1d2468020..fd389fe77 100644 --- a/pkg/router/gateway_api_v1beta1.go +++ b/pkg/router/gateway_api_v1beta1.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "reflect" + "sort" "strings" flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" @@ -608,6 +609,18 @@ func (gwr *GatewayAPIV1Beta1Router) mergeMatchConditions(analysis, service []v1b return merged } +func sortFiltersV1beta1(headers []v1beta1.HTTPHeader) { + + if headers != nil { + sort.Slice(headers, func(i, j int) bool { + if headers[i].Name == headers[j].Name { + return headers[i].Value < headers[j].Value + } + return headers[i].Name < headers[j].Name + }) + } +} + func (gwr *GatewayAPIV1Beta1Router) makeFilters(canary *flaggerv1.Canary) []v1beta1.HTTPRouteFilter { var filters []v1beta1.HTTPRouteFilter @@ -624,12 +637,14 @@ func (gwr *GatewayAPIV1Beta1Router) makeFilters(canary *flaggerv1.Canary) []v1be Value: val, }) } + sortFiltersV1beta1(requestHeaderFilter.RequestHeaderModifier.Add) for name, val := range canary.Spec.Service.Headers.Request.Set { requestHeaderFilter.RequestHeaderModifier.Set = append(requestHeaderFilter.RequestHeaderModifier.Set, v1beta1.HTTPHeader{ Name: v1beta1.HTTPHeaderName(name), Value: val, }) } + sortFiltersV1beta1(requestHeaderFilter.RequestHeaderModifier.Set) for _, name := range canary.Spec.Service.Headers.Request.Remove { requestHeaderFilter.RequestHeaderModifier.Remove = append(requestHeaderFilter.RequestHeaderModifier.Remove, name) @@ -649,12 +664,14 @@ func (gwr *GatewayAPIV1Beta1Router) makeFilters(canary *flaggerv1.Canary) []v1be Value: val, }) } + sortFiltersV1beta1(responseHeaderFilter.ResponseHeaderModifier.Add) for name, val := range canary.Spec.Service.Headers.Response.Set { responseHeaderFilter.ResponseHeaderModifier.Set = append(responseHeaderFilter.ResponseHeaderModifier.Set, v1beta1.HTTPHeader{ Name: v1beta1.HTTPHeaderName(name), Value: val, }) } + sortFiltersV1beta1(responseHeaderFilter.ResponseHeaderModifier.Set) for _, name := range canary.Spec.Service.Headers.Response.Remove { responseHeaderFilter.ResponseHeaderModifier.Remove = append(responseHeaderFilter.ResponseHeaderModifier.Remove, name) diff --git a/pkg/router/gateway_api_v1beta1_test.go b/pkg/router/gateway_api_v1beta1_test.go index 647061c32..8652aae7c 100644 --- a/pkg/router/gateway_api_v1beta1_test.go +++ b/pkg/router/gateway_api_v1beta1_test.go @@ -23,8 +23,11 @@ import ( "testing" flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" + v1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1" + istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -349,3 +352,40 @@ func TestGatewayAPIV1Beta1Router_getSessionAffinityRouteRules(t *testing.T) { assert.Equal(t, string(headerModifier.Add[0].Name), setCookieHeader) assert.Equal(t, headerModifier.Add[0].Value, fmt.Sprintf("%s; %s=%d", canary.Status.PreviousSessionAffinityCookie, maxAgeAttr, -1)) } + +func TestGatewayAPIV1Beta1Router_makeFilters(t *testing.T) { + canary := newTestGatewayAPICanary() + mocks := newFixture(canary) + canary.Spec.Service.Headers = &istiov1beta1.Headers{ + Response: &istiov1beta1.HeaderOperations{ + Set: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + Add: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + }, + Request: &istiov1beta1.HeaderOperations{ + Set: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + Add: map[string]string{"h1": "v1", "h2": "v2", "h3": "v3"}, + }, + } + + router := &GatewayAPIV1Beta1Router{ + gatewayAPIClient: mocks.meshClient, + kubeClient: mocks.kubeClient, + logger: mocks.logger, + } + + ignoreCmpOptions := []cmp.Option{ + cmpopts.IgnoreFields(v1.BackendRef{}, "Weight"), + cmpopts.EquateEmpty(), + } + + filters := router.makeFilters(canary) + + for i := 0; i < 10; i++ { + newFilters := router.makeFilters(canary) + filtersDiff := cmp.Diff( + filters, newFilters, + ignoreCmpOptions..., + ) + assert.Equal(t, "", filtersDiff) + } +} From b88e080a6616a9728309f6956bf9c82c38afb436 Mon Sep 17 00:00:00 2001 From: Mingjie Li Date: Sat, 26 Oct 2024 16:48:02 +0200 Subject: [PATCH 03/14] add test back and use slices.SortFunc Signed-off-by: Mingjie Li --- pkg/router/gateway_api.go | 10 ++-- pkg/router/gateway_api_test.go | 77 +++++++++++++++++++++++++++++++ pkg/router/gateway_api_v1beta1.go | 10 ++-- 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/pkg/router/gateway_api.go b/pkg/router/gateway_api.go index b16075e93..7d2ae79d1 100644 --- a/pkg/router/gateway_api.go +++ b/pkg/router/gateway_api.go @@ -20,7 +20,7 @@ import ( "context" "fmt" "reflect" - "sort" + "slices" "strings" flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" @@ -651,11 +651,11 @@ func (gwr *GatewayAPIRouter) mergeMatchConditions(analysis, service []v1.HTTPRou func sortFiltersV1(headers []v1.HTTPHeader) { if headers != nil { - sort.Slice(headers, func(i, j int) bool { - if headers[i].Name == headers[j].Name { - return headers[i].Value < headers[j].Value + slices.SortFunc(headers, func(a, b v1.HTTPHeader) int { + if a.Name == b.Name { + return strings.Compare(a.Value, b.Value) } - return headers[i].Name < headers[j].Name + return strings.Compare(string(a.Name), string(b.Name)) }) } } diff --git a/pkg/router/gateway_api_test.go b/pkg/router/gateway_api_test.go index 88b34fdda..a7d6b6d89 100644 --- a/pkg/router/gateway_api_test.go +++ b/pkg/router/gateway_api_test.go @@ -278,6 +278,83 @@ func TestGatewayAPIRouter_Routes(t *testing.T) { }) } +func TestGatewayAPIRouter_getSessionAffinityRouteRules(t *testing.T) { + canary := newTestGatewayAPICanary() + mocks := newFixture(canary) + cookieKey := "flagger-cookie" + canary.Spec.Analysis.SessionAffinity = &flaggerv1.SessionAffinity{ + CookieName: cookieKey, + MaxAge: 300, + } + + router := &GatewayAPIRouter{ + gatewayAPIClient: mocks.meshClient, + kubeClient: mocks.kubeClient, + logger: mocks.logger, + } + _, pSvcName, cSvcName := canary.GetServiceNames() + weightedRouteRule := &v1.HTTPRouteRule{ + BackendRefs: []v1.HTTPBackendRef{ + { + BackendRef: router.makeBackendRef(pSvcName, initialPrimaryWeight, canary.Spec.Service.Port), + }, + { + BackendRef: router.makeBackendRef(cSvcName, initialCanaryWeight, canary.Spec.Service.Port), + }, + }, + } + rules, err := router.getSessionAffinityRouteRules(canary, 10, weightedRouteRule) + require.NoError(t, err) + assert.Equal(t, len(rules), 2) + assert.True(t, strings.HasPrefix(canary.Status.SessionAffinityCookie, cookieKey)) + + stickyRule := rules[0] + cookieMatch := stickyRule.Matches[0].Headers[0] + assert.Equal(t, *cookieMatch.Type, v1.HeaderMatchRegularExpression) + assert.Equal(t, string(cookieMatch.Name), cookieHeader) + assert.Contains(t, cookieMatch.Value, cookieKey) + + assert.Equal(t, len(stickyRule.BackendRefs), 2) + for _, backendRef := range stickyRule.BackendRefs { + if string(backendRef.BackendRef.Name) == pSvcName { + assert.Equal(t, *backendRef.BackendRef.Weight, int32(0)) + } + if string(backendRef.BackendRef.Name) == cSvcName { + assert.Equal(t, *backendRef.BackendRef.Weight, int32(100)) + } + } + + weightedRule := rules[1] + var found bool + for _, backendRef := range weightedRule.BackendRefs { + if string(backendRef.Name) == cSvcName { + found = true + filter := backendRef.Filters[0] + assert.Equal(t, filter.Type, v1.HTTPRouteFilterResponseHeaderModifier) + assert.NotNil(t, filter.ResponseHeaderModifier) + assert.Equal(t, string(filter.ResponseHeaderModifier.Add[0].Name), setCookieHeader) + assert.Equal(t, filter.ResponseHeaderModifier.Add[0].Value, fmt.Sprintf("%s; %s=%d", canary.Status.SessionAffinityCookie, maxAgeAttr, 300)) + } + } + assert.True(t, found) + + rules, err = router.getSessionAffinityRouteRules(canary, 0, weightedRouteRule) + assert.Empty(t, canary.Status.SessionAffinityCookie) + assert.Contains(t, canary.Status.PreviousSessionAffinityCookie, cookieKey) + + stickyRule = rules[0] + cookieMatch = stickyRule.Matches[0].Headers[0] + assert.Equal(t, *cookieMatch.Type, v1.HeaderMatchRegularExpression) + assert.Equal(t, string(cookieMatch.Name), cookieHeader) + assert.Contains(t, cookieMatch.Value, cookieKey) + + assert.Equal(t, stickyRule.Filters[0].Type, v1.HTTPRouteFilterResponseHeaderModifier) + headerModifier := stickyRule.Filters[0].ResponseHeaderModifier + assert.NotNil(t, headerModifier) + assert.Equal(t, string(headerModifier.Add[0].Name), setCookieHeader) + assert.Equal(t, headerModifier.Add[0].Value, fmt.Sprintf("%s; %s=%d", canary.Status.PreviousSessionAffinityCookie, maxAgeAttr, -1)) +} + func TestGatewayAPIRouter_makeFilters(t *testing.T) { canary := newTestGatewayAPICanary() mocks := newFixture(canary) diff --git a/pkg/router/gateway_api_v1beta1.go b/pkg/router/gateway_api_v1beta1.go index fd389fe77..e9042ea28 100644 --- a/pkg/router/gateway_api_v1beta1.go +++ b/pkg/router/gateway_api_v1beta1.go @@ -20,7 +20,7 @@ import ( "context" "fmt" "reflect" - "sort" + "slices" "strings" flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" @@ -612,11 +612,11 @@ func (gwr *GatewayAPIV1Beta1Router) mergeMatchConditions(analysis, service []v1b func sortFiltersV1beta1(headers []v1beta1.HTTPHeader) { if headers != nil { - sort.Slice(headers, func(i, j int) bool { - if headers[i].Name == headers[j].Name { - return headers[i].Value < headers[j].Value + slices.SortFunc(headers, func(a, b v1beta1.HTTPHeader) int { + if a.Name == b.Name { + return strings.Compare(a.Value, b.Value) } - return headers[i].Name < headers[j].Name + return strings.Compare(string(a.Name), string(b.Name)) }) } } From e99add460ff26ac8f90d52c14393d494320bf9dd Mon Sep 17 00:00:00 2001 From: swimablefish Date: Mon, 11 Nov 2024 15:18:02 +0800 Subject: [PATCH 04/14] fix(helm): podinfo fails to create the hpa object Signed-off-by: swimablefish --- charts/podinfo/Chart.yaml | 2 +- charts/podinfo/templates/hpa.yaml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/charts/podinfo/Chart.yaml b/charts/podinfo/Chart.yaml index 3f93ed964..36227edaf 100644 --- a/charts/podinfo/Chart.yaml +++ b/charts/podinfo/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -version: 6.1.3 +version: 6.1.4 appVersion: 6.1.3 name: podinfo engine: gotpl diff --git a/charts/podinfo/templates/hpa.yaml b/charts/podinfo/templates/hpa.yaml index 224fb344c..84ec6c08f 100644 --- a/charts/podinfo/templates/hpa.yaml +++ b/charts/podinfo/templates/hpa.yaml @@ -20,12 +20,16 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: {{ .Values.hpa.cpu }} + target: + type: Utilization + averageUtilization: {{ .Values.hpa.cpu }} {{- end }} {{- if .Values.hpa.memory }} - type: Resource resource: name: memory - targetAverageValue: {{ .Values.hpa.memory }} + target: + type: AverageValue + averageValue: {{ .Values.hpa.memory }} {{- end }} {{- end }} From 8f838388e88989c59b234c43944cb80b29303fa3 Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Date: Thu, 3 Oct 2024 18:59:43 -0500 Subject: [PATCH 05/14] feat: add disableTls option for webhooks request Signed-off-by: Juan Rodriguez --- artifacts/flagger/crd.yaml | 3 +++ charts/flagger/crds/crd.yaml | 3 +++ docs/gitbook/usage/webhooks.md | 5 +++- kustomize/base/flagger/crd.yaml | 3 +++ pkg/apis/flagger/v1beta1/canary.go | 4 +++ pkg/controller/webhook.go | 42 +++++++++++++++++++----------- pkg/controller/webhook_test.go | 19 ++++++++++++++ 7 files changed, 63 insertions(+), 16 deletions(-) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 99940df06..2db00bb55 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -1135,6 +1135,9 @@ spec: retries: description: Number of retries for this webhook type: number + disableTLS: + description: Disable TLS verification for this webhook + type: boolean metadata: description: Metadata (key-value pairs) for this webhook type: object diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index 99940df06..2db00bb55 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -1135,6 +1135,9 @@ spec: retries: description: Number of retries for this webhook type: number + disableTLS: + description: Disable TLS verification for this webhook + type: boolean metadata: description: Metadata (key-value pairs) for this webhook type: object diff --git a/docs/gitbook/usage/webhooks.md b/docs/gitbook/usage/webhooks.md index 994885b67..f37d549c6 100644 --- a/docs/gitbook/usage/webhooks.md +++ b/docs/gitbook/usage/webhooks.md @@ -124,7 +124,10 @@ Event payload (HTTP POST): The event receiver can create alerts based on the received phase (possible values: `Initialized`, `Waiting`, `Progressing`, `Promoting`, `Finalising`, `Succeeded` or `Failed`). -The webhook request can be retried by specifying a positive integer in the `retries` field. +Options: +* retries: The webhook request can be retried by specifying a positive integer in the `retries` field. This helps ensure reliability if the webhook fails due to transient network issues. + +* disable TLS: Set `disableTLS` to `true` in the webhook spec to bypass TLS verification. This is useful in cases where the target service uses self-signed certificates, or you need to connect to an insecure service for testing purposes. ## Load Testing diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 99940df06..2db00bb55 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -1135,6 +1135,9 @@ spec: retries: description: Number of retries for this webhook type: number + disableTLS: + description: Disable TLS verification for this webhook + type: boolean metadata: description: Metadata (key-value pairs) for this webhook type: object diff --git a/pkg/apis/flagger/v1beta1/canary.go b/pkg/apis/flagger/v1beta1/canary.go index 93fe004ed..f5797e876 100644 --- a/pkg/apis/flagger/v1beta1/canary.go +++ b/pkg/apis/flagger/v1beta1/canary.go @@ -398,6 +398,10 @@ type CanaryWebhook struct { // Number of retries for this webhook // +optional Retries int `json:"retries,omitempty"` + + // Disable TLS verification for this webhook + // +optional + DisableTLS bool `json:"disableTLS,omitempty"` } // CanaryWebhookPayload holds the deployment info and metadata sent to webhooks diff --git a/pkg/controller/webhook.go b/pkg/controller/webhook.go index 5b08bd85d..cf8dcd89b 100644 --- a/pkg/controller/webhook.go +++ b/pkg/controller/webhook.go @@ -18,10 +18,12 @@ package controller import ( "bytes" + "crypto/tls" "encoding/json" "errors" "fmt" "io" + "net/http" "net/url" "strconv" "time" @@ -32,28 +34,32 @@ import ( "github.com/fluxcd/flagger/pkg/canary" ) -func callWebhook(webhook string, payload interface{}, timeout string, retries int) error { - payloadBin, err := json.Marshal(payload) - if err != nil { - return err +func newHTTPClient(retries int, timeout time.Duration, disableTls bool) *retryablehttp.Client { + httpClient := retryablehttp.NewClient() + httpClient.RetryMax = retries + httpClient.Logger = nil + httpClient.HTTPClient.Timeout = timeout + + if disableTls { + httpClient.HTTPClient.Transport = &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } } - hook, err := url.Parse(webhook) + return httpClient +} + +func callWebhook(webhook string, payload interface{}, timeout string, retries int, disableTls bool) error { + payloadBin, err := json.Marshal(payload) if err != nil { return err } - httpClient := retryablehttp.NewClient() - httpClient.RetryMax = retries - httpClient.Logger = nil - - req, err := retryablehttp.NewRequest("POST", hook.String(), bytes.NewBuffer(payloadBin)) + hook, err := url.Parse(webhook) if err != nil { return err } - req.Header.Set("Content-Type", "application/json") - if timeout == "" { timeout = "10s" } @@ -62,7 +68,13 @@ func callWebhook(webhook string, payload interface{}, timeout string, retries in return err } - httpClient.HTTPClient.Timeout = t + httpClient := newHTTPClient(retries, t, disableTls) + + req, err := retryablehttp.NewRequest("POST", hook.String(), bytes.NewBuffer(payloadBin)) + if err != nil { + return err + } + req.Header.Set("Content-Type", "application/json") r, err := httpClient.Do(req) if err != nil { @@ -100,7 +112,7 @@ func CallWebhook(canary flaggerv1.Canary, phase flaggerv1.CanaryPhase, w flagger w.Timeout = "10s" } - return callWebhook(w.URL, payload, w.Timeout, w.Retries) + return callWebhook(w.URL, payload, w.Timeout, w.Retries, w.DisableTLS) } func CallEventWebhook(r *flaggerv1.Canary, w flaggerv1.CanaryWebhook, message, eventtype string) error { @@ -126,7 +138,7 @@ func CallEventWebhook(r *flaggerv1.Canary, w flaggerv1.CanaryWebhook, message, e payload.Metadata[key] = value } } - return callWebhook(w.URL, payload, "5s", w.Retries) + return callWebhook(w.URL, payload, "5s", w.Retries, w.DisableTLS) } func canaryChecksum(c flaggerv1.Canary) string { diff --git a/pkg/controller/webhook_test.go b/pkg/controller/webhook_test.go index d651da006..9d0022e2f 100644 --- a/pkg/controller/webhook_test.go +++ b/pkg/controller/webhook_test.go @@ -289,3 +289,22 @@ func TestCallWebhook_Retries(t *testing.T) { flaggerv1.CanaryPhaseProgressing, hook) require.NoError(t, err) } + +func TestCallWebhook_DisableTLS(t *testing.T) { + ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusAccepted) + })) + defer ts.Close() + hook := flaggerv1.CanaryWebhook{ + Name: "validation", + URL: ts.URL, + DisableTLS: true, + } + + err := CallWebhook( + flaggerv1.Canary{ + ObjectMeta: metav1.ObjectMeta{ + Name: "podinfo", Namespace: corev1.NamespaceDefault}}, + flaggerv1.CanaryPhaseProgressing, hook) + require.NoError(t, err) +} From 682230e8c0d8854df6ef4d51255bae40841c22b4 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Sat, 23 Nov 2024 11:31:29 +0200 Subject: [PATCH 06/14] Update dependencies to Kubernetes v1.31.3 Signed-off-by: Stefan Prodan --- go.mod | 93 ++++++++++++------------- go.sum | 209 +++++++++++++++++++++++++++++++-------------------------- 2 files changed, 160 insertions(+), 142 deletions(-) diff --git a/go.mod b/go.mod index 575c985ae..46d9f6e71 100644 --- a/go.mod +++ b/go.mod @@ -3,53 +3,53 @@ module github.com/fluxcd/flagger go 1.22.0 require ( - cloud.google.com/go/monitoring v1.19.0 - github.com/Masterminds/semver/v3 v3.2.1 - github.com/aws/aws-sdk-go v1.53.12 - github.com/davecgh/go-spew v1.1.1 + cloud.google.com/go/monitoring v1.21.2 + github.com/Masterminds/semver/v3 v3.3.1 + github.com/aws/aws-sdk-go v1.55.5 + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/go-logr/zapr v1.3.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/googleapis/gax-go/v2 v2.12.4 + github.com/googleapis/gax-go/v2 v2.14.0 github.com/hashicorp/go-retryablehttp v0.7.7 github.com/influxdata/influxdb-client-go/v2 v2.13.0 - github.com/prometheus/client_golang v1.19.1 + github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 - golang.org/x/sync v0.7.0 - google.golang.org/api v0.182.0 - google.golang.org/genproto v0.0.0-20240528184218-531527333157 - google.golang.org/grpc v1.64.1 - google.golang.org/protobuf v1.34.1 + golang.org/x/sync v0.9.0 + google.golang.org/api v0.205.0 + google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.1 gopkg.in/h2non/gock.v1 v1.1.2 - k8s.io/api v0.30.3 - k8s.io/apimachinery v0.30.3 - k8s.io/client-go v0.30.3 - k8s.io/code-generator v0.30.3 - k8s.io/klog/v2 v2.120.1 + k8s.io/api v0.31.3 + k8s.io/apimachinery v0.31.3 + k8s.io/client-go v0.31.3 + k8s.io/code-generator v0.31.3 + k8s.io/klog/v2 v2.130.1 ) require ( - cloud.google.com/go/auth v0.4.2 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect + cloud.google.com/go/auth v0.10.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect + cloud.google.com/go/compute/metadata v0.5.2 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.22.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/s2a-go v0.1.7 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/google/s2a-go v0.1.8 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/imdario/mergo v0.3.15 // indirect @@ -57,41 +57,44 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oapi-codegen/runtime v1.0.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/x448/float16 v0.8.4 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect - go.opentelemetry.io/otel v1.24.0 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect + go.opentelemetry.io/otel v1.29.0 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect + go.opentelemetry.io/otel/trace v1.29.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.5.0 // indirect + golang.org/x/crypto v0.29.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.31.0 // indirect + golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/term v0.26.0 // indirect + golang.org/x/text v0.20.0 // indirect + golang.org/x/time v0.8.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 655532281..15ad47023 100644 --- a/go.sum +++ b/go.sum @@ -1,45 +1,48 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go/auth v0.4.2 h1:sb0eyLkhRtpq5jA+a8KWw0W70YcdVca7KJ8TM0AFYDg= -cloud.google.com/go/auth v0.4.2/go.mod h1:Kqvlz1cf1sNA0D+sYJnkPQOP+JMHkuHeIgVmCRtZOLc= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/monitoring v1.19.0 h1:NCXf8hfQi+Kmr56QJezXRZ6GPb80ZI7El1XztyUuLQI= -cloud.google.com/go/monitoring v1.19.0/go.mod h1:25IeMR5cQ5BoZ8j1eogHE5VPJLlReQ7zFp5OiLgiGZw= +cloud.google.com/go/auth v0.10.1 h1:TnK46qldSfHWt2a0b/hciaiVJsmDXWy9FqyUan0uYiI= +cloud.google.com/go/auth v0.10.1/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= +cloud.google.com/go/auth/oauth2adapt v0.2.5 h1:2p29+dePqsCHPP1bqDJcKj4qxRyYCcbzKpFyKGt3MTk= +cloud.google.com/go/auth/oauth2adapt v0.2.5/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= +cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= +cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= +cloud.google.com/go/monitoring v1.21.2 h1:FChwVtClH19E7pJ+e0xUhJPGksctZNVOk2UhMmblmdU= +cloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+WFX8g2hqVEZU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= +github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= -github.com/aws/aws-sdk-go v1.53.12 h1:8f8K+YaTy2qwtGwVIo2Ftq22UCH96xQAX7Q0lyZKDiA= -github.com/aws/aws-sdk-go v1.53.12/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -48,10 +51,11 @@ github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -84,17 +88,17 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg= -github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI= +github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= +github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= +github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= +github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -120,6 +124,8 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -127,6 +133,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -144,25 +152,26 @@ github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= github.com/oapi-codegen/runtime v1.0.0/go.mod h1:LmCUMQuPB4M/nLXilQXhHw+BLZdDb18B34OO356yJ/A= -github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= -github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= -github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= -github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= -github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= @@ -175,18 +184,22 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -196,16 +209,16 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -215,32 +228,32 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -255,26 +268,26 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.182.0 h1:if5fPvudRQ78GeRx3RayIoiuV7modtErPIZC/T2bIvE= -google.golang.org/api v0.182.0/go.mod h1:cGhjy4caqA5yXRzEhkHI8Y9mfyC2VLTlER2l08xaqtM= +google.golang.org/api v0.205.0 h1:LFaxkAIpDb/GsrWV20dMMo5MR0h8UARTbn24LmD+0Pg= +google.golang.org/api v0.205.0/go.mod h1:NrK1EMqO8Xk6l6QwRAmrXXg2v6dzukhlOyvkYtnvUuc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20240528184218-531527333157 h1:u7WMYrIrVvs0TF5yaKwKNbcJyySYf+HAIFXxWltJOXE= -google.golang.org/genproto v0.0.0-20240528184218-531527333157/go.mod h1:ubQlAQnzejB8uZzszhrTCU2Fyp6Vi7ZE5nn0c3W8+qQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e h1:SkdGTrROJl2jRGT/Fxv5QUf9jtdKCQh4KQJXbXVLAi0= -google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e/go.mod h1:LweJcLbyVij6rCex8YunD8DYR5VDonap/jYl3ZRxcIU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e h1:Elxv5MwEkCI9f5SkoL6afed6NTdxaGoAo39eANBwHL8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 h1:Q3nlH8iSQSRUwOskjbcSMcF2jiYMNiQYZ0c2KEJLKKU= +google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38/go.mod h1:xBI+tzfqGGN2JBeSebfKXFSdBpWVQ7sLW40PTupVRm4= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -284,11 +297,13 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= @@ -301,25 +316,25 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= -k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= -k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= -k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= -k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= -k8s.io/code-generator v0.30.3 h1:bmtnLJKagDS5f5uOEpLyJiDfIMKXGMKgOLBdde+w0Mc= -k8s.io/code-generator v0.30.3/go.mod h1:PFgBiv+miFV7TZYp+RXgROkhA+sWYZ+mtpbMLofMke8= +k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8= +k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE= +k8s.io/apimachinery v0.31.3 h1:6l0WhcYgasZ/wk9ktLq5vLaoXJJr5ts6lkaQzgeYPq4= +k8s.io/apimachinery v0.31.3/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.3 h1:CAlZuM+PH2cm+86LOBemaJI/lQ5linJ6UFxKX/SoG+4= +k8s.io/client-go v0.31.3/go.mod h1:2CgjPUTpv3fE5dNygAr2NcM8nhHzXvxB8KL5gYc3kJs= +k8s.io/code-generator v0.31.3 h1:Pj0fYOBms+ZrsulLi4DMsCEx1jG8fWKRLy44onHsLBI= +k8s.io/code-generator v0.31.3/go.mod h1:/umCIlT84g1+Yu5ZXtP1KGSRTnGiIzzX5AzUAxsNlts= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From 398fc90cc0e933e197c8b7096b256f79a134ae80 Mon Sep 17 00:00:00 2001 From: Sanskar Jaiswal Date: Sat, 23 Nov 2024 18:12:21 +0530 Subject: [PATCH 07/14] fix: fix codegen script and update generated code Signed-off-by: Sanskar Jaiswal --- hack/update-codegen.sh | 10 ++-- pkg/apis/gloo/register.go | 3 +- pkg/apis/gloo/{gloo => }/v1/doc.go | 0 pkg/apis/gloo/{gloo => }/v1/register.go | 0 pkg/apis/gloo/{gloo => }/v1/types.go | 9 ++- .../{gloo => }/v1/zz_generated.deepcopy.go | 35 ++++++------ pkg/apis/gloogateway/register.go | 5 ++ .../{gloo/gateway => gloogateway}/v1/doc.go | 0 .../gateway => gloogateway}/v1/register.go | 4 +- .../{gloo/gateway => gloogateway}/v1/types.go | 0 .../v1/zz_generated.deepcopy.go | 0 pkg/client/clientset/versioned/clientset.go | 56 +++++++++---------- .../versioned/fake/clientset_generated.go | 30 +++++----- .../clientset/versioned/fake/register.go | 10 ++-- .../clientset/versioned/scheme/register.go | 10 ++-- .../typed/gloo/v1/fake/fake_upstream.go | 2 +- .../versioned/typed/gloo/v1/gloo_client.go | 2 +- .../versioned/typed/gloo/v1/upstream.go | 2 +- .../typed/{gateway => gloogateway}/v1/doc.go | 0 .../{gateway => gloogateway}/v1/fake/doc.go | 0 .../v1/fake/fake_gloogateway_client.go} | 2 +- .../v1/fake/fake_routetable.go | 2 +- .../v1/generated_expansion.go | 0 .../v1/gloogateway_client.go} | 2 +- .../{gateway => gloogateway}/v1/routetable.go | 2 +- .../externalversions/appmesh/interface.go | 14 ++--- .../informers/externalversions/factory.go | 26 ++++++--- .../externalversions/gatewayapi/interface.go | 14 ++--- .../informers/externalversions/generic.go | 4 +- .../externalversions/gloo/v1/upstream.go | 2 +- .../{gateway => gloogateway}/interface.go | 4 +- .../{gateway => gloogateway}/v1/interface.go | 0 .../{gateway => gloogateway}/v1/routetable.go | 8 +-- pkg/client/listers/gloo/v1/upstream.go | 2 +- .../v1/expansion_generated.go | 0 .../{gateway => gloogateway}/v1/routetable.go | 2 +- pkg/router/gloo.go | 4 +- pkg/router/gloo_test.go | 2 +- 38 files changed, 144 insertions(+), 124 deletions(-) rename pkg/apis/gloo/{gloo => }/v1/doc.go (100%) rename pkg/apis/gloo/{gloo => }/v1/register.go (100%) rename pkg/apis/gloo/{gloo => }/v1/types.go (95%) rename pkg/apis/gloo/{gloo => }/v1/zz_generated.deepcopy.go (95%) create mode 100644 pkg/apis/gloogateway/register.go rename pkg/apis/{gloo/gateway => gloogateway}/v1/doc.go (100%) rename pkg/apis/{gloo/gateway => gloogateway}/v1/register.go (86%) rename pkg/apis/{gloo/gateway => gloogateway}/v1/types.go (100%) rename pkg/apis/{gloo/gateway => gloogateway}/v1/zz_generated.deepcopy.go (100%) rename pkg/client/clientset/versioned/typed/{gateway => gloogateway}/v1/doc.go (100%) rename pkg/client/clientset/versioned/typed/{gateway => gloogateway}/v1/fake/doc.go (100%) rename pkg/client/clientset/versioned/typed/{gateway/v1/fake/fake_gateway_client.go => gloogateway/v1/fake/fake_gloogateway_client.go} (98%) rename pkg/client/clientset/versioned/typed/{gateway => gloogateway}/v1/fake/fake_routetable.go (98%) rename pkg/client/clientset/versioned/typed/{gateway => gloogateway}/v1/generated_expansion.go (100%) rename pkg/client/clientset/versioned/typed/{gateway/v1/gateway_client.go => gloogateway/v1/gloogateway_client.go} (98%) rename pkg/client/clientset/versioned/typed/{gateway => gloogateway}/v1/routetable.go (99%) rename pkg/client/informers/externalversions/{gateway => gloogateway}/interface.go (97%) rename pkg/client/informers/externalversions/{gateway => gloogateway}/v1/interface.go (100%) rename pkg/client/informers/externalversions/{gateway => gloogateway}/v1/routetable.go (93%) rename pkg/client/listers/{gateway => gloogateway}/v1/expansion_generated.go (100%) rename pkg/client/listers/{gateway => gloogateway}/v1/routetable.go (98%) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 9002d0e12..74211e31b 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -34,14 +34,16 @@ mkdir -p "${TEMP_DIR}/${PACKAGE_PATH_BASE}/pkg/client/informers" \ # Ensure we can execute. chmod +x ${CODEGEN_PKG}/kube_codegen.sh -source ${CODEGEN_PKG}/kube_codegen.sh kube::codegen::gen_client \ - --output-dir "${TEMP_DIR}" \ +source ${CODEGEN_PKG}/kube_codegen.sh + +kube::codegen::gen_client \ + --output-dir "${TEMP_DIR}/${PACKAGE_PATH_BASE}/pkg/client" \ --output-pkg "${PACKAGE_PATH_BASE}/pkg/client" \ --with-watch \ --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ - ./pkgs/apis + ./pkg/apis -ls -lha $TEMP_DIR +tree $TEMP_DIR/${PACKAGE_PATH_BASE/pkg/client}/ # Copy everything back. cp -r "${TEMP_DIR}/${PACKAGE_PATH_BASE}/." "${SCRIPT_ROOT}/" diff --git a/pkg/apis/gloo/register.go b/pkg/apis/gloo/register.go index 723e95226..d4d694f33 100644 --- a/pkg/apis/gloo/register.go +++ b/pkg/apis/gloo/register.go @@ -1,6 +1,5 @@ package gloo const ( - GlooGroupName = "gloo.solo.io" - GatewayGroupName = "gateway.solo.io" + GlooGroupName = "gloo.solo.io" ) diff --git a/pkg/apis/gloo/gloo/v1/doc.go b/pkg/apis/gloo/v1/doc.go similarity index 100% rename from pkg/apis/gloo/gloo/v1/doc.go rename to pkg/apis/gloo/v1/doc.go diff --git a/pkg/apis/gloo/gloo/v1/register.go b/pkg/apis/gloo/v1/register.go similarity index 100% rename from pkg/apis/gloo/gloo/v1/register.go rename to pkg/apis/gloo/v1/register.go diff --git a/pkg/apis/gloo/gloo/v1/types.go b/pkg/apis/gloo/v1/types.go similarity index 95% rename from pkg/apis/gloo/gloo/v1/types.go rename to pkg/apis/gloo/v1/types.go index d181972d0..02065ca36 100644 --- a/pkg/apis/gloo/gloo/v1/types.go +++ b/pkg/apis/gloo/v1/types.go @@ -1,7 +1,6 @@ package v1 import ( - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -44,7 +43,7 @@ type UpstreamSslConfig struct { /** SSLSecrets -- only one of these should be set */ *UpstreamSslConfig_Sds `json:"sds,omitempty"` - SecretRef *v1.ResourceRef `json:"secretRef,omitempty"` + SecretRef *ResourceRef `json:"secretRef,omitempty"` *UpstreamSslConfig_SslFiles `json:"sslFiles,omitempty"` } @@ -139,3 +138,9 @@ type UpstreamList struct { Items []Upstream `json:"items"` } + +// ResourceRef references resources across namespaces +type ResourceRef struct { + Name string `json:"name,omitempty"` + Namespace string `json:"namespace,omitempty"` +} diff --git a/pkg/apis/gloo/gloo/v1/zz_generated.deepcopy.go b/pkg/apis/gloo/v1/zz_generated.deepcopy.go similarity index 95% rename from pkg/apis/gloo/gloo/v1/zz_generated.deepcopy.go rename to pkg/apis/gloo/v1/zz_generated.deepcopy.go index 9a5d75865..6f2313c32 100644 --- a/pkg/apis/gloo/gloo/v1/zz_generated.deepcopy.go +++ b/pkg/apis/gloo/v1/zz_generated.deepcopy.go @@ -1,28 +1,11 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -/* -Copyright 2020 The Flux authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - // Code generated by deepcopy-gen. DO NOT EDIT. package v1 import ( - gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -228,6 +211,22 @@ func (in *LoadBalancerConfigRoundRobin) DeepCopy() *LoadBalancerConfigRoundRobin return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceRef) DeepCopyInto(out *ResourceRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRef. +func (in *ResourceRef) DeepCopy() *ResourceRef { + if in == nil { + return nil + } + out := new(ResourceRef) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SlowStartConfig) DeepCopyInto(out *SlowStartConfig) { *out = *in @@ -403,7 +402,7 @@ func (in *UpstreamSslConfig) DeepCopyInto(out *UpstreamSslConfig) { } if in.SecretRef != nil { in, out := &in.SecretRef, &out.SecretRef - *out = new(gatewayv1.ResourceRef) + *out = new(ResourceRef) **out = **in } if in.UpstreamSslConfig_SslFiles != nil { diff --git a/pkg/apis/gloogateway/register.go b/pkg/apis/gloogateway/register.go new file mode 100644 index 000000000..27908df0c --- /dev/null +++ b/pkg/apis/gloogateway/register.go @@ -0,0 +1,5 @@ +package gloogateway + +const ( + GatewayGroupName = "gateway.solo.io" +) diff --git a/pkg/apis/gloo/gateway/v1/doc.go b/pkg/apis/gloogateway/v1/doc.go similarity index 100% rename from pkg/apis/gloo/gateway/v1/doc.go rename to pkg/apis/gloogateway/v1/doc.go diff --git a/pkg/apis/gloo/gateway/v1/register.go b/pkg/apis/gloogateway/v1/register.go similarity index 86% rename from pkg/apis/gloo/gateway/v1/register.go rename to pkg/apis/gloogateway/v1/register.go index 9b541ed40..a61695b8c 100755 --- a/pkg/apis/gloo/gateway/v1/register.go +++ b/pkg/apis/gloogateway/v1/register.go @@ -1,14 +1,14 @@ package v1 import ( - "github.com/fluxcd/flagger/pkg/apis/gloo" + "github.com/fluxcd/flagger/pkg/apis/gloogateway" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: gloo.GatewayGroupName, Version: "v1"} +var SchemeGroupVersion = schema.GroupVersion{Group: gloogateway.GatewayGroupName, Version: "v1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind func Kind(kind string) schema.GroupKind { diff --git a/pkg/apis/gloo/gateway/v1/types.go b/pkg/apis/gloogateway/v1/types.go similarity index 100% rename from pkg/apis/gloo/gateway/v1/types.go rename to pkg/apis/gloogateway/v1/types.go diff --git a/pkg/apis/gloo/gateway/v1/zz_generated.deepcopy.go b/pkg/apis/gloogateway/v1/zz_generated.deepcopy.go similarity index 100% rename from pkg/apis/gloo/gateway/v1/zz_generated.deepcopy.go rename to pkg/apis/gloogateway/v1/zz_generated.deepcopy.go diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index bde8b926e..c7e159c2e 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -26,10 +26,10 @@ import ( appmeshv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/appmesh/v1beta1" appmeshv1beta2 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/appmesh/v1beta2" flaggerv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/flagger/v1beta1" - gatewayv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gateway/v1" gatewayapiv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1" gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1" gloov1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloo/v1" + gatewayv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloogateway/v1" networkingv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1" kedav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/keda/v1alpha1" kumav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/kuma/v1alpha1" @@ -46,13 +46,13 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface ApisixV2() apisixv2.ApisixV2Interface - AppmeshV1beta2() appmeshv1beta2.AppmeshV1beta2Interface AppmeshV1beta1() appmeshv1beta1.AppmeshV1beta1Interface + AppmeshV1beta2() appmeshv1beta2.AppmeshV1beta2Interface FlaggerV1beta1() flaggerv1beta1.FlaggerV1beta1Interface - GatewayV1() gatewayv1.GatewayV1Interface - GatewayapiV1beta1() gatewayapiv1beta1.GatewayapiV1beta1Interface GatewayapiV1() gatewayapiv1.GatewayapiV1Interface + GatewayapiV1beta1() gatewayapiv1beta1.GatewayapiV1beta1Interface GlooV1() gloov1.GlooV1Interface + GatewayV1() gatewayv1.GatewayV1Interface NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface KedaV1alpha1() kedav1alpha1.KedaV1alpha1Interface KumaV1alpha1() kumav1alpha1.KumaV1alpha1Interface @@ -67,13 +67,13 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient apisixV2 *apisixv2.ApisixV2Client - appmeshV1beta2 *appmeshv1beta2.AppmeshV1beta2Client appmeshV1beta1 *appmeshv1beta1.AppmeshV1beta1Client + appmeshV1beta2 *appmeshv1beta2.AppmeshV1beta2Client flaggerV1beta1 *flaggerv1beta1.FlaggerV1beta1Client - gatewayV1 *gatewayv1.GatewayV1Client - gatewayapiV1beta1 *gatewayapiv1beta1.GatewayapiV1beta1Client gatewayapiV1 *gatewayapiv1.GatewayapiV1Client + gatewayapiV1beta1 *gatewayapiv1beta1.GatewayapiV1beta1Client glooV1 *gloov1.GlooV1Client + gatewayV1 *gatewayv1.GatewayV1Client networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client kedaV1alpha1 *kedav1alpha1.KedaV1alpha1Client kumaV1alpha1 *kumav1alpha1.KumaV1alpha1Client @@ -89,24 +89,24 @@ func (c *Clientset) ApisixV2() apisixv2.ApisixV2Interface { return c.apisixV2 } -// AppmeshV1beta2 retrieves the AppmeshV1beta2Client -func (c *Clientset) AppmeshV1beta2() appmeshv1beta2.AppmeshV1beta2Interface { - return c.appmeshV1beta2 -} - // AppmeshV1beta1 retrieves the AppmeshV1beta1Client func (c *Clientset) AppmeshV1beta1() appmeshv1beta1.AppmeshV1beta1Interface { return c.appmeshV1beta1 } +// AppmeshV1beta2 retrieves the AppmeshV1beta2Client +func (c *Clientset) AppmeshV1beta2() appmeshv1beta2.AppmeshV1beta2Interface { + return c.appmeshV1beta2 +} + // FlaggerV1beta1 retrieves the FlaggerV1beta1Client func (c *Clientset) FlaggerV1beta1() flaggerv1beta1.FlaggerV1beta1Interface { return c.flaggerV1beta1 } -// GatewayV1 retrieves the GatewayV1Client -func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { - return c.gatewayV1 +// GatewayapiV1 retrieves the GatewayapiV1Client +func (c *Clientset) GatewayapiV1() gatewayapiv1.GatewayapiV1Interface { + return c.gatewayapiV1 } // GatewayapiV1beta1 retrieves the GatewayapiV1beta1Client @@ -114,16 +114,16 @@ func (c *Clientset) GatewayapiV1beta1() gatewayapiv1beta1.GatewayapiV1beta1Inter return c.gatewayapiV1beta1 } -// GatewayapiV1 retrieves the GatewayapiV1Client -func (c *Clientset) GatewayapiV1() gatewayapiv1.GatewayapiV1Interface { - return c.gatewayapiV1 -} - // GlooV1 retrieves the GlooV1Client func (c *Clientset) GlooV1() gloov1.GlooV1Interface { return c.glooV1 } +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return c.gatewayV1 +} + // NetworkingV1beta1 retrieves the NetworkingV1beta1Client func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { return c.networkingV1beta1 @@ -212,11 +212,11 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } - cs.appmeshV1beta2, err = appmeshv1beta2.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.appmeshV1beta1, err = appmeshv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.appmeshV1beta1, err = appmeshv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.appmeshV1beta2, err = appmeshv1beta2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -224,7 +224,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } - cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayapiV1, err = gatewayapiv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -232,11 +232,11 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } - cs.gatewayapiV1, err = gatewayapiv1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.glooV1, err = gloov1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.glooV1, err = gloov1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -294,13 +294,13 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.apisixV2 = apisixv2.New(c) - cs.appmeshV1beta2 = appmeshv1beta2.New(c) cs.appmeshV1beta1 = appmeshv1beta1.New(c) + cs.appmeshV1beta2 = appmeshv1beta2.New(c) cs.flaggerV1beta1 = flaggerv1beta1.New(c) - cs.gatewayV1 = gatewayv1.New(c) - cs.gatewayapiV1beta1 = gatewayapiv1beta1.New(c) cs.gatewayapiV1 = gatewayapiv1.New(c) + cs.gatewayapiV1beta1 = gatewayapiv1beta1.New(c) cs.glooV1 = gloov1.New(c) + cs.gatewayV1 = gatewayv1.New(c) cs.networkingV1beta1 = networkingv1beta1.New(c) cs.kedaV1alpha1 = kedav1alpha1.New(c) cs.kumaV1alpha1 = kumav1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index c0fe650b6..518bdf0c1 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -28,14 +28,14 @@ import ( fakeappmeshv1beta2 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake" flaggerv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/flagger/v1beta1" fakeflaggerv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake" - gatewayv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gateway/v1" - fakegatewayv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gateway/v1/fake" gatewayapiv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1" fakegatewayapiv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1/fake" gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1" fakegatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/fake" gloov1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloo/v1" fakegloov1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloo/v1/fake" + gatewayv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloogateway/v1" + fakegatewayv1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloogateway/v1/fake" networkingv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1" fakenetworkingv1beta1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/istio/v1beta1/fake" kedav1alpha1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/keda/v1alpha1" @@ -114,24 +114,24 @@ func (c *Clientset) ApisixV2() apisixv2.ApisixV2Interface { return &fakeapisixv2.FakeApisixV2{Fake: &c.Fake} } -// AppmeshV1beta2 retrieves the AppmeshV1beta2Client -func (c *Clientset) AppmeshV1beta2() appmeshv1beta2.AppmeshV1beta2Interface { - return &fakeappmeshv1beta2.FakeAppmeshV1beta2{Fake: &c.Fake} -} - // AppmeshV1beta1 retrieves the AppmeshV1beta1Client func (c *Clientset) AppmeshV1beta1() appmeshv1beta1.AppmeshV1beta1Interface { return &fakeappmeshv1beta1.FakeAppmeshV1beta1{Fake: &c.Fake} } +// AppmeshV1beta2 retrieves the AppmeshV1beta2Client +func (c *Clientset) AppmeshV1beta2() appmeshv1beta2.AppmeshV1beta2Interface { + return &fakeappmeshv1beta2.FakeAppmeshV1beta2{Fake: &c.Fake} +} + // FlaggerV1beta1 retrieves the FlaggerV1beta1Client func (c *Clientset) FlaggerV1beta1() flaggerv1beta1.FlaggerV1beta1Interface { return &fakeflaggerv1beta1.FakeFlaggerV1beta1{Fake: &c.Fake} } -// GatewayV1 retrieves the GatewayV1Client -func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { - return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} +// GatewayapiV1 retrieves the GatewayapiV1Client +func (c *Clientset) GatewayapiV1() gatewayapiv1.GatewayapiV1Interface { + return &fakegatewayapiv1.FakeGatewayapiV1{Fake: &c.Fake} } // GatewayapiV1beta1 retrieves the GatewayapiV1beta1Client @@ -139,16 +139,16 @@ func (c *Clientset) GatewayapiV1beta1() gatewayapiv1beta1.GatewayapiV1beta1Inter return &fakegatewayapiv1beta1.FakeGatewayapiV1beta1{Fake: &c.Fake} } -// GatewayapiV1 retrieves the GatewayapiV1Client -func (c *Clientset) GatewayapiV1() gatewayapiv1.GatewayapiV1Interface { - return &fakegatewayapiv1.FakeGatewayapiV1{Fake: &c.Fake} -} - // GlooV1 retrieves the GlooV1Client func (c *Clientset) GlooV1() gloov1.GlooV1Interface { return &fakegloov1.FakeGlooV1{Fake: &c.Fake} } +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} +} + // NetworkingV1beta1 retrieves the NetworkingV1beta1Client func (c *Clientset) NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface { return &fakenetworkingv1beta1.FakeNetworkingV1beta1{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 020e785bf..51ef71e0e 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -25,8 +25,8 @@ import ( flaggerv1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" gatewayapiv1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1" - gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" + gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" networkingv1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" kedav1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1" kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1" @@ -47,13 +47,13 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ apisixv2.AddToScheme, - appmeshv1beta2.AddToScheme, appmeshv1beta1.AddToScheme, + appmeshv1beta2.AddToScheme, flaggerv1beta1.AddToScheme, - gatewayv1.AddToScheme, - gatewayapiv1beta1.AddToScheme, gatewayapiv1.AddToScheme, + gatewayapiv1beta1.AddToScheme, gloov1.AddToScheme, + gatewayv1.AddToScheme, networkingv1beta1.AddToScheme, kedav1alpha1.AddToScheme, kumav1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 7f446ef79..2c7688f47 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -25,8 +25,8 @@ import ( flaggerv1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" gatewayapiv1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1" - gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" + gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" networkingv1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" kedav1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1" kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1" @@ -47,13 +47,13 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ apisixv2.AddToScheme, - appmeshv1beta2.AddToScheme, appmeshv1beta1.AddToScheme, + appmeshv1beta2.AddToScheme, flaggerv1beta1.AddToScheme, - gatewayv1.AddToScheme, - gatewayapiv1beta1.AddToScheme, gatewayapiv1.AddToScheme, + gatewayapiv1beta1.AddToScheme, gloov1.AddToScheme, + gatewayv1.AddToScheme, networkingv1beta1.AddToScheme, kedav1alpha1.AddToScheme, kumav1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go b/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go index 296740816..4d2d1cc84 100644 --- a/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go +++ b/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/gloo_client.go b/pkg/client/clientset/versioned/typed/gloo/v1/gloo_client.go index 5432ae164..fb2723127 100644 --- a/pkg/client/clientset/versioned/typed/gloo/v1/gloo_client.go +++ b/pkg/client/clientset/versioned/typed/gloo/v1/gloo_client.go @@ -21,7 +21,7 @@ package v1 import ( "net/http" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go b/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go index 8d4f2a503..9e465830f 100644 --- a/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go +++ b/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/doc.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/gateway/v1/doc.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/doc.go diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/gateway/v1/fake/doc.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/fake/doc.go diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/fake/fake_gateway_client.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_gloogateway_client.go similarity index 98% rename from pkg/client/clientset/versioned/typed/gateway/v1/fake/fake_gateway_client.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_gloogateway_client.go index 833ebf3b7..a26ac9479 100644 --- a/pkg/client/clientset/versioned/typed/gateway/v1/fake/fake_gateway_client.go +++ b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_gloogateway_client.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - v1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/client/clientset/versioned/typed/gloogateway/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/fake/fake_routetable.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go similarity index 98% rename from pkg/client/clientset/versioned/typed/gateway/v1/fake/fake_routetable.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go index 3b9090ac3..68eedfa47 100644 --- a/pkg/client/clientset/versioned/typed/gateway/v1/fake/fake_routetable.go +++ b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/generated_expansion.go similarity index 100% rename from pkg/client/clientset/versioned/typed/gateway/v1/generated_expansion.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/generated_expansion.go diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/gateway_client.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/gloogateway_client.go similarity index 98% rename from pkg/client/clientset/versioned/typed/gateway/v1/gateway_client.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/gloogateway_client.go index c3088829b..ac633e6c7 100644 --- a/pkg/client/clientset/versioned/typed/gateway/v1/gateway_client.go +++ b/pkg/client/clientset/versioned/typed/gloogateway/v1/gloogateway_client.go @@ -21,7 +21,7 @@ package v1 import ( "net/http" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/client/clientset/versioned/typed/gateway/v1/routetable.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go similarity index 99% rename from pkg/client/clientset/versioned/typed/gateway/v1/routetable.go rename to pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go index 695022a8b..cc7f2c9b5 100644 --- a/pkg/client/clientset/versioned/typed/gateway/v1/routetable.go +++ b/pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/client/informers/externalversions/appmesh/interface.go b/pkg/client/informers/externalversions/appmesh/interface.go index a1d7fb745..9e24e0d17 100644 --- a/pkg/client/informers/externalversions/appmesh/interface.go +++ b/pkg/client/informers/externalversions/appmesh/interface.go @@ -26,10 +26,10 @@ import ( // Interface provides access to each of this group's versions. type Interface interface { - // V1beta2 provides access to shared informers for resources in V1beta2. - V1beta2() v1beta2.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.Interface } type group struct { @@ -43,12 +43,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta2 returns a new v1beta2.Interface. -func (g *group) V1beta2() v1beta2.Interface { - return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) -} - // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 66f1e2369..014bac86e 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -27,9 +27,9 @@ import ( apisix "github.com/fluxcd/flagger/pkg/client/informers/externalversions/apisix" appmesh "github.com/fluxcd/flagger/pkg/client/informers/externalversions/appmesh" flagger "github.com/fluxcd/flagger/pkg/client/informers/externalversions/flagger" - gateway "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gateway" gatewayapi "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gatewayapi" gloo "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gloo" + gloogateway "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gloogateway" internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces" istio "github.com/fluxcd/flagger/pkg/client/informers/externalversions/istio" keda "github.com/fluxcd/flagger/pkg/client/informers/externalversions/keda" @@ -53,6 +53,7 @@ type sharedInformerFactory struct { lock sync.Mutex defaultResync time.Duration customResync map[reflect.Type]time.Duration + transform cache.TransformFunc informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -91,6 +92,14 @@ func WithNamespace(namespace string) SharedInformerOption { } } +// WithTransform sets a transform on all informers. +func WithTransform(transform cache.TransformFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.transform = transform + return factory + } +} + // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -177,7 +186,7 @@ func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[ref return res } -// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// InformerFor returns the SharedIndexInformer for obj using an internal // client. func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { f.lock.Lock() @@ -195,6 +204,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal } informer = newFunc(f.client, resyncPeriod) + informer.SetTransform(f.transform) f.informers[informerType] = informer return informer @@ -250,16 +260,16 @@ type SharedInformerFactory interface { // ForResource gives generic access to a shared informer of the matching type. ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - // InternalInformerFor returns the SharedIndexInformer for obj using an internal + // InformerFor returns the SharedIndexInformer for obj using an internal // client. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer Apisix() apisix.Interface Appmesh() appmesh.Interface Flagger() flagger.Interface - Gateway() gateway.Interface Gatewayapi() gatewayapi.Interface Gloo() gloo.Interface + Gateway() gloogateway.Interface Networking() istio.Interface Keda() keda.Interface Kuma() kuma.Interface @@ -280,10 +290,6 @@ func (f *sharedInformerFactory) Flagger() flagger.Interface { return flagger.New(f, f.namespace, f.tweakListOptions) } -func (f *sharedInformerFactory) Gateway() gateway.Interface { - return gateway.New(f, f.namespace, f.tweakListOptions) -} - func (f *sharedInformerFactory) Gatewayapi() gatewayapi.Interface { return gatewayapi.New(f, f.namespace, f.tweakListOptions) } @@ -292,6 +298,10 @@ func (f *sharedInformerFactory) Gloo() gloo.Interface { return gloo.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Gateway() gloogateway.Interface { + return gloogateway.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Networking() istio.Interface { return istio.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/gatewayapi/interface.go b/pkg/client/informers/externalversions/gatewayapi/interface.go index 3e1cb1652..81b645c5d 100644 --- a/pkg/client/informers/externalversions/gatewayapi/interface.go +++ b/pkg/client/informers/externalversions/gatewayapi/interface.go @@ -26,10 +26,10 @@ import ( // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface // V1 provides access to shared informers for resources in V1. V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface } type group struct { @@ -43,12 +43,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) -} - // V1 returns a new v1.Interface. func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 0158715f3..78431793a 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -27,8 +27,8 @@ import ( flaggerv1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" gatewayapiv1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" gatewayapiv1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1" - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" istiov1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" v1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1" kumav1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1" diff --git a/pkg/client/informers/externalversions/gloo/v1/upstream.go b/pkg/client/informers/externalversions/gloo/v1/upstream.go index 819b893b8..b8424978b 100644 --- a/pkg/client/informers/externalversions/gloo/v1/upstream.go +++ b/pkg/client/informers/externalversions/gloo/v1/upstream.go @@ -22,7 +22,7 @@ import ( "context" time "time" - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned" internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces" v1 "github.com/fluxcd/flagger/pkg/client/listers/gloo/v1" diff --git a/pkg/client/informers/externalversions/gateway/interface.go b/pkg/client/informers/externalversions/gloogateway/interface.go similarity index 97% rename from pkg/client/informers/externalversions/gateway/interface.go rename to pkg/client/informers/externalversions/gloogateway/interface.go index ba529a0e6..1728e9d02 100644 --- a/pkg/client/informers/externalversions/gateway/interface.go +++ b/pkg/client/informers/externalversions/gloogateway/interface.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package gateway +package gloogateway import ( - v1 "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/client/informers/externalversions/gloogateway/v1" internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces" ) diff --git a/pkg/client/informers/externalversions/gateway/v1/interface.go b/pkg/client/informers/externalversions/gloogateway/v1/interface.go similarity index 100% rename from pkg/client/informers/externalversions/gateway/v1/interface.go rename to pkg/client/informers/externalversions/gloogateway/v1/interface.go diff --git a/pkg/client/informers/externalversions/gateway/v1/routetable.go b/pkg/client/informers/externalversions/gloogateway/v1/routetable.go similarity index 93% rename from pkg/client/informers/externalversions/gateway/v1/routetable.go rename to pkg/client/informers/externalversions/gloogateway/v1/routetable.go index c86d190a3..c7b2fe8d9 100644 --- a/pkg/client/informers/externalversions/gateway/v1/routetable.go +++ b/pkg/client/informers/externalversions/gloogateway/v1/routetable.go @@ -22,10 +22,10 @@ import ( "context" time "time" - gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" + gloogatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" versioned "github.com/fluxcd/flagger/pkg/client/clientset/versioned" internalinterfaces "github.com/fluxcd/flagger/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/fluxcd/flagger/pkg/client/listers/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/client/listers/gloogateway/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -71,7 +71,7 @@ func NewFilteredRouteTableInformer(client versioned.Interface, namespace string, return client.GatewayV1().RouteTables(namespace).Watch(context.TODO(), options) }, }, - &gatewayv1.RouteTable{}, + &gloogatewayv1.RouteTable{}, resyncPeriod, indexers, ) @@ -82,7 +82,7 @@ func (f *routeTableInformer) defaultInformer(client versioned.Interface, resyncP } func (f *routeTableInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&gatewayv1.RouteTable{}, f.defaultInformer) + return f.factory.InformerFor(&gloogatewayv1.RouteTable{}, f.defaultInformer) } func (f *routeTableInformer) Lister() v1.RouteTableLister { diff --git a/pkg/client/listers/gloo/v1/upstream.go b/pkg/client/listers/gloo/v1/upstream.go index c4f50968a..0f7af0c20 100644 --- a/pkg/client/listers/gloo/v1/upstream.go +++ b/pkg/client/listers/gloo/v1/upstream.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/client/listers/gateway/v1/expansion_generated.go b/pkg/client/listers/gloogateway/v1/expansion_generated.go similarity index 100% rename from pkg/client/listers/gateway/v1/expansion_generated.go rename to pkg/client/listers/gloogateway/v1/expansion_generated.go diff --git a/pkg/client/listers/gateway/v1/routetable.go b/pkg/client/listers/gloogateway/v1/routetable.go similarity index 98% rename from pkg/client/listers/gateway/v1/routetable.go rename to pkg/client/listers/gloogateway/v1/routetable.go index 9db84cca8..3298a6b13 100644 --- a/pkg/client/listers/gateway/v1/routetable.go +++ b/pkg/client/listers/gloogateway/v1/routetable.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" + v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/router/gloo.go b/pkg/router/gloo.go index 4b3c1b3bd..267eb6c19 100644 --- a/pkg/router/gloo.go +++ b/pkg/router/gloo.go @@ -23,8 +23,8 @@ import ( corev1 "k8s.io/api/core/v1" - gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" - gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/gloo/v1" + gloov1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" + gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "go.uber.org/zap" diff --git a/pkg/router/gloo_test.go b/pkg/router/gloo_test.go index a6c321d5b..0032254ce 100644 --- a/pkg/router/gloo_test.go +++ b/pkg/router/gloo_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloo/gateway/v1" + gatewayv1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" From d4f766285d9a97dae1a98a866a91fd11ded302ef Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Sat, 23 Nov 2024 20:50:47 +0200 Subject: [PATCH 08/14] Update generated client for Kubernetes 1.31 Signed-off-by: Stefan Prodan --- .../versioned/fake/clientset_generated.go | 6 +- .../versioned/typed/apisix/v2/apisixroute.go | 146 ++---------------- .../typed/apisix/v2/fake/fake_apisixroute.go | 36 +++-- .../typed/appmesh/v1beta1/fake/fake_mesh.go | 36 +++-- .../appmesh/v1beta1/fake/fake_virtualnode.go | 36 +++-- .../v1beta1/fake/fake_virtualservice.go | 36 +++-- .../versioned/typed/appmesh/v1beta1/mesh.go | 135 ++-------------- .../typed/appmesh/v1beta1/virtualnode.go | 146 ++---------------- .../typed/appmesh/v1beta1/virtualservice.go | 146 ++---------------- .../appmesh/v1beta2/fake/fake_virtualnode.go | 36 +++-- .../v1beta2/fake/fake_virtualrouter.go | 36 +++-- .../v1beta2/fake/fake_virtualservice.go | 36 +++-- .../typed/appmesh/v1beta2/virtualnode.go | 146 ++---------------- .../typed/appmesh/v1beta2/virtualrouter.go | 146 ++---------------- .../typed/appmesh/v1beta2/virtualservice.go | 146 ++---------------- .../typed/flagger/v1beta1/alertprovider.go | 146 ++---------------- .../versioned/typed/flagger/v1beta1/canary.go | 146 ++---------------- .../v1beta1/fake/fake_alertprovider.go | 36 +++-- .../typed/flagger/v1beta1/fake/fake_canary.go | 36 +++-- .../v1beta1/fake/fake_metrictemplate.go | 36 +++-- .../typed/flagger/v1beta1/metrictemplate.go | 146 ++---------------- .../gatewayapi/v1/fake/fake_httproute.go | 36 +++-- .../typed/gatewayapi/v1/httproute.go | 146 ++---------------- .../gatewayapi/v1beta1/fake/fake_httproute.go | 36 +++-- .../typed/gatewayapi/v1beta1/httproute.go | 146 ++---------------- .../typed/gloo/v1/fake/fake_upstream.go | 29 ++-- .../versioned/typed/gloo/v1/upstream.go | 129 ++-------------- .../gloogateway/v1/fake/fake_routetable.go | 29 ++-- .../typed/gloogateway/v1/routetable.go | 129 ++-------------- .../typed/istio/v1beta1/destinationrule.go | 129 ++-------------- .../v1beta1/fake/fake_destinationrule.go | 29 ++-- .../istio/v1beta1/fake/fake_virtualservice.go | 29 ++-- .../typed/istio/v1beta1/virtualservice.go | 129 ++-------------- .../keda/v1alpha1/fake/fake_scaledobject.go | 36 +++-- .../typed/keda/v1alpha1/scaledobject.go | 146 ++---------------- .../kuma/v1alpha1/fake/fake_trafficroute.go | 29 ++-- .../typed/kuma/v1alpha1/trafficroute.go | 119 ++------------ .../projectcontour/v1/fake/fake_httpproxy.go | 36 +++-- .../typed/projectcontour/v1/httpproxy.go | 146 ++---------------- .../smi/v1alpha1/fake/fake_trafficsplit.go | 29 ++-- .../typed/smi/v1alpha1/trafficsplit.go | 129 ++-------------- .../smi/v1alpha2/fake/fake_trafficsplit.go | 29 ++-- .../typed/smi/v1alpha2/trafficsplit.go | 129 ++-------------- .../smi/v1alpha3/fake/fake_trafficsplit.go | 29 ++-- .../typed/smi/v1alpha3/trafficsplit.go | 129 ++-------------- .../v1alpha1/fake/fake_traefikservice.go | 29 ++-- .../typed/traefik/v1alpha1/traefikservice.go | 129 ++-------------- .../informers/externalversions/factory.go | 1 + pkg/client/listers/apisix/v2/apisixroute.go | 39 +---- pkg/client/listers/appmesh/v1beta1/mesh.go | 26 +--- .../listers/appmesh/v1beta1/virtualnode.go | 39 +---- .../listers/appmesh/v1beta1/virtualservice.go | 39 +---- .../listers/appmesh/v1beta2/virtualnode.go | 39 +---- .../listers/appmesh/v1beta2/virtualrouter.go | 39 +---- .../listers/appmesh/v1beta2/virtualservice.go | 39 +---- .../listers/flagger/v1beta1/alertprovider.go | 39 +---- pkg/client/listers/flagger/v1beta1/canary.go | 39 +---- .../listers/flagger/v1beta1/metrictemplate.go | 39 +---- pkg/client/listers/gatewayapi/v1/httproute.go | 39 +---- .../listers/gatewayapi/v1beta1/httproute.go | 39 +---- pkg/client/listers/gloo/v1/upstream.go | 39 +---- .../listers/gloogateway/v1/routetable.go | 39 +---- .../listers/istio/v1beta1/destinationrule.go | 39 +---- .../listers/istio/v1beta1/virtualservice.go | 39 +---- .../listers/keda/v1alpha1/scaledobject.go | 39 +---- .../listers/kuma/v1alpha1/trafficroute.go | 26 +--- .../listers/projectcontour/v1/httpproxy.go | 39 +---- .../listers/smi/v1alpha1/trafficsplit.go | 39 +---- .../listers/smi/v1alpha2/trafficsplit.go | 39 +---- .../listers/smi/v1alpha3/trafficsplit.go | 39 +---- .../traefik/v1alpha1/traefikservice.go | 39 +---- 71 files changed, 785 insertions(+), 4042 deletions(-) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 518bdf0c1..a28c20436 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -61,8 +61,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/pkg/client/clientset/versioned/typed/apisix/v2/apisixroute.go b/pkg/client/clientset/versioned/typed/apisix/v2/apisixroute.go index bc463592b..78ffe03c4 100644 --- a/pkg/client/clientset/versioned/typed/apisix/v2/apisixroute.go +++ b/pkg/client/clientset/versioned/typed/apisix/v2/apisixroute.go @@ -20,14 +20,13 @@ package v2 import ( "context" - "time" v2 "github.com/fluxcd/flagger/pkg/apis/apisix/v2" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ApisixRoutesGetter has a method to return a ApisixRouteInterface. @@ -40,6 +39,7 @@ type ApisixRoutesGetter interface { type ApisixRouteInterface interface { Create(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.CreateOptions) (*v2.ApisixRoute, error) Update(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (*v2.ApisixRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (*v2.ApisixRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type ApisixRouteInterface interface { // apisixRoutes implements ApisixRouteInterface type apisixRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v2.ApisixRoute, *v2.ApisixRouteList] } // newApisixRoutes returns a ApisixRoutes func newApisixRoutes(c *ApisixV2Client, namespace string) *apisixRoutes { return &apisixRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v2.ApisixRoute, *v2.ApisixRouteList]( + "apisixroutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v2.ApisixRoute { return &v2.ApisixRoute{} }, + func() *v2.ApisixRouteList { return &v2.ApisixRouteList{} }), } } - -// Get takes name of the apisixRoute, and returns the corresponding apisixRoute object, and an error if there is any. -func (c *apisixRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.ApisixRoute, err error) { - result = &v2.ApisixRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ApisixRoutes that match those selectors. -func (c *apisixRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v2.ApisixRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.ApisixRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested apisixRoutes. -func (c *apisixRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a apisixRoute and creates it. Returns the server's representation of the apisixRoute, and an error, if there is any. -func (c *apisixRoutes) Create(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.CreateOptions) (result *v2.ApisixRoute, err error) { - result = &v2.ApisixRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a apisixRoute and updates it. Returns the server's representation of the apisixRoute, and an error, if there is any. -func (c *apisixRoutes) Update(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (result *v2.ApisixRoute, err error) { - result = &v2.ApisixRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(apisixRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixRoute). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *apisixRoutes) UpdateStatus(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (result *v2.ApisixRoute, err error) { - result = &v2.ApisixRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(apisixRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(apisixRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the apisixRoute and deletes it. Returns an error if one occurs. -func (c *apisixRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *apisixRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("apisixroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched apisixRoute. -func (c *apisixRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.ApisixRoute, err error) { - result = &v2.ApisixRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("apisixroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/apisix/v2/fake/fake_apisixroute.go b/pkg/client/clientset/versioned/typed/apisix/v2/fake/fake_apisixroute.go index 0689e3fc9..7e1dfb169 100644 --- a/pkg/client/clientset/versioned/typed/apisix/v2/fake/fake_apisixroute.go +++ b/pkg/client/clientset/versioned/typed/apisix/v2/fake/fake_apisixroute.go @@ -41,22 +41,24 @@ var apisixroutesKind = v2.SchemeGroupVersion.WithKind("ApisixRoute") // Get takes name of the apisixRoute, and returns the corresponding apisixRoute object, and an error if there is any. func (c *FakeApisixRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.ApisixRoute, err error) { + emptyResult := &v2.ApisixRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(apisixroutesResource, c.ns, name), &v2.ApisixRoute{}) + Invokes(testing.NewGetActionWithOptions(apisixroutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ApisixRoute), err } // List takes label and field selectors, and returns the list of ApisixRoutes that match those selectors. func (c *FakeApisixRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v2.ApisixRouteList, err error) { + emptyResult := &v2.ApisixRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(apisixroutesResource, apisixroutesKind, c.ns, opts), &v2.ApisixRouteList{}) + Invokes(testing.NewListActionWithOptions(apisixroutesResource, apisixroutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeApisixRoutes) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested apisixRoutes. func (c *FakeApisixRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(apisixroutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(apisixroutesResource, c.ns, opts)) } // Create takes the representation of a apisixRoute and creates it. Returns the server's representation of the apisixRoute, and an error, if there is any. func (c *FakeApisixRoutes) Create(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.CreateOptions) (result *v2.ApisixRoute, err error) { + emptyResult := &v2.ApisixRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(apisixroutesResource, c.ns, apisixRoute), &v2.ApisixRoute{}) + Invokes(testing.NewCreateActionWithOptions(apisixroutesResource, c.ns, apisixRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ApisixRoute), err } // Update takes the representation of a apisixRoute and updates it. Returns the server's representation of the apisixRoute, and an error, if there is any. func (c *FakeApisixRoutes) Update(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (result *v2.ApisixRoute, err error) { + emptyResult := &v2.ApisixRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(apisixroutesResource, c.ns, apisixRoute), &v2.ApisixRoute{}) + Invokes(testing.NewUpdateActionWithOptions(apisixroutesResource, c.ns, apisixRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ApisixRoute), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeApisixRoutes) UpdateStatus(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (*v2.ApisixRoute, error) { +func (c *FakeApisixRoutes) UpdateStatus(ctx context.Context, apisixRoute *v2.ApisixRoute, opts v1.UpdateOptions) (result *v2.ApisixRoute, err error) { + emptyResult := &v2.ApisixRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(apisixroutesResource, "status", c.ns, apisixRoute), &v2.ApisixRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(apisixroutesResource, "status", c.ns, apisixRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ApisixRoute), err } @@ -123,7 +128,7 @@ func (c *FakeApisixRoutes) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeApisixRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(apisixroutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(apisixroutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v2.ApisixRouteList{}) return err @@ -131,11 +136,12 @@ func (c *FakeApisixRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched apisixRoute. func (c *FakeApisixRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.ApisixRoute, err error) { + emptyResult := &v2.ApisixRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(apisixroutesResource, c.ns, name, pt, data, subresources...), &v2.ApisixRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(apisixroutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ApisixRoute), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_mesh.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_mesh.go index 82bb676b0..e4770aa2d 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_mesh.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_mesh.go @@ -40,20 +40,22 @@ var meshesKind = v1beta1.SchemeGroupVersion.WithKind("Mesh") // Get takes name of the mesh, and returns the corresponding mesh object, and an error if there is any. func (c *FakeMeshes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Mesh, err error) { + emptyResult := &v1beta1.Mesh{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(meshesResource, name), &v1beta1.Mesh{}) + Invokes(testing.NewRootGetActionWithOptions(meshesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Mesh), err } // List takes label and field selectors, and returns the list of Meshes that match those selectors. func (c *FakeMeshes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.MeshList, err error) { + emptyResult := &v1beta1.MeshList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(meshesResource, meshesKind, opts), &v1beta1.MeshList{}) + Invokes(testing.NewRootListActionWithOptions(meshesResource, meshesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,36 +74,39 @@ func (c *FakeMeshes) List(ctx context.Context, opts v1.ListOptions) (result *v1b // Watch returns a watch.Interface that watches the requested meshes. func (c *FakeMeshes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(meshesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(meshesResource, opts)) } // Create takes the representation of a mesh and creates it. Returns the server's representation of the mesh, and an error, if there is any. func (c *FakeMeshes) Create(ctx context.Context, mesh *v1beta1.Mesh, opts v1.CreateOptions) (result *v1beta1.Mesh, err error) { + emptyResult := &v1beta1.Mesh{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(meshesResource, mesh), &v1beta1.Mesh{}) + Invokes(testing.NewRootCreateActionWithOptions(meshesResource, mesh, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Mesh), err } // Update takes the representation of a mesh and updates it. Returns the server's representation of the mesh, and an error, if there is any. func (c *FakeMeshes) Update(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (result *v1beta1.Mesh, err error) { + emptyResult := &v1beta1.Mesh{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(meshesResource, mesh), &v1beta1.Mesh{}) + Invokes(testing.NewRootUpdateActionWithOptions(meshesResource, mesh, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Mesh), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeMeshes) UpdateStatus(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (*v1beta1.Mesh, error) { +func (c *FakeMeshes) UpdateStatus(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (result *v1beta1.Mesh, err error) { + emptyResult := &v1beta1.Mesh{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(meshesResource, "status", mesh), &v1beta1.Mesh{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(meshesResource, "status", mesh, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Mesh), err } @@ -115,7 +120,7 @@ func (c *FakeMeshes) Delete(ctx context.Context, name string, opts v1.DeleteOpti // DeleteCollection deletes a collection of objects. func (c *FakeMeshes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(meshesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(meshesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.MeshList{}) return err @@ -123,10 +128,11 @@ func (c *FakeMeshes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions // Patch applies the patch and returns the patched mesh. func (c *FakeMeshes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Mesh, err error) { + emptyResult := &v1beta1.Mesh{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(meshesResource, name, pt, data, subresources...), &v1beta1.Mesh{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(meshesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Mesh), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualnode.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualnode.go index 54cf584a7..8df3ddecd 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualnode.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualnode.go @@ -41,22 +41,24 @@ var virtualnodesKind = v1beta1.SchemeGroupVersion.WithKind("VirtualNode") // Get takes name of the virtualNode, and returns the corresponding virtualNode object, and an error if there is any. func (c *FakeVirtualNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualNode, err error) { + emptyResult := &v1beta1.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualnodesResource, c.ns, name), &v1beta1.VirtualNode{}) + Invokes(testing.NewGetActionWithOptions(virtualnodesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualNode), err } // List takes label and field selectors, and returns the list of VirtualNodes that match those selectors. func (c *FakeVirtualNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualNodeList, err error) { + emptyResult := &v1beta1.VirtualNodeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(virtualnodesResource, virtualnodesKind, c.ns, opts), &v1beta1.VirtualNodeList{}) + Invokes(testing.NewListActionWithOptions(virtualnodesResource, virtualnodesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeVirtualNodes) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested virtualNodes. func (c *FakeVirtualNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualnodesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(virtualnodesResource, c.ns, opts)) } // Create takes the representation of a virtualNode and creates it. Returns the server's representation of the virtualNode, and an error, if there is any. func (c *FakeVirtualNodes) Create(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.CreateOptions) (result *v1beta1.VirtualNode, err error) { + emptyResult := &v1beta1.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualnodesResource, c.ns, virtualNode), &v1beta1.VirtualNode{}) + Invokes(testing.NewCreateActionWithOptions(virtualnodesResource, c.ns, virtualNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualNode), err } // Update takes the representation of a virtualNode and updates it. Returns the server's representation of the virtualNode, and an error, if there is any. func (c *FakeVirtualNodes) Update(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (result *v1beta1.VirtualNode, err error) { + emptyResult := &v1beta1.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualnodesResource, c.ns, virtualNode), &v1beta1.VirtualNode{}) + Invokes(testing.NewUpdateActionWithOptions(virtualnodesResource, c.ns, virtualNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualNode), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualNodes) UpdateStatus(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (*v1beta1.VirtualNode, error) { +func (c *FakeVirtualNodes) UpdateStatus(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (result *v1beta1.VirtualNode, err error) { + emptyResult := &v1beta1.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualnodesResource, "status", c.ns, virtualNode), &v1beta1.VirtualNode{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(virtualnodesResource, "status", c.ns, virtualNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualNode), err } @@ -123,7 +128,7 @@ func (c *FakeVirtualNodes) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeVirtualNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualnodesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(virtualnodesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.VirtualNodeList{}) return err @@ -131,11 +136,12 @@ func (c *FakeVirtualNodes) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched virtualNode. func (c *FakeVirtualNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualNode, err error) { + emptyResult := &v1beta1.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualnodesResource, c.ns, name, pt, data, subresources...), &v1beta1.VirtualNode{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(virtualnodesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualNode), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualservice.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualservice.go index 47668b01d..5e0f5b9da 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualservice.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/fake/fake_virtualservice.go @@ -41,22 +41,24 @@ var virtualservicesKind = v1beta1.SchemeGroupVersion.WithKind("VirtualService") // Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. func (c *FakeVirtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualservicesResource, c.ns, name), &v1beta1.VirtualService{}) + Invokes(testing.NewGetActionWithOptions(virtualservicesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } // List takes label and field selectors, and returns the list of VirtualServices that match those selectors. func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualServiceList, err error) { + emptyResult := &v1beta1.VirtualServiceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(virtualservicesResource, virtualservicesKind, c.ns, opts), &v1beta1.VirtualServiceList{}) + Invokes(testing.NewListActionWithOptions(virtualservicesResource, virtualservicesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested virtualServices. func (c *FakeVirtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualservicesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(virtualservicesResource, c.ns, opts)) } // Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. func (c *FakeVirtualServices) Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualservicesResource, c.ns, virtualService), &v1beta1.VirtualService{}) + Invokes(testing.NewCreateActionWithOptions(virtualservicesResource, c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } // Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. func (c *FakeVirtualServices) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualservicesResource, c.ns, virtualService), &v1beta1.VirtualService{}) + Invokes(testing.NewUpdateActionWithOptions(virtualservicesResource, c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualServices) UpdateStatus(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (*v1beta1.VirtualService, error) { +func (c *FakeVirtualServices) UpdateStatus(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualservicesResource, "status", c.ns, virtualService), &v1beta1.VirtualService{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(virtualservicesResource, "status", c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } @@ -123,7 +128,7 @@ func (c *FakeVirtualServices) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualservicesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(virtualservicesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.VirtualServiceList{}) return err @@ -131,11 +136,12 @@ func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched virtualService. func (c *FakeVirtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualservicesResource, c.ns, name, pt, data, subresources...), &v1beta1.VirtualService{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(virtualservicesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/mesh.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/mesh.go index ef48a7702..3c6a89b61 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/mesh.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/mesh.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // MeshesGetter has a method to return a MeshInterface. @@ -40,6 +39,7 @@ type MeshesGetter interface { type MeshInterface interface { Create(ctx context.Context, mesh *v1beta1.Mesh, opts v1.CreateOptions) (*v1beta1.Mesh, error) Update(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (*v1beta1.Mesh, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (*v1beta1.Mesh, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,133 +52,18 @@ type MeshInterface interface { // meshes implements MeshInterface type meshes struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.Mesh, *v1beta1.MeshList] } // newMeshes returns a Meshes func newMeshes(c *AppmeshV1beta1Client) *meshes { return &meshes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.Mesh, *v1beta1.MeshList]( + "meshes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.Mesh { return &v1beta1.Mesh{} }, + func() *v1beta1.MeshList { return &v1beta1.MeshList{} }), } } - -// Get takes name of the mesh, and returns the corresponding mesh object, and an error if there is any. -func (c *meshes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Mesh, err error) { - result = &v1beta1.Mesh{} - err = c.client.Get(). - Resource("meshes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Meshes that match those selectors. -func (c *meshes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.MeshList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.MeshList{} - err = c.client.Get(). - Resource("meshes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested meshes. -func (c *meshes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("meshes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a mesh and creates it. Returns the server's representation of the mesh, and an error, if there is any. -func (c *meshes) Create(ctx context.Context, mesh *v1beta1.Mesh, opts v1.CreateOptions) (result *v1beta1.Mesh, err error) { - result = &v1beta1.Mesh{} - err = c.client.Post(). - Resource("meshes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(mesh). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a mesh and updates it. Returns the server's representation of the mesh, and an error, if there is any. -func (c *meshes) Update(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (result *v1beta1.Mesh, err error) { - result = &v1beta1.Mesh{} - err = c.client.Put(). - Resource("meshes"). - Name(mesh.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(mesh). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *meshes) UpdateStatus(ctx context.Context, mesh *v1beta1.Mesh, opts v1.UpdateOptions) (result *v1beta1.Mesh, err error) { - result = &v1beta1.Mesh{} - err = c.client.Put(). - Resource("meshes"). - Name(mesh.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(mesh). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the mesh and deletes it. Returns an error if one occurs. -func (c *meshes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("meshes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *meshes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("meshes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched mesh. -func (c *meshes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Mesh, err error) { - result = &v1beta1.Mesh{} - err = c.client.Patch(pt). - Resource("meshes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualnode.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualnode.go index 4f2f36e2b..486e20945 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualnode.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualnode.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // VirtualNodesGetter has a method to return a VirtualNodeInterface. @@ -40,6 +39,7 @@ type VirtualNodesGetter interface { type VirtualNodeInterface interface { Create(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.CreateOptions) (*v1beta1.VirtualNode, error) Update(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (*v1beta1.VirtualNode, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (*v1beta1.VirtualNode, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type VirtualNodeInterface interface { // virtualNodes implements VirtualNodeInterface type virtualNodes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.VirtualNode, *v1beta1.VirtualNodeList] } // newVirtualNodes returns a VirtualNodes func newVirtualNodes(c *AppmeshV1beta1Client, namespace string) *virtualNodes { return &virtualNodes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.VirtualNode, *v1beta1.VirtualNodeList]( + "virtualnodes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.VirtualNode { return &v1beta1.VirtualNode{} }, + func() *v1beta1.VirtualNodeList { return &v1beta1.VirtualNodeList{} }), } } - -// Get takes name of the virtualNode, and returns the corresponding virtualNode object, and an error if there is any. -func (c *virtualNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualNode, err error) { - result = &v1beta1.VirtualNode{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualNodes that match those selectors. -func (c *virtualNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualNodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VirtualNodeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualNodes. -func (c *virtualNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualNode and creates it. Returns the server's representation of the virtualNode, and an error, if there is any. -func (c *virtualNodes) Create(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.CreateOptions) (result *v1beta1.VirtualNode, err error) { - result = &v1beta1.VirtualNode{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualNode). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualNode and updates it. Returns the server's representation of the virtualNode, and an error, if there is any. -func (c *virtualNodes) Update(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (result *v1beta1.VirtualNode, err error) { - result = &v1beta1.VirtualNode{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(virtualNode.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualNode). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualNodes) UpdateStatus(ctx context.Context, virtualNode *v1beta1.VirtualNode, opts v1.UpdateOptions) (result *v1beta1.VirtualNode, err error) { - result = &v1beta1.VirtualNode{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(virtualNode.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualNode). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualNode and deletes it. Returns an error if one occurs. -func (c *virtualNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualNode. -func (c *virtualNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualNode, err error) { - result = &v1beta1.VirtualNode{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualnodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualservice.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualservice.go index 4e42f17a7..cf71788eb 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualservice.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta1/virtualservice.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // VirtualServicesGetter has a method to return a VirtualServiceInterface. @@ -40,6 +39,7 @@ type VirtualServicesGetter interface { type VirtualServiceInterface interface { Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (*v1beta1.VirtualService, error) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (*v1beta1.VirtualService, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (*v1beta1.VirtualService, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type VirtualServiceInterface interface { // virtualServices implements VirtualServiceInterface type virtualServices struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.VirtualService, *v1beta1.VirtualServiceList] } // newVirtualServices returns a VirtualServices func newVirtualServices(c *AppmeshV1beta1Client, namespace string) *virtualServices { return &virtualServices{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.VirtualService, *v1beta1.VirtualServiceList]( + "virtualservices", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.VirtualService { return &v1beta1.VirtualService{} }, + func() *v1beta1.VirtualServiceList { return &v1beta1.VirtualServiceList{} }), } } - -// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. -func (c *virtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualServices that match those selectors. -func (c *virtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VirtualServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualServices. -func (c *virtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualservices"). - Name(virtualService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualServices) UpdateStatus(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualservices"). - Name(virtualService.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualService and deletes it. Returns an error if one occurs. -func (c *virtualServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualService. -func (c *virtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualnode.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualnode.go index 202fc035d..8442b1aee 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualnode.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualnode.go @@ -41,22 +41,24 @@ var virtualnodesKind = v1beta2.SchemeGroupVersion.WithKind("VirtualNode") // Get takes name of the virtualNode, and returns the corresponding virtualNode object, and an error if there is any. func (c *FakeVirtualNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.VirtualNode, err error) { + emptyResult := &v1beta2.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualnodesResource, c.ns, name), &v1beta2.VirtualNode{}) + Invokes(testing.NewGetActionWithOptions(virtualnodesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualNode), err } // List takes label and field selectors, and returns the list of VirtualNodes that match those selectors. func (c *FakeVirtualNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.VirtualNodeList, err error) { + emptyResult := &v1beta2.VirtualNodeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(virtualnodesResource, virtualnodesKind, c.ns, opts), &v1beta2.VirtualNodeList{}) + Invokes(testing.NewListActionWithOptions(virtualnodesResource, virtualnodesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeVirtualNodes) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested virtualNodes. func (c *FakeVirtualNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualnodesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(virtualnodesResource, c.ns, opts)) } // Create takes the representation of a virtualNode and creates it. Returns the server's representation of the virtualNode, and an error, if there is any. func (c *FakeVirtualNodes) Create(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.CreateOptions) (result *v1beta2.VirtualNode, err error) { + emptyResult := &v1beta2.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualnodesResource, c.ns, virtualNode), &v1beta2.VirtualNode{}) + Invokes(testing.NewCreateActionWithOptions(virtualnodesResource, c.ns, virtualNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualNode), err } // Update takes the representation of a virtualNode and updates it. Returns the server's representation of the virtualNode, and an error, if there is any. func (c *FakeVirtualNodes) Update(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (result *v1beta2.VirtualNode, err error) { + emptyResult := &v1beta2.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualnodesResource, c.ns, virtualNode), &v1beta2.VirtualNode{}) + Invokes(testing.NewUpdateActionWithOptions(virtualnodesResource, c.ns, virtualNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualNode), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualNodes) UpdateStatus(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (*v1beta2.VirtualNode, error) { +func (c *FakeVirtualNodes) UpdateStatus(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (result *v1beta2.VirtualNode, err error) { + emptyResult := &v1beta2.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualnodesResource, "status", c.ns, virtualNode), &v1beta2.VirtualNode{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(virtualnodesResource, "status", c.ns, virtualNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualNode), err } @@ -123,7 +128,7 @@ func (c *FakeVirtualNodes) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeVirtualNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualnodesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(virtualnodesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta2.VirtualNodeList{}) return err @@ -131,11 +136,12 @@ func (c *FakeVirtualNodes) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched virtualNode. func (c *FakeVirtualNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.VirtualNode, err error) { + emptyResult := &v1beta2.VirtualNode{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualnodesResource, c.ns, name, pt, data, subresources...), &v1beta2.VirtualNode{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(virtualnodesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualNode), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualrouter.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualrouter.go index 5a5092a94..88e66f0a8 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualrouter.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualrouter.go @@ -41,22 +41,24 @@ var virtualroutersKind = v1beta2.SchemeGroupVersion.WithKind("VirtualRouter") // Get takes name of the virtualRouter, and returns the corresponding virtualRouter object, and an error if there is any. func (c *FakeVirtualRouters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.VirtualRouter, err error) { + emptyResult := &v1beta2.VirtualRouter{} obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualroutersResource, c.ns, name), &v1beta2.VirtualRouter{}) + Invokes(testing.NewGetActionWithOptions(virtualroutersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualRouter), err } // List takes label and field selectors, and returns the list of VirtualRouters that match those selectors. func (c *FakeVirtualRouters) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.VirtualRouterList, err error) { + emptyResult := &v1beta2.VirtualRouterList{} obj, err := c.Fake. - Invokes(testing.NewListAction(virtualroutersResource, virtualroutersKind, c.ns, opts), &v1beta2.VirtualRouterList{}) + Invokes(testing.NewListActionWithOptions(virtualroutersResource, virtualroutersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeVirtualRouters) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested virtualRouters. func (c *FakeVirtualRouters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualroutersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(virtualroutersResource, c.ns, opts)) } // Create takes the representation of a virtualRouter and creates it. Returns the server's representation of the virtualRouter, and an error, if there is any. func (c *FakeVirtualRouters) Create(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.CreateOptions) (result *v1beta2.VirtualRouter, err error) { + emptyResult := &v1beta2.VirtualRouter{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualroutersResource, c.ns, virtualRouter), &v1beta2.VirtualRouter{}) + Invokes(testing.NewCreateActionWithOptions(virtualroutersResource, c.ns, virtualRouter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualRouter), err } // Update takes the representation of a virtualRouter and updates it. Returns the server's representation of the virtualRouter, and an error, if there is any. func (c *FakeVirtualRouters) Update(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (result *v1beta2.VirtualRouter, err error) { + emptyResult := &v1beta2.VirtualRouter{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualroutersResource, c.ns, virtualRouter), &v1beta2.VirtualRouter{}) + Invokes(testing.NewUpdateActionWithOptions(virtualroutersResource, c.ns, virtualRouter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualRouter), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualRouters) UpdateStatus(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (*v1beta2.VirtualRouter, error) { +func (c *FakeVirtualRouters) UpdateStatus(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (result *v1beta2.VirtualRouter, err error) { + emptyResult := &v1beta2.VirtualRouter{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualroutersResource, "status", c.ns, virtualRouter), &v1beta2.VirtualRouter{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(virtualroutersResource, "status", c.ns, virtualRouter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualRouter), err } @@ -123,7 +128,7 @@ func (c *FakeVirtualRouters) Delete(ctx context.Context, name string, opts v1.De // DeleteCollection deletes a collection of objects. func (c *FakeVirtualRouters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualroutersResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(virtualroutersResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta2.VirtualRouterList{}) return err @@ -131,11 +136,12 @@ func (c *FakeVirtualRouters) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched virtualRouter. func (c *FakeVirtualRouters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.VirtualRouter, err error) { + emptyResult := &v1beta2.VirtualRouter{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualroutersResource, c.ns, name, pt, data, subresources...), &v1beta2.VirtualRouter{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(virtualroutersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualRouter), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualservice.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualservice.go index 167dafe0f..cb4f72633 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualservice.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/fake/fake_virtualservice.go @@ -41,22 +41,24 @@ var virtualservicesKind = v1beta2.SchemeGroupVersion.WithKind("VirtualService") // Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. func (c *FakeVirtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.VirtualService, err error) { + emptyResult := &v1beta2.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualservicesResource, c.ns, name), &v1beta2.VirtualService{}) + Invokes(testing.NewGetActionWithOptions(virtualservicesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualService), err } // List takes label and field selectors, and returns the list of VirtualServices that match those selectors. func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.VirtualServiceList, err error) { + emptyResult := &v1beta2.VirtualServiceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(virtualservicesResource, virtualservicesKind, c.ns, opts), &v1beta2.VirtualServiceList{}) + Invokes(testing.NewListActionWithOptions(virtualservicesResource, virtualservicesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested virtualServices. func (c *FakeVirtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualservicesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(virtualservicesResource, c.ns, opts)) } // Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. func (c *FakeVirtualServices) Create(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.CreateOptions) (result *v1beta2.VirtualService, err error) { + emptyResult := &v1beta2.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualservicesResource, c.ns, virtualService), &v1beta2.VirtualService{}) + Invokes(testing.NewCreateActionWithOptions(virtualservicesResource, c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualService), err } // Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. func (c *FakeVirtualServices) Update(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (result *v1beta2.VirtualService, err error) { + emptyResult := &v1beta2.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualservicesResource, c.ns, virtualService), &v1beta2.VirtualService{}) + Invokes(testing.NewUpdateActionWithOptions(virtualservicesResource, c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualService), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVirtualServices) UpdateStatus(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (*v1beta2.VirtualService, error) { +func (c *FakeVirtualServices) UpdateStatus(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (result *v1beta2.VirtualService, err error) { + emptyResult := &v1beta2.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(virtualservicesResource, "status", c.ns, virtualService), &v1beta2.VirtualService{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(virtualservicesResource, "status", c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualService), err } @@ -123,7 +128,7 @@ func (c *FakeVirtualServices) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualservicesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(virtualservicesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta2.VirtualServiceList{}) return err @@ -131,11 +136,12 @@ func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched virtualService. func (c *FakeVirtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.VirtualService, err error) { + emptyResult := &v1beta2.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualservicesResource, c.ns, name, pt, data, subresources...), &v1beta2.VirtualService{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(virtualservicesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.VirtualService), err } diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualnode.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualnode.go index 2ca0f710f..047cf749a 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualnode.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualnode.go @@ -20,14 +20,13 @@ package v1beta2 import ( "context" - "time" v1beta2 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta2" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // VirtualNodesGetter has a method to return a VirtualNodeInterface. @@ -40,6 +39,7 @@ type VirtualNodesGetter interface { type VirtualNodeInterface interface { Create(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.CreateOptions) (*v1beta2.VirtualNode, error) Update(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (*v1beta2.VirtualNode, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (*v1beta2.VirtualNode, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type VirtualNodeInterface interface { // virtualNodes implements VirtualNodeInterface type virtualNodes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta2.VirtualNode, *v1beta2.VirtualNodeList] } // newVirtualNodes returns a VirtualNodes func newVirtualNodes(c *AppmeshV1beta2Client, namespace string) *virtualNodes { return &virtualNodes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta2.VirtualNode, *v1beta2.VirtualNodeList]( + "virtualnodes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.VirtualNode { return &v1beta2.VirtualNode{} }, + func() *v1beta2.VirtualNodeList { return &v1beta2.VirtualNodeList{} }), } } - -// Get takes name of the virtualNode, and returns the corresponding virtualNode object, and an error if there is any. -func (c *virtualNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.VirtualNode, err error) { - result = &v1beta2.VirtualNode{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualNodes that match those selectors. -func (c *virtualNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.VirtualNodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.VirtualNodeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualNodes. -func (c *virtualNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualNode and creates it. Returns the server's representation of the virtualNode, and an error, if there is any. -func (c *virtualNodes) Create(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.CreateOptions) (result *v1beta2.VirtualNode, err error) { - result = &v1beta2.VirtualNode{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualNode). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualNode and updates it. Returns the server's representation of the virtualNode, and an error, if there is any. -func (c *virtualNodes) Update(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (result *v1beta2.VirtualNode, err error) { - result = &v1beta2.VirtualNode{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(virtualNode.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualNode). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualNodes) UpdateStatus(ctx context.Context, virtualNode *v1beta2.VirtualNode, opts v1.UpdateOptions) (result *v1beta2.VirtualNode, err error) { - result = &v1beta2.VirtualNode{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(virtualNode.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualNode). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualNode and deletes it. Returns an error if one occurs. -func (c *virtualNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualnodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualnodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualNode. -func (c *virtualNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.VirtualNode, err error) { - result = &v1beta2.VirtualNode{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualnodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualrouter.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualrouter.go index bd2daad19..34602c10f 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualrouter.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualrouter.go @@ -20,14 +20,13 @@ package v1beta2 import ( "context" - "time" v1beta2 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta2" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // VirtualRoutersGetter has a method to return a VirtualRouterInterface. @@ -40,6 +39,7 @@ type VirtualRoutersGetter interface { type VirtualRouterInterface interface { Create(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.CreateOptions) (*v1beta2.VirtualRouter, error) Update(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (*v1beta2.VirtualRouter, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (*v1beta2.VirtualRouter, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type VirtualRouterInterface interface { // virtualRouters implements VirtualRouterInterface type virtualRouters struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta2.VirtualRouter, *v1beta2.VirtualRouterList] } // newVirtualRouters returns a VirtualRouters func newVirtualRouters(c *AppmeshV1beta2Client, namespace string) *virtualRouters { return &virtualRouters{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta2.VirtualRouter, *v1beta2.VirtualRouterList]( + "virtualrouters", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.VirtualRouter { return &v1beta2.VirtualRouter{} }, + func() *v1beta2.VirtualRouterList { return &v1beta2.VirtualRouterList{} }), } } - -// Get takes name of the virtualRouter, and returns the corresponding virtualRouter object, and an error if there is any. -func (c *virtualRouters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.VirtualRouter, err error) { - result = &v1beta2.VirtualRouter{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualrouters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualRouters that match those selectors. -func (c *virtualRouters) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.VirtualRouterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.VirtualRouterList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualrouters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualRouters. -func (c *virtualRouters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualrouters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualRouter and creates it. Returns the server's representation of the virtualRouter, and an error, if there is any. -func (c *virtualRouters) Create(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.CreateOptions) (result *v1beta2.VirtualRouter, err error) { - result = &v1beta2.VirtualRouter{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualrouters"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualRouter). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualRouter and updates it. Returns the server's representation of the virtualRouter, and an error, if there is any. -func (c *virtualRouters) Update(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (result *v1beta2.VirtualRouter, err error) { - result = &v1beta2.VirtualRouter{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualrouters"). - Name(virtualRouter.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualRouter). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualRouters) UpdateStatus(ctx context.Context, virtualRouter *v1beta2.VirtualRouter, opts v1.UpdateOptions) (result *v1beta2.VirtualRouter, err error) { - result = &v1beta2.VirtualRouter{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualrouters"). - Name(virtualRouter.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualRouter). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualRouter and deletes it. Returns an error if one occurs. -func (c *virtualRouters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualrouters"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualRouters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualrouters"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualRouter. -func (c *virtualRouters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.VirtualRouter, err error) { - result = &v1beta2.VirtualRouter{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualrouters"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualservice.go b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualservice.go index caa79fbfd..b9925e7be 100644 --- a/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualservice.go +++ b/pkg/client/clientset/versioned/typed/appmesh/v1beta2/virtualservice.go @@ -20,14 +20,13 @@ package v1beta2 import ( "context" - "time" v1beta2 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta2" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // VirtualServicesGetter has a method to return a VirtualServiceInterface. @@ -40,6 +39,7 @@ type VirtualServicesGetter interface { type VirtualServiceInterface interface { Create(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.CreateOptions) (*v1beta2.VirtualService, error) Update(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (*v1beta2.VirtualService, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (*v1beta2.VirtualService, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type VirtualServiceInterface interface { // virtualServices implements VirtualServiceInterface type virtualServices struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta2.VirtualService, *v1beta2.VirtualServiceList] } // newVirtualServices returns a VirtualServices func newVirtualServices(c *AppmeshV1beta2Client, namespace string) *virtualServices { return &virtualServices{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta2.VirtualService, *v1beta2.VirtualServiceList]( + "virtualservices", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.VirtualService { return &v1beta2.VirtualService{} }, + func() *v1beta2.VirtualServiceList { return &v1beta2.VirtualServiceList{} }), } } - -// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. -func (c *virtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.VirtualService, err error) { - result = &v1beta2.VirtualService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualServices that match those selectors. -func (c *virtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.VirtualServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.VirtualServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualServices. -func (c *virtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Create(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.CreateOptions) (result *v1beta2.VirtualService, err error) { - result = &v1beta2.VirtualService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Update(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (result *v1beta2.VirtualService, err error) { - result = &v1beta2.VirtualService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualservices"). - Name(virtualService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *virtualServices) UpdateStatus(ctx context.Context, virtualService *v1beta2.VirtualService, opts v1.UpdateOptions) (result *v1beta2.VirtualService, err error) { - result = &v1beta2.VirtualService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualservices"). - Name(virtualService.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualService and deletes it. Returns an error if one occurs. -func (c *virtualServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualService. -func (c *virtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.VirtualService, err error) { - result = &v1beta2.VirtualService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/flagger/v1beta1/alertprovider.go b/pkg/client/clientset/versioned/typed/flagger/v1beta1/alertprovider.go index 8210838b9..93ab94e38 100644 --- a/pkg/client/clientset/versioned/typed/flagger/v1beta1/alertprovider.go +++ b/pkg/client/clientset/versioned/typed/flagger/v1beta1/alertprovider.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AlertProvidersGetter has a method to return a AlertProviderInterface. @@ -40,6 +39,7 @@ type AlertProvidersGetter interface { type AlertProviderInterface interface { Create(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.CreateOptions) (*v1beta1.AlertProvider, error) Update(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (*v1beta1.AlertProvider, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (*v1beta1.AlertProvider, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type AlertProviderInterface interface { // alertProviders implements AlertProviderInterface type alertProviders struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.AlertProvider, *v1beta1.AlertProviderList] } // newAlertProviders returns a AlertProviders func newAlertProviders(c *FlaggerV1beta1Client, namespace string) *alertProviders { return &alertProviders{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.AlertProvider, *v1beta1.AlertProviderList]( + "alertproviders", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.AlertProvider { return &v1beta1.AlertProvider{} }, + func() *v1beta1.AlertProviderList { return &v1beta1.AlertProviderList{} }), } } - -// Get takes name of the alertProvider, and returns the corresponding alertProvider object, and an error if there is any. -func (c *alertProviders) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.AlertProvider, err error) { - result = &v1beta1.AlertProvider{} - err = c.client.Get(). - Namespace(c.ns). - Resource("alertproviders"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AlertProviders that match those selectors. -func (c *alertProviders) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AlertProviderList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.AlertProviderList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("alertproviders"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested alertProviders. -func (c *alertProviders) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("alertproviders"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a alertProvider and creates it. Returns the server's representation of the alertProvider, and an error, if there is any. -func (c *alertProviders) Create(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.CreateOptions) (result *v1beta1.AlertProvider, err error) { - result = &v1beta1.AlertProvider{} - err = c.client.Post(). - Namespace(c.ns). - Resource("alertproviders"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(alertProvider). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a alertProvider and updates it. Returns the server's representation of the alertProvider, and an error, if there is any. -func (c *alertProviders) Update(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (result *v1beta1.AlertProvider, err error) { - result = &v1beta1.AlertProvider{} - err = c.client.Put(). - Namespace(c.ns). - Resource("alertproviders"). - Name(alertProvider.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(alertProvider). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *alertProviders) UpdateStatus(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (result *v1beta1.AlertProvider, err error) { - result = &v1beta1.AlertProvider{} - err = c.client.Put(). - Namespace(c.ns). - Resource("alertproviders"). - Name(alertProvider.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(alertProvider). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the alertProvider and deletes it. Returns an error if one occurs. -func (c *alertProviders) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("alertproviders"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *alertProviders) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("alertproviders"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched alertProvider. -func (c *alertProviders) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.AlertProvider, err error) { - result = &v1beta1.AlertProvider{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("alertproviders"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/flagger/v1beta1/canary.go b/pkg/client/clientset/versioned/typed/flagger/v1beta1/canary.go index 18a332c13..612db0d2e 100644 --- a/pkg/client/clientset/versioned/typed/flagger/v1beta1/canary.go +++ b/pkg/client/clientset/versioned/typed/flagger/v1beta1/canary.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CanariesGetter has a method to return a CanaryInterface. @@ -40,6 +39,7 @@ type CanariesGetter interface { type CanaryInterface interface { Create(ctx context.Context, canary *v1beta1.Canary, opts v1.CreateOptions) (*v1beta1.Canary, error) Update(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (*v1beta1.Canary, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (*v1beta1.Canary, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type CanaryInterface interface { // canaries implements CanaryInterface type canaries struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.Canary, *v1beta1.CanaryList] } // newCanaries returns a Canaries func newCanaries(c *FlaggerV1beta1Client, namespace string) *canaries { return &canaries{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.Canary, *v1beta1.CanaryList]( + "canaries", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.Canary { return &v1beta1.Canary{} }, + func() *v1beta1.CanaryList { return &v1beta1.CanaryList{} }), } } - -// Get takes name of the canary, and returns the corresponding canary object, and an error if there is any. -func (c *canaries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Canary, err error) { - result = &v1beta1.Canary{} - err = c.client.Get(). - Namespace(c.ns). - Resource("canaries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Canaries that match those selectors. -func (c *canaries) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CanaryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.CanaryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("canaries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested canaries. -func (c *canaries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("canaries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a canary and creates it. Returns the server's representation of the canary, and an error, if there is any. -func (c *canaries) Create(ctx context.Context, canary *v1beta1.Canary, opts v1.CreateOptions) (result *v1beta1.Canary, err error) { - result = &v1beta1.Canary{} - err = c.client.Post(). - Namespace(c.ns). - Resource("canaries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(canary). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a canary and updates it. Returns the server's representation of the canary, and an error, if there is any. -func (c *canaries) Update(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (result *v1beta1.Canary, err error) { - result = &v1beta1.Canary{} - err = c.client.Put(). - Namespace(c.ns). - Resource("canaries"). - Name(canary.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(canary). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *canaries) UpdateStatus(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (result *v1beta1.Canary, err error) { - result = &v1beta1.Canary{} - err = c.client.Put(). - Namespace(c.ns). - Resource("canaries"). - Name(canary.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(canary). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the canary and deletes it. Returns an error if one occurs. -func (c *canaries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("canaries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *canaries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("canaries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched canary. -func (c *canaries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Canary, err error) { - result = &v1beta1.Canary{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("canaries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_alertprovider.go b/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_alertprovider.go index 701329438..3b2b7391f 100644 --- a/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_alertprovider.go +++ b/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_alertprovider.go @@ -41,22 +41,24 @@ var alertprovidersKind = v1beta1.SchemeGroupVersion.WithKind("AlertProvider") // Get takes name of the alertProvider, and returns the corresponding alertProvider object, and an error if there is any. func (c *FakeAlertProviders) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.AlertProvider, err error) { + emptyResult := &v1beta1.AlertProvider{} obj, err := c.Fake. - Invokes(testing.NewGetAction(alertprovidersResource, c.ns, name), &v1beta1.AlertProvider{}) + Invokes(testing.NewGetActionWithOptions(alertprovidersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AlertProvider), err } // List takes label and field selectors, and returns the list of AlertProviders that match those selectors. func (c *FakeAlertProviders) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.AlertProviderList, err error) { + emptyResult := &v1beta1.AlertProviderList{} obj, err := c.Fake. - Invokes(testing.NewListAction(alertprovidersResource, alertprovidersKind, c.ns, opts), &v1beta1.AlertProviderList{}) + Invokes(testing.NewListActionWithOptions(alertprovidersResource, alertprovidersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeAlertProviders) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested alertProviders. func (c *FakeAlertProviders) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(alertprovidersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(alertprovidersResource, c.ns, opts)) } // Create takes the representation of a alertProvider and creates it. Returns the server's representation of the alertProvider, and an error, if there is any. func (c *FakeAlertProviders) Create(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.CreateOptions) (result *v1beta1.AlertProvider, err error) { + emptyResult := &v1beta1.AlertProvider{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(alertprovidersResource, c.ns, alertProvider), &v1beta1.AlertProvider{}) + Invokes(testing.NewCreateActionWithOptions(alertprovidersResource, c.ns, alertProvider, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AlertProvider), err } // Update takes the representation of a alertProvider and updates it. Returns the server's representation of the alertProvider, and an error, if there is any. func (c *FakeAlertProviders) Update(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (result *v1beta1.AlertProvider, err error) { + emptyResult := &v1beta1.AlertProvider{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(alertprovidersResource, c.ns, alertProvider), &v1beta1.AlertProvider{}) + Invokes(testing.NewUpdateActionWithOptions(alertprovidersResource, c.ns, alertProvider, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AlertProvider), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeAlertProviders) UpdateStatus(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (*v1beta1.AlertProvider, error) { +func (c *FakeAlertProviders) UpdateStatus(ctx context.Context, alertProvider *v1beta1.AlertProvider, opts v1.UpdateOptions) (result *v1beta1.AlertProvider, err error) { + emptyResult := &v1beta1.AlertProvider{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(alertprovidersResource, "status", c.ns, alertProvider), &v1beta1.AlertProvider{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(alertprovidersResource, "status", c.ns, alertProvider, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AlertProvider), err } @@ -123,7 +128,7 @@ func (c *FakeAlertProviders) Delete(ctx context.Context, name string, opts v1.De // DeleteCollection deletes a collection of objects. func (c *FakeAlertProviders) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(alertprovidersResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(alertprovidersResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.AlertProviderList{}) return err @@ -131,11 +136,12 @@ func (c *FakeAlertProviders) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched alertProvider. func (c *FakeAlertProviders) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.AlertProvider, err error) { + emptyResult := &v1beta1.AlertProvider{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(alertprovidersResource, c.ns, name, pt, data, subresources...), &v1beta1.AlertProvider{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(alertprovidersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.AlertProvider), err } diff --git a/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_canary.go b/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_canary.go index 7f66ee02b..2767fba7a 100644 --- a/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_canary.go +++ b/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_canary.go @@ -41,22 +41,24 @@ var canariesKind = v1beta1.SchemeGroupVersion.WithKind("Canary") // Get takes name of the canary, and returns the corresponding canary object, and an error if there is any. func (c *FakeCanaries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Canary, err error) { + emptyResult := &v1beta1.Canary{} obj, err := c.Fake. - Invokes(testing.NewGetAction(canariesResource, c.ns, name), &v1beta1.Canary{}) + Invokes(testing.NewGetActionWithOptions(canariesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Canary), err } // List takes label and field selectors, and returns the list of Canaries that match those selectors. func (c *FakeCanaries) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CanaryList, err error) { + emptyResult := &v1beta1.CanaryList{} obj, err := c.Fake. - Invokes(testing.NewListAction(canariesResource, canariesKind, c.ns, opts), &v1beta1.CanaryList{}) + Invokes(testing.NewListActionWithOptions(canariesResource, canariesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeCanaries) List(ctx context.Context, opts v1.ListOptions) (result *v // Watch returns a watch.Interface that watches the requested canaries. func (c *FakeCanaries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(canariesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(canariesResource, c.ns, opts)) } // Create takes the representation of a canary and creates it. Returns the server's representation of the canary, and an error, if there is any. func (c *FakeCanaries) Create(ctx context.Context, canary *v1beta1.Canary, opts v1.CreateOptions) (result *v1beta1.Canary, err error) { + emptyResult := &v1beta1.Canary{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(canariesResource, c.ns, canary), &v1beta1.Canary{}) + Invokes(testing.NewCreateActionWithOptions(canariesResource, c.ns, canary, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Canary), err } // Update takes the representation of a canary and updates it. Returns the server's representation of the canary, and an error, if there is any. func (c *FakeCanaries) Update(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (result *v1beta1.Canary, err error) { + emptyResult := &v1beta1.Canary{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(canariesResource, c.ns, canary), &v1beta1.Canary{}) + Invokes(testing.NewUpdateActionWithOptions(canariesResource, c.ns, canary, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Canary), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCanaries) UpdateStatus(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (*v1beta1.Canary, error) { +func (c *FakeCanaries) UpdateStatus(ctx context.Context, canary *v1beta1.Canary, opts v1.UpdateOptions) (result *v1beta1.Canary, err error) { + emptyResult := &v1beta1.Canary{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(canariesResource, "status", c.ns, canary), &v1beta1.Canary{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(canariesResource, "status", c.ns, canary, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Canary), err } @@ -123,7 +128,7 @@ func (c *FakeCanaries) Delete(ctx context.Context, name string, opts v1.DeleteOp // DeleteCollection deletes a collection of objects. func (c *FakeCanaries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(canariesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(canariesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.CanaryList{}) return err @@ -131,11 +136,12 @@ func (c *FakeCanaries) DeleteCollection(ctx context.Context, opts v1.DeleteOptio // Patch applies the patch and returns the patched canary. func (c *FakeCanaries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Canary, err error) { + emptyResult := &v1beta1.Canary{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(canariesResource, c.ns, name, pt, data, subresources...), &v1beta1.Canary{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(canariesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Canary), err } diff --git a/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_metrictemplate.go b/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_metrictemplate.go index 33e417e2a..da6b10615 100644 --- a/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_metrictemplate.go +++ b/pkg/client/clientset/versioned/typed/flagger/v1beta1/fake/fake_metrictemplate.go @@ -41,22 +41,24 @@ var metrictemplatesKind = v1beta1.SchemeGroupVersion.WithKind("MetricTemplate") // Get takes name of the metricTemplate, and returns the corresponding metricTemplate object, and an error if there is any. func (c *FakeMetricTemplates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.MetricTemplate, err error) { + emptyResult := &v1beta1.MetricTemplate{} obj, err := c.Fake. - Invokes(testing.NewGetAction(metrictemplatesResource, c.ns, name), &v1beta1.MetricTemplate{}) + Invokes(testing.NewGetActionWithOptions(metrictemplatesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.MetricTemplate), err } // List takes label and field selectors, and returns the list of MetricTemplates that match those selectors. func (c *FakeMetricTemplates) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.MetricTemplateList, err error) { + emptyResult := &v1beta1.MetricTemplateList{} obj, err := c.Fake. - Invokes(testing.NewListAction(metrictemplatesResource, metrictemplatesKind, c.ns, opts), &v1beta1.MetricTemplateList{}) + Invokes(testing.NewListActionWithOptions(metrictemplatesResource, metrictemplatesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeMetricTemplates) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested metricTemplates. func (c *FakeMetricTemplates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(metrictemplatesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(metrictemplatesResource, c.ns, opts)) } // Create takes the representation of a metricTemplate and creates it. Returns the server's representation of the metricTemplate, and an error, if there is any. func (c *FakeMetricTemplates) Create(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.CreateOptions) (result *v1beta1.MetricTemplate, err error) { + emptyResult := &v1beta1.MetricTemplate{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(metrictemplatesResource, c.ns, metricTemplate), &v1beta1.MetricTemplate{}) + Invokes(testing.NewCreateActionWithOptions(metrictemplatesResource, c.ns, metricTemplate, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.MetricTemplate), err } // Update takes the representation of a metricTemplate and updates it. Returns the server's representation of the metricTemplate, and an error, if there is any. func (c *FakeMetricTemplates) Update(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (result *v1beta1.MetricTemplate, err error) { + emptyResult := &v1beta1.MetricTemplate{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(metrictemplatesResource, c.ns, metricTemplate), &v1beta1.MetricTemplate{}) + Invokes(testing.NewUpdateActionWithOptions(metrictemplatesResource, c.ns, metricTemplate, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.MetricTemplate), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeMetricTemplates) UpdateStatus(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (*v1beta1.MetricTemplate, error) { +func (c *FakeMetricTemplates) UpdateStatus(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (result *v1beta1.MetricTemplate, err error) { + emptyResult := &v1beta1.MetricTemplate{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(metrictemplatesResource, "status", c.ns, metricTemplate), &v1beta1.MetricTemplate{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(metrictemplatesResource, "status", c.ns, metricTemplate, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.MetricTemplate), err } @@ -123,7 +128,7 @@ func (c *FakeMetricTemplates) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeMetricTemplates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(metrictemplatesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(metrictemplatesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.MetricTemplateList{}) return err @@ -131,11 +136,12 @@ func (c *FakeMetricTemplates) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched metricTemplate. func (c *FakeMetricTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.MetricTemplate, err error) { + emptyResult := &v1beta1.MetricTemplate{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(metrictemplatesResource, c.ns, name, pt, data, subresources...), &v1beta1.MetricTemplate{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(metrictemplatesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.MetricTemplate), err } diff --git a/pkg/client/clientset/versioned/typed/flagger/v1beta1/metrictemplate.go b/pkg/client/clientset/versioned/typed/flagger/v1beta1/metrictemplate.go index 071cc254d..8809e07ce 100644 --- a/pkg/client/clientset/versioned/typed/flagger/v1beta1/metrictemplate.go +++ b/pkg/client/clientset/versioned/typed/flagger/v1beta1/metrictemplate.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // MetricTemplatesGetter has a method to return a MetricTemplateInterface. @@ -40,6 +39,7 @@ type MetricTemplatesGetter interface { type MetricTemplateInterface interface { Create(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.CreateOptions) (*v1beta1.MetricTemplate, error) Update(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (*v1beta1.MetricTemplate, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (*v1beta1.MetricTemplate, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type MetricTemplateInterface interface { // metricTemplates implements MetricTemplateInterface type metricTemplates struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.MetricTemplate, *v1beta1.MetricTemplateList] } // newMetricTemplates returns a MetricTemplates func newMetricTemplates(c *FlaggerV1beta1Client, namespace string) *metricTemplates { return &metricTemplates{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.MetricTemplate, *v1beta1.MetricTemplateList]( + "metrictemplates", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.MetricTemplate { return &v1beta1.MetricTemplate{} }, + func() *v1beta1.MetricTemplateList { return &v1beta1.MetricTemplateList{} }), } } - -// Get takes name of the metricTemplate, and returns the corresponding metricTemplate object, and an error if there is any. -func (c *metricTemplates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.MetricTemplate, err error) { - result = &v1beta1.MetricTemplate{} - err = c.client.Get(). - Namespace(c.ns). - Resource("metrictemplates"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of MetricTemplates that match those selectors. -func (c *metricTemplates) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.MetricTemplateList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.MetricTemplateList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("metrictemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested metricTemplates. -func (c *metricTemplates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("metrictemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a metricTemplate and creates it. Returns the server's representation of the metricTemplate, and an error, if there is any. -func (c *metricTemplates) Create(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.CreateOptions) (result *v1beta1.MetricTemplate, err error) { - result = &v1beta1.MetricTemplate{} - err = c.client.Post(). - Namespace(c.ns). - Resource("metrictemplates"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(metricTemplate). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a metricTemplate and updates it. Returns the server's representation of the metricTemplate, and an error, if there is any. -func (c *metricTemplates) Update(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (result *v1beta1.MetricTemplate, err error) { - result = &v1beta1.MetricTemplate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("metrictemplates"). - Name(metricTemplate.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(metricTemplate). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *metricTemplates) UpdateStatus(ctx context.Context, metricTemplate *v1beta1.MetricTemplate, opts v1.UpdateOptions) (result *v1beta1.MetricTemplate, err error) { - result = &v1beta1.MetricTemplate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("metrictemplates"). - Name(metricTemplate.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(metricTemplate). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the metricTemplate and deletes it. Returns an error if one occurs. -func (c *metricTemplates) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("metrictemplates"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *metricTemplates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("metrictemplates"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched metricTemplate. -func (c *metricTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.MetricTemplate, err error) { - result = &v1beta1.MetricTemplate{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("metrictemplates"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/gatewayapi/v1/fake/fake_httproute.go b/pkg/client/clientset/versioned/typed/gatewayapi/v1/fake/fake_httproute.go index 7d622c7f7..ba4a1457e 100644 --- a/pkg/client/clientset/versioned/typed/gatewayapi/v1/fake/fake_httproute.go +++ b/pkg/client/clientset/versioned/typed/gatewayapi/v1/fake/fake_httproute.go @@ -41,22 +41,24 @@ var httproutesKind = v1.SchemeGroupVersion.WithKind("HTTPRoute") // Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. func (c *FakeHTTPRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HTTPRoute, err error) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httproutesResource, c.ns, name), &v1.HTTPRoute{}) + Invokes(testing.NewGetActionWithOptions(httproutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } // List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. func (c *FakeHTTPRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HTTPRouteList, err error) { + emptyResult := &v1.HTTPRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httproutesResource, httproutesKind, c.ns, opts), &v1.HTTPRouteList{}) + Invokes(testing.NewListActionWithOptions(httproutesResource, httproutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeHTTPRoutes) List(ctx context.Context, opts metav1.ListOptions) (res // Watch returns a watch.Interface that watches the requested hTTPRoutes. func (c *FakeHTTPRoutes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(httproutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(httproutesResource, c.ns, opts)) } // Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. func (c *FakeHTTPRoutes) Create(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.CreateOptions) (result *v1.HTTPRoute, err error) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httproutesResource, c.ns, hTTPRoute), &v1.HTTPRoute{}) + Invokes(testing.NewCreateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } // Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. func (c *FakeHTTPRoutes) Update(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httproutesResource, c.ns, hTTPRoute), &v1.HTTPRoute{}) + Invokes(testing.NewUpdateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (*v1.HTTPRoute, error) { +func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httproutesResource, "status", c.ns, hTTPRoute), &v1.HTTPRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httproutesResource, "status", c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } @@ -123,7 +128,7 @@ func (c *FakeHTTPRoutes) Delete(ctx context.Context, name string, opts metav1.De // DeleteCollection deletes a collection of objects. func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(httproutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(httproutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.HTTPRouteList{}) return err @@ -131,11 +136,12 @@ func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts metav1.Delet // Patch applies the patch and returns the patched hTTPRoute. func (c *FakeHTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HTTPRoute, err error) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, name, pt, data, subresources...), &v1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } diff --git a/pkg/client/clientset/versioned/typed/gatewayapi/v1/httproute.go b/pkg/client/clientset/versioned/typed/gatewayapi/v1/httproute.go index b115d5573..e46cf15da 100644 --- a/pkg/client/clientset/versioned/typed/gatewayapi/v1/httproute.go +++ b/pkg/client/clientset/versioned/typed/gatewayapi/v1/httproute.go @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // HTTPRoutesGetter has a method to return a HTTPRouteInterface. @@ -40,6 +39,7 @@ type HTTPRoutesGetter interface { type HTTPRouteInterface interface { Create(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.CreateOptions) (*v1.HTTPRoute, error) Update(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (*v1.HTTPRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (*v1.HTTPRoute, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -52,144 +52,18 @@ type HTTPRouteInterface interface { // hTTPRoutes implements HTTPRouteInterface type hTTPRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.HTTPRoute, *v1.HTTPRouteList] } // newHTTPRoutes returns a HTTPRoutes func newHTTPRoutes(c *GatewayapiV1Client, namespace string) *hTTPRoutes { return &hTTPRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.HTTPRoute, *v1.HTTPRouteList]( + "httproutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.HTTPRoute { return &v1.HTTPRoute{} }, + func() *v1.HTTPRouteList { return &v1.HTTPRouteList{} }), } } - -// Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. -func (c *hTTPRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HTTPRoute, err error) { - result = &v1.HTTPRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httproutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. -func (c *hTTPRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HTTPRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.HTTPRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested hTTPRoutes. -func (c *hTTPRoutes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. -func (c *hTTPRoutes) Create(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.CreateOptions) (result *v1.HTTPRoute, err error) { - result = &v1.HTTPRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. -func (c *hTTPRoutes) Update(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { - result = &v1.HTTPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httproutes"). - Name(hTTPRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPRoute). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *hTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { - result = &v1.HTTPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httproutes"). - Name(hTTPRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the hTTPRoute and deletes it. Returns an error if one occurs. -func (c *hTTPRoutes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("httproutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *hTTPRoutes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched hTTPRoute. -func (c *hTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HTTPRoute, err error) { - result = &v1.HTTPRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("httproutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/fake/fake_httproute.go b/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/fake/fake_httproute.go index 89108e2b4..dae821d5b 100644 --- a/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/fake/fake_httproute.go +++ b/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/fake/fake_httproute.go @@ -41,22 +41,24 @@ var httproutesKind = v1beta1.SchemeGroupVersion.WithKind("HTTPRoute") // Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. func (c *FakeHTTPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httproutesResource, c.ns, name), &v1beta1.HTTPRoute{}) + Invokes(testing.NewGetActionWithOptions(httproutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } // List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. func (c *FakeHTTPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.HTTPRouteList, err error) { + emptyResult := &v1beta1.HTTPRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httproutesResource, httproutesKind, c.ns, opts), &v1beta1.HTTPRouteList{}) + Invokes(testing.NewListActionWithOptions(httproutesResource, httproutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeHTTPRoutes) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested hTTPRoutes. func (c *FakeHTTPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(httproutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(httproutesResource, c.ns, opts)) } // Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. func (c *FakeHTTPRoutes) Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httproutesResource, c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + Invokes(testing.NewCreateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } // Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. func (c *FakeHTTPRoutes) Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httproutesResource, c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + Invokes(testing.NewUpdateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) { +func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httproutesResource, "status", c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httproutesResource, "status", c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } @@ -123,7 +128,7 @@ func (c *FakeHTTPRoutes) Delete(ctx context.Context, name string, opts v1.Delete // DeleteCollection deletes a collection of objects. func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(httproutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(httproutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.HTTPRouteList{}) return err @@ -131,11 +136,12 @@ func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOpt // Patch applies the patch and returns the patched hTTPRoute. func (c *FakeHTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, name, pt, data, subresources...), &v1beta1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } diff --git a/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/httproute.go b/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/httproute.go index a0ddefebc..6bb916924 100644 --- a/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/httproute.go +++ b/pkg/client/clientset/versioned/typed/gatewayapi/v1beta1/httproute.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // HTTPRoutesGetter has a method to return a HTTPRouteInterface. @@ -40,6 +39,7 @@ type HTTPRoutesGetter interface { type HTTPRouteInterface interface { Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (*v1beta1.HTTPRoute, error) Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type HTTPRouteInterface interface { // hTTPRoutes implements HTTPRouteInterface type hTTPRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.HTTPRoute, *v1beta1.HTTPRouteList] } // newHTTPRoutes returns a HTTPRoutes func newHTTPRoutes(c *GatewayapiV1beta1Client, namespace string) *hTTPRoutes { return &hTTPRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.HTTPRoute, *v1beta1.HTTPRouteList]( + "httproutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.HTTPRoute { return &v1beta1.HTTPRoute{} }, + func() *v1beta1.HTTPRouteList { return &v1beta1.HTTPRouteList{} }), } } - -// Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. -func (c *hTTPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.HTTPRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httproutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. -func (c *hTTPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.HTTPRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.HTTPRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested hTTPRoutes. -func (c *hTTPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. -func (c *hTTPRoutes) Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.HTTPRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. -func (c *hTTPRoutes) Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.HTTPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httproutes"). - Name(hTTPRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPRoute). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *hTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.HTTPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httproutes"). - Name(hTTPRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the hTTPRoute and deletes it. Returns an error if one occurs. -func (c *hTTPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("httproutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *hTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("httproutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched hTTPRoute. -func (c *hTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.HTTPRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("httproutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go b/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go index 4d2d1cc84..b50a00263 100644 --- a/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go +++ b/pkg/client/clientset/versioned/typed/gloo/v1/fake/fake_upstream.go @@ -41,22 +41,24 @@ var upstreamsKind = v1.SchemeGroupVersion.WithKind("Upstream") // Get takes name of the upstream, and returns the corresponding upstream object, and an error if there is any. func (c *FakeUpstreams) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Upstream, err error) { + emptyResult := &v1.Upstream{} obj, err := c.Fake. - Invokes(testing.NewGetAction(upstreamsResource, c.ns, name), &v1.Upstream{}) + Invokes(testing.NewGetActionWithOptions(upstreamsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Upstream), err } // List takes label and field selectors, and returns the list of Upstreams that match those selectors. func (c *FakeUpstreams) List(ctx context.Context, opts metav1.ListOptions) (result *v1.UpstreamList, err error) { + emptyResult := &v1.UpstreamList{} obj, err := c.Fake. - Invokes(testing.NewListAction(upstreamsResource, upstreamsKind, c.ns, opts), &v1.UpstreamList{}) + Invokes(testing.NewListActionWithOptions(upstreamsResource, upstreamsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeUpstreams) List(ctx context.Context, opts metav1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested upstreams. func (c *FakeUpstreams) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(upstreamsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(upstreamsResource, c.ns, opts)) } // Create takes the representation of a upstream and creates it. Returns the server's representation of the upstream, and an error, if there is any. func (c *FakeUpstreams) Create(ctx context.Context, upstream *v1.Upstream, opts metav1.CreateOptions) (result *v1.Upstream, err error) { + emptyResult := &v1.Upstream{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(upstreamsResource, c.ns, upstream), &v1.Upstream{}) + Invokes(testing.NewCreateActionWithOptions(upstreamsResource, c.ns, upstream, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Upstream), err } // Update takes the representation of a upstream and updates it. Returns the server's representation of the upstream, and an error, if there is any. func (c *FakeUpstreams) Update(ctx context.Context, upstream *v1.Upstream, opts metav1.UpdateOptions) (result *v1.Upstream, err error) { + emptyResult := &v1.Upstream{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(upstreamsResource, c.ns, upstream), &v1.Upstream{}) + Invokes(testing.NewUpdateActionWithOptions(upstreamsResource, c.ns, upstream, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Upstream), err } @@ -111,7 +115,7 @@ func (c *FakeUpstreams) Delete(ctx context.Context, name string, opts metav1.Del // DeleteCollection deletes a collection of objects. func (c *FakeUpstreams) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(upstreamsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(upstreamsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.UpstreamList{}) return err @@ -119,11 +123,12 @@ func (c *FakeUpstreams) DeleteCollection(ctx context.Context, opts metav1.Delete // Patch applies the patch and returns the patched upstream. func (c *FakeUpstreams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Upstream, err error) { + emptyResult := &v1.Upstream{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(upstreamsResource, c.ns, name, pt, data, subresources...), &v1.Upstream{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(upstreamsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Upstream), err } diff --git a/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go b/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go index 9e465830f..36ac114e8 100644 --- a/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go +++ b/pkg/client/clientset/versioned/typed/gloo/v1/upstream.go @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // UpstreamsGetter has a method to return a UpstreamInterface. @@ -51,128 +50,18 @@ type UpstreamInterface interface { // upstreams implements UpstreamInterface type upstreams struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.Upstream, *v1.UpstreamList] } // newUpstreams returns a Upstreams func newUpstreams(c *GlooV1Client, namespace string) *upstreams { return &upstreams{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.Upstream, *v1.UpstreamList]( + "upstreams", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.Upstream { return &v1.Upstream{} }, + func() *v1.UpstreamList { return &v1.UpstreamList{} }), } } - -// Get takes name of the upstream, and returns the corresponding upstream object, and an error if there is any. -func (c *upstreams) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Upstream, err error) { - result = &v1.Upstream{} - err = c.client.Get(). - Namespace(c.ns). - Resource("upstreams"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Upstreams that match those selectors. -func (c *upstreams) List(ctx context.Context, opts metav1.ListOptions) (result *v1.UpstreamList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.UpstreamList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("upstreams"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested upstreams. -func (c *upstreams) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("upstreams"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a upstream and creates it. Returns the server's representation of the upstream, and an error, if there is any. -func (c *upstreams) Create(ctx context.Context, upstream *v1.Upstream, opts metav1.CreateOptions) (result *v1.Upstream, err error) { - result = &v1.Upstream{} - err = c.client.Post(). - Namespace(c.ns). - Resource("upstreams"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(upstream). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a upstream and updates it. Returns the server's representation of the upstream, and an error, if there is any. -func (c *upstreams) Update(ctx context.Context, upstream *v1.Upstream, opts metav1.UpdateOptions) (result *v1.Upstream, err error) { - result = &v1.Upstream{} - err = c.client.Put(). - Namespace(c.ns). - Resource("upstreams"). - Name(upstream.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(upstream). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the upstream and deletes it. Returns an error if one occurs. -func (c *upstreams) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("upstreams"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *upstreams) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("upstreams"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched upstream. -func (c *upstreams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Upstream, err error) { - result = &v1.Upstream{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("upstreams"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go index 68eedfa47..a53327860 100644 --- a/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go +++ b/pkg/client/clientset/versioned/typed/gloogateway/v1/fake/fake_routetable.go @@ -41,22 +41,24 @@ var routetablesKind = v1.SchemeGroupVersion.WithKind("RouteTable") // Get takes name of the routeTable, and returns the corresponding routeTable object, and an error if there is any. func (c *FakeRouteTables) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.RouteTable, err error) { + emptyResult := &v1.RouteTable{} obj, err := c.Fake. - Invokes(testing.NewGetAction(routetablesResource, c.ns, name), &v1.RouteTable{}) + Invokes(testing.NewGetActionWithOptions(routetablesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.RouteTable), err } // List takes label and field selectors, and returns the list of RouteTables that match those selectors. func (c *FakeRouteTables) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RouteTableList, err error) { + emptyResult := &v1.RouteTableList{} obj, err := c.Fake. - Invokes(testing.NewListAction(routetablesResource, routetablesKind, c.ns, opts), &v1.RouteTableList{}) + Invokes(testing.NewListActionWithOptions(routetablesResource, routetablesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeRouteTables) List(ctx context.Context, opts metav1.ListOptions) (re // Watch returns a watch.Interface that watches the requested routeTables. func (c *FakeRouteTables) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(routetablesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(routetablesResource, c.ns, opts)) } // Create takes the representation of a routeTable and creates it. Returns the server's representation of the routeTable, and an error, if there is any. func (c *FakeRouteTables) Create(ctx context.Context, routeTable *v1.RouteTable, opts metav1.CreateOptions) (result *v1.RouteTable, err error) { + emptyResult := &v1.RouteTable{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(routetablesResource, c.ns, routeTable), &v1.RouteTable{}) + Invokes(testing.NewCreateActionWithOptions(routetablesResource, c.ns, routeTable, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.RouteTable), err } // Update takes the representation of a routeTable and updates it. Returns the server's representation of the routeTable, and an error, if there is any. func (c *FakeRouteTables) Update(ctx context.Context, routeTable *v1.RouteTable, opts metav1.UpdateOptions) (result *v1.RouteTable, err error) { + emptyResult := &v1.RouteTable{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(routetablesResource, c.ns, routeTable), &v1.RouteTable{}) + Invokes(testing.NewUpdateActionWithOptions(routetablesResource, c.ns, routeTable, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.RouteTable), err } @@ -111,7 +115,7 @@ func (c *FakeRouteTables) Delete(ctx context.Context, name string, opts metav1.D // DeleteCollection deletes a collection of objects. func (c *FakeRouteTables) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(routetablesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(routetablesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.RouteTableList{}) return err @@ -119,11 +123,12 @@ func (c *FakeRouteTables) DeleteCollection(ctx context.Context, opts metav1.Dele // Patch applies the patch and returns the patched routeTable. func (c *FakeRouteTables) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RouteTable, err error) { + emptyResult := &v1.RouteTable{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(routetablesResource, c.ns, name, pt, data, subresources...), &v1.RouteTable{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(routetablesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.RouteTable), err } diff --git a/pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go b/pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go index cc7f2c9b5..66f8411d0 100644 --- a/pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go +++ b/pkg/client/clientset/versioned/typed/gloogateway/v1/routetable.go @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // RouteTablesGetter has a method to return a RouteTableInterface. @@ -51,128 +50,18 @@ type RouteTableInterface interface { // routeTables implements RouteTableInterface type routeTables struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.RouteTable, *v1.RouteTableList] } // newRouteTables returns a RouteTables func newRouteTables(c *GatewayV1Client, namespace string) *routeTables { return &routeTables{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.RouteTable, *v1.RouteTableList]( + "routetables", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.RouteTable { return &v1.RouteTable{} }, + func() *v1.RouteTableList { return &v1.RouteTableList{} }), } } - -// Get takes name of the routeTable, and returns the corresponding routeTable object, and an error if there is any. -func (c *routeTables) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.RouteTable, err error) { - result = &v1.RouteTable{} - err = c.client.Get(). - Namespace(c.ns). - Resource("routetables"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of RouteTables that match those selectors. -func (c *routeTables) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RouteTableList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.RouteTableList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("routetables"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested routeTables. -func (c *routeTables) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("routetables"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a routeTable and creates it. Returns the server's representation of the routeTable, and an error, if there is any. -func (c *routeTables) Create(ctx context.Context, routeTable *v1.RouteTable, opts metav1.CreateOptions) (result *v1.RouteTable, err error) { - result = &v1.RouteTable{} - err = c.client.Post(). - Namespace(c.ns). - Resource("routetables"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(routeTable). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a routeTable and updates it. Returns the server's representation of the routeTable, and an error, if there is any. -func (c *routeTables) Update(ctx context.Context, routeTable *v1.RouteTable, opts metav1.UpdateOptions) (result *v1.RouteTable, err error) { - result = &v1.RouteTable{} - err = c.client.Put(). - Namespace(c.ns). - Resource("routetables"). - Name(routeTable.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(routeTable). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the routeTable and deletes it. Returns an error if one occurs. -func (c *routeTables) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("routetables"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *routeTables) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("routetables"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched routeTable. -func (c *routeTables) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RouteTable, err error) { - result = &v1.RouteTable{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("routetables"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/istio/v1beta1/destinationrule.go b/pkg/client/clientset/versioned/typed/istio/v1beta1/destinationrule.go index 738fe9495..8e140a870 100644 --- a/pkg/client/clientset/versioned/typed/istio/v1beta1/destinationrule.go +++ b/pkg/client/clientset/versioned/typed/istio/v1beta1/destinationrule.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // DestinationRulesGetter has a method to return a DestinationRuleInterface. @@ -51,128 +50,18 @@ type DestinationRuleInterface interface { // destinationRules implements DestinationRuleInterface type destinationRules struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.DestinationRule, *v1beta1.DestinationRuleList] } // newDestinationRules returns a DestinationRules func newDestinationRules(c *NetworkingV1beta1Client, namespace string) *destinationRules { return &destinationRules{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.DestinationRule, *v1beta1.DestinationRuleList]( + "destinationrules", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.DestinationRule { return &v1beta1.DestinationRule{} }, + func() *v1beta1.DestinationRuleList { return &v1beta1.DestinationRuleList{} }), } } - -// Get takes name of the destinationRule, and returns the corresponding destinationRule object, and an error if there is any. -func (c *destinationRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DestinationRule, err error) { - result = &v1beta1.DestinationRule{} - err = c.client.Get(). - Namespace(c.ns). - Resource("destinationrules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DestinationRules that match those selectors. -func (c *destinationRules) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DestinationRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DestinationRuleList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("destinationrules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested destinationRules. -func (c *destinationRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("destinationrules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a destinationRule and creates it. Returns the server's representation of the destinationRule, and an error, if there is any. -func (c *destinationRules) Create(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.CreateOptions) (result *v1beta1.DestinationRule, err error) { - result = &v1beta1.DestinationRule{} - err = c.client.Post(). - Namespace(c.ns). - Resource("destinationrules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(destinationRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a destinationRule and updates it. Returns the server's representation of the destinationRule, and an error, if there is any. -func (c *destinationRules) Update(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.UpdateOptions) (result *v1beta1.DestinationRule, err error) { - result = &v1beta1.DestinationRule{} - err = c.client.Put(). - Namespace(c.ns). - Resource("destinationrules"). - Name(destinationRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(destinationRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the destinationRule and deletes it. Returns an error if one occurs. -func (c *destinationRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("destinationrules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *destinationRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("destinationrules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched destinationRule. -func (c *destinationRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DestinationRule, err error) { - result = &v1beta1.DestinationRule{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("destinationrules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_destinationrule.go b/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_destinationrule.go index e3947b56f..d6535c59a 100644 --- a/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_destinationrule.go +++ b/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_destinationrule.go @@ -41,22 +41,24 @@ var destinationrulesKind = v1beta1.SchemeGroupVersion.WithKind("DestinationRule" // Get takes name of the destinationRule, and returns the corresponding destinationRule object, and an error if there is any. func (c *FakeDestinationRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DestinationRule, err error) { + emptyResult := &v1beta1.DestinationRule{} obj, err := c.Fake. - Invokes(testing.NewGetAction(destinationrulesResource, c.ns, name), &v1beta1.DestinationRule{}) + Invokes(testing.NewGetActionWithOptions(destinationrulesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DestinationRule), err } // List takes label and field selectors, and returns the list of DestinationRules that match those selectors. func (c *FakeDestinationRules) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DestinationRuleList, err error) { + emptyResult := &v1beta1.DestinationRuleList{} obj, err := c.Fake. - Invokes(testing.NewListAction(destinationrulesResource, destinationrulesKind, c.ns, opts), &v1beta1.DestinationRuleList{}) + Invokes(testing.NewListActionWithOptions(destinationrulesResource, destinationrulesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeDestinationRules) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested destinationRules. func (c *FakeDestinationRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(destinationrulesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(destinationrulesResource, c.ns, opts)) } // Create takes the representation of a destinationRule and creates it. Returns the server's representation of the destinationRule, and an error, if there is any. func (c *FakeDestinationRules) Create(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.CreateOptions) (result *v1beta1.DestinationRule, err error) { + emptyResult := &v1beta1.DestinationRule{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(destinationrulesResource, c.ns, destinationRule), &v1beta1.DestinationRule{}) + Invokes(testing.NewCreateActionWithOptions(destinationrulesResource, c.ns, destinationRule, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DestinationRule), err } // Update takes the representation of a destinationRule and updates it. Returns the server's representation of the destinationRule, and an error, if there is any. func (c *FakeDestinationRules) Update(ctx context.Context, destinationRule *v1beta1.DestinationRule, opts v1.UpdateOptions) (result *v1beta1.DestinationRule, err error) { + emptyResult := &v1beta1.DestinationRule{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(destinationrulesResource, c.ns, destinationRule), &v1beta1.DestinationRule{}) + Invokes(testing.NewUpdateActionWithOptions(destinationrulesResource, c.ns, destinationRule, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DestinationRule), err } @@ -111,7 +115,7 @@ func (c *FakeDestinationRules) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeDestinationRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(destinationrulesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(destinationrulesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.DestinationRuleList{}) return err @@ -119,11 +123,12 @@ func (c *FakeDestinationRules) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched destinationRule. func (c *FakeDestinationRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DestinationRule, err error) { + emptyResult := &v1beta1.DestinationRule{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(destinationrulesResource, c.ns, name, pt, data, subresources...), &v1beta1.DestinationRule{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(destinationrulesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DestinationRule), err } diff --git a/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_virtualservice.go b/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_virtualservice.go index 41d5830e2..3393896d0 100644 --- a/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_virtualservice.go +++ b/pkg/client/clientset/versioned/typed/istio/v1beta1/fake/fake_virtualservice.go @@ -41,22 +41,24 @@ var virtualservicesKind = v1beta1.SchemeGroupVersion.WithKind("VirtualService") // Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. func (c *FakeVirtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewGetAction(virtualservicesResource, c.ns, name), &v1beta1.VirtualService{}) + Invokes(testing.NewGetActionWithOptions(virtualservicesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } // List takes label and field selectors, and returns the list of VirtualServices that match those selectors. func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualServiceList, err error) { + emptyResult := &v1beta1.VirtualServiceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(virtualservicesResource, virtualservicesKind, c.ns, opts), &v1beta1.VirtualServiceList{}) + Invokes(testing.NewListActionWithOptions(virtualservicesResource, virtualservicesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeVirtualServices) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested virtualServices. func (c *FakeVirtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(virtualservicesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(virtualservicesResource, c.ns, opts)) } // Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. func (c *FakeVirtualServices) Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(virtualservicesResource, c.ns, virtualService), &v1beta1.VirtualService{}) + Invokes(testing.NewCreateActionWithOptions(virtualservicesResource, c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } // Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. func (c *FakeVirtualServices) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(virtualservicesResource, c.ns, virtualService), &v1beta1.VirtualService{}) + Invokes(testing.NewUpdateActionWithOptions(virtualservicesResource, c.ns, virtualService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } @@ -111,7 +115,7 @@ func (c *FakeVirtualServices) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(virtualservicesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(virtualservicesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.VirtualServiceList{}) return err @@ -119,11 +123,12 @@ func (c *FakeVirtualServices) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched virtualService. func (c *FakeVirtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error) { + emptyResult := &v1beta1.VirtualService{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(virtualservicesResource, c.ns, name, pt, data, subresources...), &v1beta1.VirtualService{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(virtualservicesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.VirtualService), err } diff --git a/pkg/client/clientset/versioned/typed/istio/v1beta1/virtualservice.go b/pkg/client/clientset/versioned/typed/istio/v1beta1/virtualservice.go index d8f6c0e38..ea86fb386 100644 --- a/pkg/client/clientset/versioned/typed/istio/v1beta1/virtualservice.go +++ b/pkg/client/clientset/versioned/typed/istio/v1beta1/virtualservice.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // VirtualServicesGetter has a method to return a VirtualServiceInterface. @@ -51,128 +50,18 @@ type VirtualServiceInterface interface { // virtualServices implements VirtualServiceInterface type virtualServices struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.VirtualService, *v1beta1.VirtualServiceList] } // newVirtualServices returns a VirtualServices func newVirtualServices(c *NetworkingV1beta1Client, namespace string) *virtualServices { return &virtualServices{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.VirtualService, *v1beta1.VirtualServiceList]( + "virtualservices", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.VirtualService { return &v1beta1.VirtualService{} }, + func() *v1beta1.VirtualServiceList { return &v1beta1.VirtualServiceList{} }), } } - -// Get takes name of the virtualService, and returns the corresponding virtualService object, and an error if there is any. -func (c *virtualServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VirtualServices that match those selectors. -func (c *virtualServices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.VirtualServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.VirtualServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested virtualServices. -func (c *virtualServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a virtualService and creates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Create(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.CreateOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a virtualService and updates it. Returns the server's representation of the virtualService, and an error, if there is any. -func (c *virtualServices) Update(ctx context.Context, virtualService *v1beta1.VirtualService, opts v1.UpdateOptions) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("virtualservices"). - Name(virtualService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(virtualService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the virtualService and deletes it. Returns an error if one occurs. -func (c *virtualServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *virtualServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("virtualservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched virtualService. -func (c *virtualServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.VirtualService, err error) { - result = &v1beta1.VirtualService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("virtualservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go b/pkg/client/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go index a008e0566..e0617e8c5 100644 --- a/pkg/client/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go +++ b/pkg/client/clientset/versioned/typed/keda/v1alpha1/fake/fake_scaledobject.go @@ -41,22 +41,24 @@ var scaledobjectsKind = v1alpha1.SchemeGroupVersion.WithKind("ScaledObject") // Get takes name of the scaledObject, and returns the corresponding scaledObject object, and an error if there is any. func (c *FakeScaledObjects) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ScaledObject, err error) { + emptyResult := &v1alpha1.ScaledObject{} obj, err := c.Fake. - Invokes(testing.NewGetAction(scaledobjectsResource, c.ns, name), &v1alpha1.ScaledObject{}) + Invokes(testing.NewGetActionWithOptions(scaledobjectsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ScaledObject), err } // List takes label and field selectors, and returns the list of ScaledObjects that match those selectors. func (c *FakeScaledObjects) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ScaledObjectList, err error) { + emptyResult := &v1alpha1.ScaledObjectList{} obj, err := c.Fake. - Invokes(testing.NewListAction(scaledobjectsResource, scaledobjectsKind, c.ns, opts), &v1alpha1.ScaledObjectList{}) + Invokes(testing.NewListActionWithOptions(scaledobjectsResource, scaledobjectsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeScaledObjects) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested scaledObjects. func (c *FakeScaledObjects) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(scaledobjectsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(scaledobjectsResource, c.ns, opts)) } // Create takes the representation of a scaledObject and creates it. Returns the server's representation of the scaledObject, and an error, if there is any. func (c *FakeScaledObjects) Create(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.CreateOptions) (result *v1alpha1.ScaledObject, err error) { + emptyResult := &v1alpha1.ScaledObject{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(scaledobjectsResource, c.ns, scaledObject), &v1alpha1.ScaledObject{}) + Invokes(testing.NewCreateActionWithOptions(scaledobjectsResource, c.ns, scaledObject, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ScaledObject), err } // Update takes the representation of a scaledObject and updates it. Returns the server's representation of the scaledObject, and an error, if there is any. func (c *FakeScaledObjects) Update(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (result *v1alpha1.ScaledObject, err error) { + emptyResult := &v1alpha1.ScaledObject{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(scaledobjectsResource, c.ns, scaledObject), &v1alpha1.ScaledObject{}) + Invokes(testing.NewUpdateActionWithOptions(scaledobjectsResource, c.ns, scaledObject, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ScaledObject), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeScaledObjects) UpdateStatus(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (*v1alpha1.ScaledObject, error) { +func (c *FakeScaledObjects) UpdateStatus(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (result *v1alpha1.ScaledObject, err error) { + emptyResult := &v1alpha1.ScaledObject{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(scaledobjectsResource, "status", c.ns, scaledObject), &v1alpha1.ScaledObject{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(scaledobjectsResource, "status", c.ns, scaledObject, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ScaledObject), err } @@ -123,7 +128,7 @@ func (c *FakeScaledObjects) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeScaledObjects) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(scaledobjectsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(scaledobjectsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ScaledObjectList{}) return err @@ -131,11 +136,12 @@ func (c *FakeScaledObjects) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched scaledObject. func (c *FakeScaledObjects) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ScaledObject, err error) { + emptyResult := &v1alpha1.ScaledObject{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(scaledobjectsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ScaledObject{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(scaledobjectsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ScaledObject), err } diff --git a/pkg/client/clientset/versioned/typed/keda/v1alpha1/scaledobject.go b/pkg/client/clientset/versioned/typed/keda/v1alpha1/scaledobject.go index 3a781d191..09dee96ff 100644 --- a/pkg/client/clientset/versioned/typed/keda/v1alpha1/scaledobject.go +++ b/pkg/client/clientset/versioned/typed/keda/v1alpha1/scaledobject.go @@ -20,14 +20,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ScaledObjectsGetter has a method to return a ScaledObjectInterface. @@ -40,6 +39,7 @@ type ScaledObjectsGetter interface { type ScaledObjectInterface interface { Create(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.CreateOptions) (*v1alpha1.ScaledObject, error) Update(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (*v1alpha1.ScaledObject, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (*v1alpha1.ScaledObject, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type ScaledObjectInterface interface { // scaledObjects implements ScaledObjectInterface type scaledObjects struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ScaledObject, *v1alpha1.ScaledObjectList] } // newScaledObjects returns a ScaledObjects func newScaledObjects(c *KedaV1alpha1Client, namespace string) *scaledObjects { return &scaledObjects{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ScaledObject, *v1alpha1.ScaledObjectList]( + "scaledobjects", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ScaledObject { return &v1alpha1.ScaledObject{} }, + func() *v1alpha1.ScaledObjectList { return &v1alpha1.ScaledObjectList{} }), } } - -// Get takes name of the scaledObject, and returns the corresponding scaledObject object, and an error if there is any. -func (c *scaledObjects) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ScaledObject, err error) { - result = &v1alpha1.ScaledObject{} - err = c.client.Get(). - Namespace(c.ns). - Resource("scaledobjects"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ScaledObjects that match those selectors. -func (c *scaledObjects) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ScaledObjectList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ScaledObjectList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("scaledobjects"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested scaledObjects. -func (c *scaledObjects) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("scaledobjects"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a scaledObject and creates it. Returns the server's representation of the scaledObject, and an error, if there is any. -func (c *scaledObjects) Create(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.CreateOptions) (result *v1alpha1.ScaledObject, err error) { - result = &v1alpha1.ScaledObject{} - err = c.client.Post(). - Namespace(c.ns). - Resource("scaledobjects"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(scaledObject). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a scaledObject and updates it. Returns the server's representation of the scaledObject, and an error, if there is any. -func (c *scaledObjects) Update(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (result *v1alpha1.ScaledObject, err error) { - result = &v1alpha1.ScaledObject{} - err = c.client.Put(). - Namespace(c.ns). - Resource("scaledobjects"). - Name(scaledObject.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(scaledObject). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *scaledObjects) UpdateStatus(ctx context.Context, scaledObject *v1alpha1.ScaledObject, opts v1.UpdateOptions) (result *v1alpha1.ScaledObject, err error) { - result = &v1alpha1.ScaledObject{} - err = c.client.Put(). - Namespace(c.ns). - Resource("scaledobjects"). - Name(scaledObject.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(scaledObject). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the scaledObject and deletes it. Returns an error if one occurs. -func (c *scaledObjects) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("scaledobjects"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *scaledObjects) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("scaledobjects"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched scaledObject. -func (c *scaledObjects) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ScaledObject, err error) { - result = &v1alpha1.ScaledObject{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("scaledobjects"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/kuma/v1alpha1/fake/fake_trafficroute.go b/pkg/client/clientset/versioned/typed/kuma/v1alpha1/fake/fake_trafficroute.go index f200b6c3a..448701b59 100644 --- a/pkg/client/clientset/versioned/typed/kuma/v1alpha1/fake/fake_trafficroute.go +++ b/pkg/client/clientset/versioned/typed/kuma/v1alpha1/fake/fake_trafficroute.go @@ -40,20 +40,22 @@ var trafficroutesKind = v1alpha1.SchemeGroupVersion.WithKind("TrafficRoute") // Get takes name of the trafficRoute, and returns the corresponding trafficRoute object, and an error if there is any. func (c *FakeTrafficRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficRoute, err error) { + emptyResult := &v1alpha1.TrafficRoute{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(trafficroutesResource, name), &v1alpha1.TrafficRoute{}) + Invokes(testing.NewRootGetActionWithOptions(trafficroutesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficRoute), err } // List takes label and field selectors, and returns the list of TrafficRoutes that match those selectors. func (c *FakeTrafficRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficRouteList, err error) { + emptyResult := &v1alpha1.TrafficRouteList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(trafficroutesResource, trafficroutesKind, opts), &v1alpha1.TrafficRouteList{}) + Invokes(testing.NewRootListActionWithOptions(trafficroutesResource, trafficroutesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,25 +74,27 @@ func (c *FakeTrafficRoutes) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested trafficRoutes. func (c *FakeTrafficRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(trafficroutesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(trafficroutesResource, opts)) } // Create takes the representation of a trafficRoute and creates it. Returns the server's representation of the trafficRoute, and an error, if there is any. func (c *FakeTrafficRoutes) Create(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.CreateOptions) (result *v1alpha1.TrafficRoute, err error) { + emptyResult := &v1alpha1.TrafficRoute{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(trafficroutesResource, trafficRoute), &v1alpha1.TrafficRoute{}) + Invokes(testing.NewRootCreateActionWithOptions(trafficroutesResource, trafficRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficRoute), err } // Update takes the representation of a trafficRoute and updates it. Returns the server's representation of the trafficRoute, and an error, if there is any. func (c *FakeTrafficRoutes) Update(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.UpdateOptions) (result *v1alpha1.TrafficRoute, err error) { + emptyResult := &v1alpha1.TrafficRoute{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(trafficroutesResource, trafficRoute), &v1alpha1.TrafficRoute{}) + Invokes(testing.NewRootUpdateActionWithOptions(trafficroutesResource, trafficRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficRoute), err } @@ -104,7 +108,7 @@ func (c *FakeTrafficRoutes) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTrafficRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(trafficroutesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(trafficroutesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.TrafficRouteList{}) return err @@ -112,10 +116,11 @@ func (c *FakeTrafficRoutes) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched trafficRoute. func (c *FakeTrafficRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficRoute, err error) { + emptyResult := &v1alpha1.TrafficRoute{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(trafficroutesResource, name, pt, data, subresources...), &v1alpha1.TrafficRoute{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(trafficroutesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficRoute), err } diff --git a/pkg/client/clientset/versioned/typed/kuma/v1alpha1/trafficroute.go b/pkg/client/clientset/versioned/typed/kuma/v1alpha1/trafficroute.go index 76089aba3..7e238f971 100644 --- a/pkg/client/clientset/versioned/typed/kuma/v1alpha1/trafficroute.go +++ b/pkg/client/clientset/versioned/typed/kuma/v1alpha1/trafficroute.go @@ -20,14 +20,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TrafficRoutesGetter has a method to return a TrafficRouteInterface. @@ -51,118 +50,18 @@ type TrafficRouteInterface interface { // trafficRoutes implements TrafficRouteInterface type trafficRoutes struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.TrafficRoute, *v1alpha1.TrafficRouteList] } // newTrafficRoutes returns a TrafficRoutes func newTrafficRoutes(c *KumaV1alpha1Client) *trafficRoutes { return &trafficRoutes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.TrafficRoute, *v1alpha1.TrafficRouteList]( + "trafficroutes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.TrafficRoute { return &v1alpha1.TrafficRoute{} }, + func() *v1alpha1.TrafficRouteList { return &v1alpha1.TrafficRouteList{} }), } } - -// Get takes name of the trafficRoute, and returns the corresponding trafficRoute object, and an error if there is any. -func (c *trafficRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficRoute, err error) { - result = &v1alpha1.TrafficRoute{} - err = c.client.Get(). - Resource("trafficroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TrafficRoutes that match those selectors. -func (c *trafficRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TrafficRouteList{} - err = c.client.Get(). - Resource("trafficroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested trafficRoutes. -func (c *trafficRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("trafficroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a trafficRoute and creates it. Returns the server's representation of the trafficRoute, and an error, if there is any. -func (c *trafficRoutes) Create(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.CreateOptions) (result *v1alpha1.TrafficRoute, err error) { - result = &v1alpha1.TrafficRoute{} - err = c.client.Post(). - Resource("trafficroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a trafficRoute and updates it. Returns the server's representation of the trafficRoute, and an error, if there is any. -func (c *trafficRoutes) Update(ctx context.Context, trafficRoute *v1alpha1.TrafficRoute, opts v1.UpdateOptions) (result *v1alpha1.TrafficRoute, err error) { - result = &v1alpha1.TrafficRoute{} - err = c.client.Put(). - Resource("trafficroutes"). - Name(trafficRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the trafficRoute and deletes it. Returns an error if one occurs. -func (c *trafficRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("trafficroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *trafficRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("trafficroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched trafficRoute. -func (c *trafficRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficRoute, err error) { - result = &v1alpha1.TrafficRoute{} - err = c.client.Patch(pt). - Resource("trafficroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/projectcontour/v1/fake/fake_httpproxy.go b/pkg/client/clientset/versioned/typed/projectcontour/v1/fake/fake_httpproxy.go index e1037eaec..962495f1b 100644 --- a/pkg/client/clientset/versioned/typed/projectcontour/v1/fake/fake_httpproxy.go +++ b/pkg/client/clientset/versioned/typed/projectcontour/v1/fake/fake_httpproxy.go @@ -41,22 +41,24 @@ var httpproxiesKind = v1.SchemeGroupVersion.WithKind("HTTPProxy") // Get takes name of the hTTPProxy, and returns the corresponding hTTPProxy object, and an error if there is any. func (c *FakeHTTPProxies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HTTPProxy, err error) { + emptyResult := &v1.HTTPProxy{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httpproxiesResource, c.ns, name), &v1.HTTPProxy{}) + Invokes(testing.NewGetActionWithOptions(httpproxiesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPProxy), err } // List takes label and field selectors, and returns the list of HTTPProxies that match those selectors. func (c *FakeHTTPProxies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HTTPProxyList, err error) { + emptyResult := &v1.HTTPProxyList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httpproxiesResource, httpproxiesKind, c.ns, opts), &v1.HTTPProxyList{}) + Invokes(testing.NewListActionWithOptions(httpproxiesResource, httpproxiesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeHTTPProxies) List(ctx context.Context, opts metav1.ListOptions) (re // Watch returns a watch.Interface that watches the requested hTTPProxies. func (c *FakeHTTPProxies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(httpproxiesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(httpproxiesResource, c.ns, opts)) } // Create takes the representation of a hTTPProxy and creates it. Returns the server's representation of the hTTPProxy, and an error, if there is any. func (c *FakeHTTPProxies) Create(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.CreateOptions) (result *v1.HTTPProxy, err error) { + emptyResult := &v1.HTTPProxy{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httpproxiesResource, c.ns, hTTPProxy), &v1.HTTPProxy{}) + Invokes(testing.NewCreateActionWithOptions(httpproxiesResource, c.ns, hTTPProxy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPProxy), err } // Update takes the representation of a hTTPProxy and updates it. Returns the server's representation of the hTTPProxy, and an error, if there is any. func (c *FakeHTTPProxies) Update(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (result *v1.HTTPProxy, err error) { + emptyResult := &v1.HTTPProxy{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httpproxiesResource, c.ns, hTTPProxy), &v1.HTTPProxy{}) + Invokes(testing.NewUpdateActionWithOptions(httpproxiesResource, c.ns, hTTPProxy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPProxy), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeHTTPProxies) UpdateStatus(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (*v1.HTTPProxy, error) { +func (c *FakeHTTPProxies) UpdateStatus(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (result *v1.HTTPProxy, err error) { + emptyResult := &v1.HTTPProxy{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httpproxiesResource, "status", c.ns, hTTPProxy), &v1.HTTPProxy{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httpproxiesResource, "status", c.ns, hTTPProxy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPProxy), err } @@ -123,7 +128,7 @@ func (c *FakeHTTPProxies) Delete(ctx context.Context, name string, opts metav1.D // DeleteCollection deletes a collection of objects. func (c *FakeHTTPProxies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(httpproxiesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(httpproxiesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.HTTPProxyList{}) return err @@ -131,11 +136,12 @@ func (c *FakeHTTPProxies) DeleteCollection(ctx context.Context, opts metav1.Dele // Patch applies the patch and returns the patched hTTPProxy. func (c *FakeHTTPProxies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HTTPProxy, err error) { + emptyResult := &v1.HTTPProxy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httpproxiesResource, c.ns, name, pt, data, subresources...), &v1.HTTPProxy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httpproxiesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPProxy), err } diff --git a/pkg/client/clientset/versioned/typed/projectcontour/v1/httpproxy.go b/pkg/client/clientset/versioned/typed/projectcontour/v1/httpproxy.go index b7528fe7b..bdd3ff323 100644 --- a/pkg/client/clientset/versioned/typed/projectcontour/v1/httpproxy.go +++ b/pkg/client/clientset/versioned/typed/projectcontour/v1/httpproxy.go @@ -20,14 +20,13 @@ package v1 import ( "context" - "time" v1 "github.com/fluxcd/flagger/pkg/apis/projectcontour/v1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // HTTPProxiesGetter has a method to return a HTTPProxyInterface. @@ -40,6 +39,7 @@ type HTTPProxiesGetter interface { type HTTPProxyInterface interface { Create(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.CreateOptions) (*v1.HTTPProxy, error) Update(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (*v1.HTTPProxy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (*v1.HTTPProxy, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -52,144 +52,18 @@ type HTTPProxyInterface interface { // hTTPProxies implements HTTPProxyInterface type hTTPProxies struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.HTTPProxy, *v1.HTTPProxyList] } // newHTTPProxies returns a HTTPProxies func newHTTPProxies(c *ProjectcontourV1Client, namespace string) *hTTPProxies { return &hTTPProxies{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.HTTPProxy, *v1.HTTPProxyList]( + "httpproxies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.HTTPProxy { return &v1.HTTPProxy{} }, + func() *v1.HTTPProxyList { return &v1.HTTPProxyList{} }), } } - -// Get takes name of the hTTPProxy, and returns the corresponding hTTPProxy object, and an error if there is any. -func (c *hTTPProxies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HTTPProxy, err error) { - result = &v1.HTTPProxy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httpproxies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HTTPProxies that match those selectors. -func (c *hTTPProxies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HTTPProxyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.HTTPProxyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httpproxies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested hTTPProxies. -func (c *hTTPProxies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("httpproxies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a hTTPProxy and creates it. Returns the server's representation of the hTTPProxy, and an error, if there is any. -func (c *hTTPProxies) Create(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.CreateOptions) (result *v1.HTTPProxy, err error) { - result = &v1.HTTPProxy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("httpproxies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPProxy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a hTTPProxy and updates it. Returns the server's representation of the hTTPProxy, and an error, if there is any. -func (c *hTTPProxies) Update(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (result *v1.HTTPProxy, err error) { - result = &v1.HTTPProxy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httpproxies"). - Name(hTTPProxy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPProxy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *hTTPProxies) UpdateStatus(ctx context.Context, hTTPProxy *v1.HTTPProxy, opts metav1.UpdateOptions) (result *v1.HTTPProxy, err error) { - result = &v1.HTTPProxy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httpproxies"). - Name(hTTPProxy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPProxy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the hTTPProxy and deletes it. Returns an error if one occurs. -func (c *hTTPProxies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("httpproxies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *hTTPProxies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("httpproxies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched hTTPProxy. -func (c *hTTPProxies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HTTPProxy, err error) { - result = &v1.HTTPProxy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("httpproxies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/smi/v1alpha1/fake/fake_trafficsplit.go b/pkg/client/clientset/versioned/typed/smi/v1alpha1/fake/fake_trafficsplit.go index 3d2df0002..4add69209 100644 --- a/pkg/client/clientset/versioned/typed/smi/v1alpha1/fake/fake_trafficsplit.go +++ b/pkg/client/clientset/versioned/typed/smi/v1alpha1/fake/fake_trafficsplit.go @@ -41,22 +41,24 @@ var trafficsplitsKind = v1alpha1.SchemeGroupVersion.WithKind("TrafficSplit") // Get takes name of the trafficSplit, and returns the corresponding trafficSplit object, and an error if there is any. func (c *FakeTrafficSplits) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficSplit, err error) { + emptyResult := &v1alpha1.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewGetAction(trafficsplitsResource, c.ns, name), &v1alpha1.TrafficSplit{}) + Invokes(testing.NewGetActionWithOptions(trafficsplitsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficSplit), err } // List takes label and field selectors, and returns the list of TrafficSplits that match those selectors. func (c *FakeTrafficSplits) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficSplitList, err error) { + emptyResult := &v1alpha1.TrafficSplitList{} obj, err := c.Fake. - Invokes(testing.NewListAction(trafficsplitsResource, trafficsplitsKind, c.ns, opts), &v1alpha1.TrafficSplitList{}) + Invokes(testing.NewListActionWithOptions(trafficsplitsResource, trafficsplitsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeTrafficSplits) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested trafficSplits. func (c *FakeTrafficSplits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(trafficsplitsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(trafficsplitsResource, c.ns, opts)) } // Create takes the representation of a trafficSplit and creates it. Returns the server's representation of the trafficSplit, and an error, if there is any. func (c *FakeTrafficSplits) Create(ctx context.Context, trafficSplit *v1alpha1.TrafficSplit, opts v1.CreateOptions) (result *v1alpha1.TrafficSplit, err error) { + emptyResult := &v1alpha1.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(trafficsplitsResource, c.ns, trafficSplit), &v1alpha1.TrafficSplit{}) + Invokes(testing.NewCreateActionWithOptions(trafficsplitsResource, c.ns, trafficSplit, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficSplit), err } // Update takes the representation of a trafficSplit and updates it. Returns the server's representation of the trafficSplit, and an error, if there is any. func (c *FakeTrafficSplits) Update(ctx context.Context, trafficSplit *v1alpha1.TrafficSplit, opts v1.UpdateOptions) (result *v1alpha1.TrafficSplit, err error) { + emptyResult := &v1alpha1.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(trafficsplitsResource, c.ns, trafficSplit), &v1alpha1.TrafficSplit{}) + Invokes(testing.NewUpdateActionWithOptions(trafficsplitsResource, c.ns, trafficSplit, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficSplit), err } @@ -111,7 +115,7 @@ func (c *FakeTrafficSplits) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTrafficSplits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(trafficsplitsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(trafficsplitsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.TrafficSplitList{}) return err @@ -119,11 +123,12 @@ func (c *FakeTrafficSplits) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched trafficSplit. func (c *FakeTrafficSplits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficSplit, err error) { + emptyResult := &v1alpha1.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(trafficsplitsResource, c.ns, name, pt, data, subresources...), &v1alpha1.TrafficSplit{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(trafficsplitsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TrafficSplit), err } diff --git a/pkg/client/clientset/versioned/typed/smi/v1alpha1/trafficsplit.go b/pkg/client/clientset/versioned/typed/smi/v1alpha1/trafficsplit.go index 649b9e0d5..78e93fd29 100644 --- a/pkg/client/clientset/versioned/typed/smi/v1alpha1/trafficsplit.go +++ b/pkg/client/clientset/versioned/typed/smi/v1alpha1/trafficsplit.go @@ -20,14 +20,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TrafficSplitsGetter has a method to return a TrafficSplitInterface. @@ -51,128 +50,18 @@ type TrafficSplitInterface interface { // trafficSplits implements TrafficSplitInterface type trafficSplits struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.TrafficSplit, *v1alpha1.TrafficSplitList] } // newTrafficSplits returns a TrafficSplits func newTrafficSplits(c *SplitV1alpha1Client, namespace string) *trafficSplits { return &trafficSplits{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.TrafficSplit, *v1alpha1.TrafficSplitList]( + "trafficsplits", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.TrafficSplit { return &v1alpha1.TrafficSplit{} }, + func() *v1alpha1.TrafficSplitList { return &v1alpha1.TrafficSplitList{} }), } } - -// Get takes name of the trafficSplit, and returns the corresponding trafficSplit object, and an error if there is any. -func (c *trafficSplits) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficSplit, err error) { - result = &v1alpha1.TrafficSplit{} - err = c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TrafficSplits that match those selectors. -func (c *trafficSplits) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficSplitList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TrafficSplitList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested trafficSplits. -func (c *trafficSplits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a trafficSplit and creates it. Returns the server's representation of the trafficSplit, and an error, if there is any. -func (c *trafficSplits) Create(ctx context.Context, trafficSplit *v1alpha1.TrafficSplit, opts v1.CreateOptions) (result *v1alpha1.TrafficSplit, err error) { - result = &v1alpha1.TrafficSplit{} - err = c.client.Post(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficSplit). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a trafficSplit and updates it. Returns the server's representation of the trafficSplit, and an error, if there is any. -func (c *trafficSplits) Update(ctx context.Context, trafficSplit *v1alpha1.TrafficSplit, opts v1.UpdateOptions) (result *v1alpha1.TrafficSplit, err error) { - result = &v1alpha1.TrafficSplit{} - err = c.client.Put(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(trafficSplit.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficSplit). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the trafficSplit and deletes it. Returns an error if one occurs. -func (c *trafficSplits) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *trafficSplits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched trafficSplit. -func (c *trafficSplits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficSplit, err error) { - result = &v1alpha1.TrafficSplit{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/smi/v1alpha2/fake/fake_trafficsplit.go b/pkg/client/clientset/versioned/typed/smi/v1alpha2/fake/fake_trafficsplit.go index b7f93ecf3..80e4059d7 100644 --- a/pkg/client/clientset/versioned/typed/smi/v1alpha2/fake/fake_trafficsplit.go +++ b/pkg/client/clientset/versioned/typed/smi/v1alpha2/fake/fake_trafficsplit.go @@ -41,22 +41,24 @@ var trafficsplitsKind = v1alpha2.SchemeGroupVersion.WithKind("TrafficSplit") // Get takes name of the trafficSplit, and returns the corresponding trafficSplit object, and an error if there is any. func (c *FakeTrafficSplits) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TrafficSplit, err error) { + emptyResult := &v1alpha2.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewGetAction(trafficsplitsResource, c.ns, name), &v1alpha2.TrafficSplit{}) + Invokes(testing.NewGetActionWithOptions(trafficsplitsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficSplit), err } // List takes label and field selectors, and returns the list of TrafficSplits that match those selectors. func (c *FakeTrafficSplits) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TrafficSplitList, err error) { + emptyResult := &v1alpha2.TrafficSplitList{} obj, err := c.Fake. - Invokes(testing.NewListAction(trafficsplitsResource, trafficsplitsKind, c.ns, opts), &v1alpha2.TrafficSplitList{}) + Invokes(testing.NewListActionWithOptions(trafficsplitsResource, trafficsplitsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeTrafficSplits) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested trafficSplits. func (c *FakeTrafficSplits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(trafficsplitsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(trafficsplitsResource, c.ns, opts)) } // Create takes the representation of a trafficSplit and creates it. Returns the server's representation of the trafficSplit, and an error, if there is any. func (c *FakeTrafficSplits) Create(ctx context.Context, trafficSplit *v1alpha2.TrafficSplit, opts v1.CreateOptions) (result *v1alpha2.TrafficSplit, err error) { + emptyResult := &v1alpha2.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(trafficsplitsResource, c.ns, trafficSplit), &v1alpha2.TrafficSplit{}) + Invokes(testing.NewCreateActionWithOptions(trafficsplitsResource, c.ns, trafficSplit, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficSplit), err } // Update takes the representation of a trafficSplit and updates it. Returns the server's representation of the trafficSplit, and an error, if there is any. func (c *FakeTrafficSplits) Update(ctx context.Context, trafficSplit *v1alpha2.TrafficSplit, opts v1.UpdateOptions) (result *v1alpha2.TrafficSplit, err error) { + emptyResult := &v1alpha2.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(trafficsplitsResource, c.ns, trafficSplit), &v1alpha2.TrafficSplit{}) + Invokes(testing.NewUpdateActionWithOptions(trafficsplitsResource, c.ns, trafficSplit, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficSplit), err } @@ -111,7 +115,7 @@ func (c *FakeTrafficSplits) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTrafficSplits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(trafficsplitsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(trafficsplitsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.TrafficSplitList{}) return err @@ -119,11 +123,12 @@ func (c *FakeTrafficSplits) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched trafficSplit. func (c *FakeTrafficSplits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TrafficSplit, err error) { + emptyResult := &v1alpha2.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(trafficsplitsResource, c.ns, name, pt, data, subresources...), &v1alpha2.TrafficSplit{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(trafficsplitsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TrafficSplit), err } diff --git a/pkg/client/clientset/versioned/typed/smi/v1alpha2/trafficsplit.go b/pkg/client/clientset/versioned/typed/smi/v1alpha2/trafficsplit.go index 45f5f4fdc..cd0524a19 100644 --- a/pkg/client/clientset/versioned/typed/smi/v1alpha2/trafficsplit.go +++ b/pkg/client/clientset/versioned/typed/smi/v1alpha2/trafficsplit.go @@ -20,14 +20,13 @@ package v1alpha2 import ( "context" - "time" v1alpha2 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha2" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TrafficSplitsGetter has a method to return a TrafficSplitInterface. @@ -51,128 +50,18 @@ type TrafficSplitInterface interface { // trafficSplits implements TrafficSplitInterface type trafficSplits struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha2.TrafficSplit, *v1alpha2.TrafficSplitList] } // newTrafficSplits returns a TrafficSplits func newTrafficSplits(c *SplitV1alpha2Client, namespace string) *trafficSplits { return &trafficSplits{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha2.TrafficSplit, *v1alpha2.TrafficSplitList]( + "trafficsplits", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.TrafficSplit { return &v1alpha2.TrafficSplit{} }, + func() *v1alpha2.TrafficSplitList { return &v1alpha2.TrafficSplitList{} }), } } - -// Get takes name of the trafficSplit, and returns the corresponding trafficSplit object, and an error if there is any. -func (c *trafficSplits) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TrafficSplit, err error) { - result = &v1alpha2.TrafficSplit{} - err = c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TrafficSplits that match those selectors. -func (c *trafficSplits) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TrafficSplitList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.TrafficSplitList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested trafficSplits. -func (c *trafficSplits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a trafficSplit and creates it. Returns the server's representation of the trafficSplit, and an error, if there is any. -func (c *trafficSplits) Create(ctx context.Context, trafficSplit *v1alpha2.TrafficSplit, opts v1.CreateOptions) (result *v1alpha2.TrafficSplit, err error) { - result = &v1alpha2.TrafficSplit{} - err = c.client.Post(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficSplit). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a trafficSplit and updates it. Returns the server's representation of the trafficSplit, and an error, if there is any. -func (c *trafficSplits) Update(ctx context.Context, trafficSplit *v1alpha2.TrafficSplit, opts v1.UpdateOptions) (result *v1alpha2.TrafficSplit, err error) { - result = &v1alpha2.TrafficSplit{} - err = c.client.Put(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(trafficSplit.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficSplit). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the trafficSplit and deletes it. Returns an error if one occurs. -func (c *trafficSplits) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *trafficSplits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched trafficSplit. -func (c *trafficSplits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TrafficSplit, err error) { - result = &v1alpha2.TrafficSplit{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/smi/v1alpha3/fake/fake_trafficsplit.go b/pkg/client/clientset/versioned/typed/smi/v1alpha3/fake/fake_trafficsplit.go index 746842dce..fc2d1f7bf 100644 --- a/pkg/client/clientset/versioned/typed/smi/v1alpha3/fake/fake_trafficsplit.go +++ b/pkg/client/clientset/versioned/typed/smi/v1alpha3/fake/fake_trafficsplit.go @@ -41,22 +41,24 @@ var trafficsplitsKind = v1alpha3.SchemeGroupVersion.WithKind("TrafficSplit") // Get takes name of the trafficSplit, and returns the corresponding trafficSplit object, and an error if there is any. func (c *FakeTrafficSplits) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha3.TrafficSplit, err error) { + emptyResult := &v1alpha3.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewGetAction(trafficsplitsResource, c.ns, name), &v1alpha3.TrafficSplit{}) + Invokes(testing.NewGetActionWithOptions(trafficsplitsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.TrafficSplit), err } // List takes label and field selectors, and returns the list of TrafficSplits that match those selectors. func (c *FakeTrafficSplits) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha3.TrafficSplitList, err error) { + emptyResult := &v1alpha3.TrafficSplitList{} obj, err := c.Fake. - Invokes(testing.NewListAction(trafficsplitsResource, trafficsplitsKind, c.ns, opts), &v1alpha3.TrafficSplitList{}) + Invokes(testing.NewListActionWithOptions(trafficsplitsResource, trafficsplitsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeTrafficSplits) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested trafficSplits. func (c *FakeTrafficSplits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(trafficsplitsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(trafficsplitsResource, c.ns, opts)) } // Create takes the representation of a trafficSplit and creates it. Returns the server's representation of the trafficSplit, and an error, if there is any. func (c *FakeTrafficSplits) Create(ctx context.Context, trafficSplit *v1alpha3.TrafficSplit, opts v1.CreateOptions) (result *v1alpha3.TrafficSplit, err error) { + emptyResult := &v1alpha3.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(trafficsplitsResource, c.ns, trafficSplit), &v1alpha3.TrafficSplit{}) + Invokes(testing.NewCreateActionWithOptions(trafficsplitsResource, c.ns, trafficSplit, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.TrafficSplit), err } // Update takes the representation of a trafficSplit and updates it. Returns the server's representation of the trafficSplit, and an error, if there is any. func (c *FakeTrafficSplits) Update(ctx context.Context, trafficSplit *v1alpha3.TrafficSplit, opts v1.UpdateOptions) (result *v1alpha3.TrafficSplit, err error) { + emptyResult := &v1alpha3.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(trafficsplitsResource, c.ns, trafficSplit), &v1alpha3.TrafficSplit{}) + Invokes(testing.NewUpdateActionWithOptions(trafficsplitsResource, c.ns, trafficSplit, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.TrafficSplit), err } @@ -111,7 +115,7 @@ func (c *FakeTrafficSplits) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTrafficSplits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(trafficsplitsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(trafficsplitsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha3.TrafficSplitList{}) return err @@ -119,11 +123,12 @@ func (c *FakeTrafficSplits) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched trafficSplit. func (c *FakeTrafficSplits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha3.TrafficSplit, err error) { + emptyResult := &v1alpha3.TrafficSplit{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(trafficsplitsResource, c.ns, name, pt, data, subresources...), &v1alpha3.TrafficSplit{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(trafficsplitsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.TrafficSplit), err } diff --git a/pkg/client/clientset/versioned/typed/smi/v1alpha3/trafficsplit.go b/pkg/client/clientset/versioned/typed/smi/v1alpha3/trafficsplit.go index 73bb996b7..e3b2bd2d8 100644 --- a/pkg/client/clientset/versioned/typed/smi/v1alpha3/trafficsplit.go +++ b/pkg/client/clientset/versioned/typed/smi/v1alpha3/trafficsplit.go @@ -20,14 +20,13 @@ package v1alpha3 import ( "context" - "time" v1alpha3 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha3" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TrafficSplitsGetter has a method to return a TrafficSplitInterface. @@ -51,128 +50,18 @@ type TrafficSplitInterface interface { // trafficSplits implements TrafficSplitInterface type trafficSplits struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha3.TrafficSplit, *v1alpha3.TrafficSplitList] } // newTrafficSplits returns a TrafficSplits func newTrafficSplits(c *SplitV1alpha3Client, namespace string) *trafficSplits { return &trafficSplits{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha3.TrafficSplit, *v1alpha3.TrafficSplitList]( + "trafficsplits", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha3.TrafficSplit { return &v1alpha3.TrafficSplit{} }, + func() *v1alpha3.TrafficSplitList { return &v1alpha3.TrafficSplitList{} }), } } - -// Get takes name of the trafficSplit, and returns the corresponding trafficSplit object, and an error if there is any. -func (c *trafficSplits) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha3.TrafficSplit, err error) { - result = &v1alpha3.TrafficSplit{} - err = c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TrafficSplits that match those selectors. -func (c *trafficSplits) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha3.TrafficSplitList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha3.TrafficSplitList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested trafficSplits. -func (c *trafficSplits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a trafficSplit and creates it. Returns the server's representation of the trafficSplit, and an error, if there is any. -func (c *trafficSplits) Create(ctx context.Context, trafficSplit *v1alpha3.TrafficSplit, opts v1.CreateOptions) (result *v1alpha3.TrafficSplit, err error) { - result = &v1alpha3.TrafficSplit{} - err = c.client.Post(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficSplit). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a trafficSplit and updates it. Returns the server's representation of the trafficSplit, and an error, if there is any. -func (c *trafficSplits) Update(ctx context.Context, trafficSplit *v1alpha3.TrafficSplit, opts v1.UpdateOptions) (result *v1alpha3.TrafficSplit, err error) { - result = &v1alpha3.TrafficSplit{} - err = c.client.Put(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(trafficSplit.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(trafficSplit). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the trafficSplit and deletes it. Returns an error if one occurs. -func (c *trafficSplits) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *trafficSplits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("trafficsplits"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched trafficSplit. -func (c *trafficSplits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha3.TrafficSplit, err error) { - result = &v1alpha3.TrafficSplit{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("trafficsplits"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/traefik/v1alpha1/fake/fake_traefikservice.go b/pkg/client/clientset/versioned/typed/traefik/v1alpha1/fake/fake_traefikservice.go index ee43ee2f8..2a6ca0789 100644 --- a/pkg/client/clientset/versioned/typed/traefik/v1alpha1/fake/fake_traefikservice.go +++ b/pkg/client/clientset/versioned/typed/traefik/v1alpha1/fake/fake_traefikservice.go @@ -41,22 +41,24 @@ var traefikservicesKind = v1alpha1.SchemeGroupVersion.WithKind("TraefikService") // Get takes name of the traefikService, and returns the corresponding traefikService object, and an error if there is any. func (c *FakeTraefikServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TraefikService, err error) { + emptyResult := &v1alpha1.TraefikService{} obj, err := c.Fake. - Invokes(testing.NewGetAction(traefikservicesResource, c.ns, name), &v1alpha1.TraefikService{}) + Invokes(testing.NewGetActionWithOptions(traefikservicesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TraefikService), err } // List takes label and field selectors, and returns the list of TraefikServices that match those selectors. func (c *FakeTraefikServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TraefikServiceList, err error) { + emptyResult := &v1alpha1.TraefikServiceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(traefikservicesResource, traefikservicesKind, c.ns, opts), &v1alpha1.TraefikServiceList{}) + Invokes(testing.NewListActionWithOptions(traefikservicesResource, traefikservicesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeTraefikServices) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested traefikServices. func (c *FakeTraefikServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(traefikservicesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(traefikservicesResource, c.ns, opts)) } // Create takes the representation of a traefikService and creates it. Returns the server's representation of the traefikService, and an error, if there is any. func (c *FakeTraefikServices) Create(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.CreateOptions) (result *v1alpha1.TraefikService, err error) { + emptyResult := &v1alpha1.TraefikService{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(traefikservicesResource, c.ns, traefikService), &v1alpha1.TraefikService{}) + Invokes(testing.NewCreateActionWithOptions(traefikservicesResource, c.ns, traefikService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TraefikService), err } // Update takes the representation of a traefikService and updates it. Returns the server's representation of the traefikService, and an error, if there is any. func (c *FakeTraefikServices) Update(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.UpdateOptions) (result *v1alpha1.TraefikService, err error) { + emptyResult := &v1alpha1.TraefikService{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(traefikservicesResource, c.ns, traefikService), &v1alpha1.TraefikService{}) + Invokes(testing.NewUpdateActionWithOptions(traefikservicesResource, c.ns, traefikService, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TraefikService), err } @@ -111,7 +115,7 @@ func (c *FakeTraefikServices) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeTraefikServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(traefikservicesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(traefikservicesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.TraefikServiceList{}) return err @@ -119,11 +123,12 @@ func (c *FakeTraefikServices) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched traefikService. func (c *FakeTraefikServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TraefikService, err error) { + emptyResult := &v1alpha1.TraefikService{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(traefikservicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.TraefikService{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(traefikservicesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TraefikService), err } diff --git a/pkg/client/clientset/versioned/typed/traefik/v1alpha1/traefikservice.go b/pkg/client/clientset/versioned/typed/traefik/v1alpha1/traefikservice.go index 3d1ce4727..f65979917 100644 --- a/pkg/client/clientset/versioned/typed/traefik/v1alpha1/traefikservice.go +++ b/pkg/client/clientset/versioned/typed/traefik/v1alpha1/traefikservice.go @@ -20,14 +20,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/fluxcd/flagger/pkg/apis/traefik/v1alpha1" scheme "github.com/fluxcd/flagger/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TraefikServicesGetter has a method to return a TraefikServiceInterface. @@ -51,128 +50,18 @@ type TraefikServiceInterface interface { // traefikServices implements TraefikServiceInterface type traefikServices struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.TraefikService, *v1alpha1.TraefikServiceList] } // newTraefikServices returns a TraefikServices func newTraefikServices(c *TraefikV1alpha1Client, namespace string) *traefikServices { return &traefikServices{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.TraefikService, *v1alpha1.TraefikServiceList]( + "traefikservices", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.TraefikService { return &v1alpha1.TraefikService{} }, + func() *v1alpha1.TraefikServiceList { return &v1alpha1.TraefikServiceList{} }), } } - -// Get takes name of the traefikService, and returns the corresponding traefikService object, and an error if there is any. -func (c *traefikServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("traefikservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TraefikServices that match those selectors. -func (c *traefikServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TraefikServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TraefikServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested traefikServices. -func (c *traefikServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a traefikService and creates it. Returns the server's representation of the traefikService, and an error, if there is any. -func (c *traefikServices) Create(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.CreateOptions) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traefikService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a traefikService and updates it. Returns the server's representation of the traefikService, and an error, if there is any. -func (c *traefikServices) Update(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.UpdateOptions) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("traefikservices"). - Name(traefikService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traefikService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the traefikService and deletes it. Returns an error if one occurs. -func (c *traefikServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("traefikservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *traefikServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched traefikService. -func (c *traefikServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("traefikservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 014bac86e..bce8238e4 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -239,6 +239,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/pkg/client/listers/apisix/v2/apisixroute.go b/pkg/client/listers/apisix/v2/apisixroute.go index a3e6183fd..7a1477afe 100644 --- a/pkg/client/listers/apisix/v2/apisixroute.go +++ b/pkg/client/listers/apisix/v2/apisixroute.go @@ -20,8 +20,8 @@ package v2 import ( v2 "github.com/fluxcd/flagger/pkg/apis/apisix/v2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type ApisixRouteLister interface { // apisixRouteLister implements the ApisixRouteLister interface. type apisixRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v2.ApisixRoute] } // NewApisixRouteLister returns a new ApisixRouteLister. func NewApisixRouteLister(indexer cache.Indexer) ApisixRouteLister { - return &apisixRouteLister{indexer: indexer} -} - -// List lists all ApisixRoutes in the indexer. -func (s *apisixRouteLister) List(selector labels.Selector) (ret []*v2.ApisixRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.ApisixRoute)) - }) - return ret, err + return &apisixRouteLister{listers.New[*v2.ApisixRoute](indexer, v2.Resource("apisixroute"))} } // ApisixRoutes returns an object that can list and get ApisixRoutes. func (s *apisixRouteLister) ApisixRoutes(namespace string) ApisixRouteNamespaceLister { - return apisixRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return apisixRouteNamespaceLister{listers.NewNamespaced[*v2.ApisixRoute](s.ResourceIndexer, namespace)} } // ApisixRouteNamespaceLister helps list and get ApisixRoutes. @@ -74,26 +66,5 @@ type ApisixRouteNamespaceLister interface { // apisixRouteNamespaceLister implements the ApisixRouteNamespaceLister // interface. type apisixRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ApisixRoutes in the indexer for a given namespace. -func (s apisixRouteNamespaceLister) List(selector labels.Selector) (ret []*v2.ApisixRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v2.ApisixRoute)) - }) - return ret, err -} - -// Get retrieves the ApisixRoute from the indexer for a given namespace and name. -func (s apisixRouteNamespaceLister) Get(name string) (*v2.ApisixRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2.Resource("apisixroute"), name) - } - return obj.(*v2.ApisixRoute), nil + listers.ResourceIndexer[*v2.ApisixRoute] } diff --git a/pkg/client/listers/appmesh/v1beta1/mesh.go b/pkg/client/listers/appmesh/v1beta1/mesh.go index c47db8799..ab868deb1 100644 --- a/pkg/client/listers/appmesh/v1beta1/mesh.go +++ b/pkg/client/listers/appmesh/v1beta1/mesh.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -39,30 +39,10 @@ type MeshLister interface { // meshLister implements the MeshLister interface. type meshLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Mesh] } // NewMeshLister returns a new MeshLister. func NewMeshLister(indexer cache.Indexer) MeshLister { - return &meshLister{indexer: indexer} -} - -// List lists all Meshes in the indexer. -func (s *meshLister) List(selector labels.Selector) (ret []*v1beta1.Mesh, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Mesh)) - }) - return ret, err -} - -// Get retrieves the Mesh from the index for a given name. -func (s *meshLister) Get(name string) (*v1beta1.Mesh, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("mesh"), name) - } - return obj.(*v1beta1.Mesh), nil + return &meshLister{listers.New[*v1beta1.Mesh](indexer, v1beta1.Resource("mesh"))} } diff --git a/pkg/client/listers/appmesh/v1beta1/virtualnode.go b/pkg/client/listers/appmesh/v1beta1/virtualnode.go index 863e903e0..dde9413f9 100644 --- a/pkg/client/listers/appmesh/v1beta1/virtualnode.go +++ b/pkg/client/listers/appmesh/v1beta1/virtualnode.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type VirtualNodeLister interface { // virtualNodeLister implements the VirtualNodeLister interface. type virtualNodeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.VirtualNode] } // NewVirtualNodeLister returns a new VirtualNodeLister. func NewVirtualNodeLister(indexer cache.Indexer) VirtualNodeLister { - return &virtualNodeLister{indexer: indexer} -} - -// List lists all VirtualNodes in the indexer. -func (s *virtualNodeLister) List(selector labels.Selector) (ret []*v1beta1.VirtualNode, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VirtualNode)) - }) - return ret, err + return &virtualNodeLister{listers.New[*v1beta1.VirtualNode](indexer, v1beta1.Resource("virtualnode"))} } // VirtualNodes returns an object that can list and get VirtualNodes. func (s *virtualNodeLister) VirtualNodes(namespace string) VirtualNodeNamespaceLister { - return virtualNodeNamespaceLister{indexer: s.indexer, namespace: namespace} + return virtualNodeNamespaceLister{listers.NewNamespaced[*v1beta1.VirtualNode](s.ResourceIndexer, namespace)} } // VirtualNodeNamespaceLister helps list and get VirtualNodes. @@ -74,26 +66,5 @@ type VirtualNodeNamespaceLister interface { // virtualNodeNamespaceLister implements the VirtualNodeNamespaceLister // interface. type virtualNodeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualNodes in the indexer for a given namespace. -func (s virtualNodeNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualNode, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VirtualNode)) - }) - return ret, err -} - -// Get retrieves the VirtualNode from the indexer for a given namespace and name. -func (s virtualNodeNamespaceLister) Get(name string) (*v1beta1.VirtualNode, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("virtualnode"), name) - } - return obj.(*v1beta1.VirtualNode), nil + listers.ResourceIndexer[*v1beta1.VirtualNode] } diff --git a/pkg/client/listers/appmesh/v1beta1/virtualservice.go b/pkg/client/listers/appmesh/v1beta1/virtualservice.go index af2cfcaa3..d6a2e0ee3 100644 --- a/pkg/client/listers/appmesh/v1beta1/virtualservice.go +++ b/pkg/client/listers/appmesh/v1beta1/virtualservice.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type VirtualServiceLister interface { // virtualServiceLister implements the VirtualServiceLister interface. type virtualServiceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.VirtualService] } // NewVirtualServiceLister returns a new VirtualServiceLister. func NewVirtualServiceLister(indexer cache.Indexer) VirtualServiceLister { - return &virtualServiceLister{indexer: indexer} -} - -// List lists all VirtualServices in the indexer. -func (s *virtualServiceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VirtualService)) - }) - return ret, err + return &virtualServiceLister{listers.New[*v1beta1.VirtualService](indexer, v1beta1.Resource("virtualservice"))} } // VirtualServices returns an object that can list and get VirtualServices. func (s *virtualServiceLister) VirtualServices(namespace string) VirtualServiceNamespaceLister { - return virtualServiceNamespaceLister{indexer: s.indexer, namespace: namespace} + return virtualServiceNamespaceLister{listers.NewNamespaced[*v1beta1.VirtualService](s.ResourceIndexer, namespace)} } // VirtualServiceNamespaceLister helps list and get VirtualServices. @@ -74,26 +66,5 @@ type VirtualServiceNamespaceLister interface { // virtualServiceNamespaceLister implements the VirtualServiceNamespaceLister // interface. type virtualServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualServices in the indexer for a given namespace. -func (s virtualServiceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VirtualService)) - }) - return ret, err -} - -// Get retrieves the VirtualService from the indexer for a given namespace and name. -func (s virtualServiceNamespaceLister) Get(name string) (*v1beta1.VirtualService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("virtualservice"), name) - } - return obj.(*v1beta1.VirtualService), nil + listers.ResourceIndexer[*v1beta1.VirtualService] } diff --git a/pkg/client/listers/appmesh/v1beta2/virtualnode.go b/pkg/client/listers/appmesh/v1beta2/virtualnode.go index 7e933af26..dcaa2cda8 100644 --- a/pkg/client/listers/appmesh/v1beta2/virtualnode.go +++ b/pkg/client/listers/appmesh/v1beta2/virtualnode.go @@ -20,8 +20,8 @@ package v1beta2 import ( v1beta2 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type VirtualNodeLister interface { // virtualNodeLister implements the VirtualNodeLister interface. type virtualNodeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta2.VirtualNode] } // NewVirtualNodeLister returns a new VirtualNodeLister. func NewVirtualNodeLister(indexer cache.Indexer) VirtualNodeLister { - return &virtualNodeLister{indexer: indexer} -} - -// List lists all VirtualNodes in the indexer. -func (s *virtualNodeLister) List(selector labels.Selector) (ret []*v1beta2.VirtualNode, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.VirtualNode)) - }) - return ret, err + return &virtualNodeLister{listers.New[*v1beta2.VirtualNode](indexer, v1beta2.Resource("virtualnode"))} } // VirtualNodes returns an object that can list and get VirtualNodes. func (s *virtualNodeLister) VirtualNodes(namespace string) VirtualNodeNamespaceLister { - return virtualNodeNamespaceLister{indexer: s.indexer, namespace: namespace} + return virtualNodeNamespaceLister{listers.NewNamespaced[*v1beta2.VirtualNode](s.ResourceIndexer, namespace)} } // VirtualNodeNamespaceLister helps list and get VirtualNodes. @@ -74,26 +66,5 @@ type VirtualNodeNamespaceLister interface { // virtualNodeNamespaceLister implements the VirtualNodeNamespaceLister // interface. type virtualNodeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualNodes in the indexer for a given namespace. -func (s virtualNodeNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.VirtualNode, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.VirtualNode)) - }) - return ret, err -} - -// Get retrieves the VirtualNode from the indexer for a given namespace and name. -func (s virtualNodeNamespaceLister) Get(name string) (*v1beta2.VirtualNode, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("virtualnode"), name) - } - return obj.(*v1beta2.VirtualNode), nil + listers.ResourceIndexer[*v1beta2.VirtualNode] } diff --git a/pkg/client/listers/appmesh/v1beta2/virtualrouter.go b/pkg/client/listers/appmesh/v1beta2/virtualrouter.go index f54e5a578..cc370e672 100644 --- a/pkg/client/listers/appmesh/v1beta2/virtualrouter.go +++ b/pkg/client/listers/appmesh/v1beta2/virtualrouter.go @@ -20,8 +20,8 @@ package v1beta2 import ( v1beta2 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type VirtualRouterLister interface { // virtualRouterLister implements the VirtualRouterLister interface. type virtualRouterLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta2.VirtualRouter] } // NewVirtualRouterLister returns a new VirtualRouterLister. func NewVirtualRouterLister(indexer cache.Indexer) VirtualRouterLister { - return &virtualRouterLister{indexer: indexer} -} - -// List lists all VirtualRouters in the indexer. -func (s *virtualRouterLister) List(selector labels.Selector) (ret []*v1beta2.VirtualRouter, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.VirtualRouter)) - }) - return ret, err + return &virtualRouterLister{listers.New[*v1beta2.VirtualRouter](indexer, v1beta2.Resource("virtualrouter"))} } // VirtualRouters returns an object that can list and get VirtualRouters. func (s *virtualRouterLister) VirtualRouters(namespace string) VirtualRouterNamespaceLister { - return virtualRouterNamespaceLister{indexer: s.indexer, namespace: namespace} + return virtualRouterNamespaceLister{listers.NewNamespaced[*v1beta2.VirtualRouter](s.ResourceIndexer, namespace)} } // VirtualRouterNamespaceLister helps list and get VirtualRouters. @@ -74,26 +66,5 @@ type VirtualRouterNamespaceLister interface { // virtualRouterNamespaceLister implements the VirtualRouterNamespaceLister // interface. type virtualRouterNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualRouters in the indexer for a given namespace. -func (s virtualRouterNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.VirtualRouter, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.VirtualRouter)) - }) - return ret, err -} - -// Get retrieves the VirtualRouter from the indexer for a given namespace and name. -func (s virtualRouterNamespaceLister) Get(name string) (*v1beta2.VirtualRouter, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("virtualrouter"), name) - } - return obj.(*v1beta2.VirtualRouter), nil + listers.ResourceIndexer[*v1beta2.VirtualRouter] } diff --git a/pkg/client/listers/appmesh/v1beta2/virtualservice.go b/pkg/client/listers/appmesh/v1beta2/virtualservice.go index 1ba3177fc..11fa77a42 100644 --- a/pkg/client/listers/appmesh/v1beta2/virtualservice.go +++ b/pkg/client/listers/appmesh/v1beta2/virtualservice.go @@ -20,8 +20,8 @@ package v1beta2 import ( v1beta2 "github.com/fluxcd/flagger/pkg/apis/appmesh/v1beta2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type VirtualServiceLister interface { // virtualServiceLister implements the VirtualServiceLister interface. type virtualServiceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta2.VirtualService] } // NewVirtualServiceLister returns a new VirtualServiceLister. func NewVirtualServiceLister(indexer cache.Indexer) VirtualServiceLister { - return &virtualServiceLister{indexer: indexer} -} - -// List lists all VirtualServices in the indexer. -func (s *virtualServiceLister) List(selector labels.Selector) (ret []*v1beta2.VirtualService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.VirtualService)) - }) - return ret, err + return &virtualServiceLister{listers.New[*v1beta2.VirtualService](indexer, v1beta2.Resource("virtualservice"))} } // VirtualServices returns an object that can list and get VirtualServices. func (s *virtualServiceLister) VirtualServices(namespace string) VirtualServiceNamespaceLister { - return virtualServiceNamespaceLister{indexer: s.indexer, namespace: namespace} + return virtualServiceNamespaceLister{listers.NewNamespaced[*v1beta2.VirtualService](s.ResourceIndexer, namespace)} } // VirtualServiceNamespaceLister helps list and get VirtualServices. @@ -74,26 +66,5 @@ type VirtualServiceNamespaceLister interface { // virtualServiceNamespaceLister implements the VirtualServiceNamespaceLister // interface. type virtualServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualServices in the indexer for a given namespace. -func (s virtualServiceNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.VirtualService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.VirtualService)) - }) - return ret, err -} - -// Get retrieves the VirtualService from the indexer for a given namespace and name. -func (s virtualServiceNamespaceLister) Get(name string) (*v1beta2.VirtualService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("virtualservice"), name) - } - return obj.(*v1beta2.VirtualService), nil + listers.ResourceIndexer[*v1beta2.VirtualService] } diff --git a/pkg/client/listers/flagger/v1beta1/alertprovider.go b/pkg/client/listers/flagger/v1beta1/alertprovider.go index c0c629a01..3074041d9 100644 --- a/pkg/client/listers/flagger/v1beta1/alertprovider.go +++ b/pkg/client/listers/flagger/v1beta1/alertprovider.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type AlertProviderLister interface { // alertProviderLister implements the AlertProviderLister interface. type alertProviderLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.AlertProvider] } // NewAlertProviderLister returns a new AlertProviderLister. func NewAlertProviderLister(indexer cache.Indexer) AlertProviderLister { - return &alertProviderLister{indexer: indexer} -} - -// List lists all AlertProviders in the indexer. -func (s *alertProviderLister) List(selector labels.Selector) (ret []*v1beta1.AlertProvider, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.AlertProvider)) - }) - return ret, err + return &alertProviderLister{listers.New[*v1beta1.AlertProvider](indexer, v1beta1.Resource("alertprovider"))} } // AlertProviders returns an object that can list and get AlertProviders. func (s *alertProviderLister) AlertProviders(namespace string) AlertProviderNamespaceLister { - return alertProviderNamespaceLister{indexer: s.indexer, namespace: namespace} + return alertProviderNamespaceLister{listers.NewNamespaced[*v1beta1.AlertProvider](s.ResourceIndexer, namespace)} } // AlertProviderNamespaceLister helps list and get AlertProviders. @@ -74,26 +66,5 @@ type AlertProviderNamespaceLister interface { // alertProviderNamespaceLister implements the AlertProviderNamespaceLister // interface. type alertProviderNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all AlertProviders in the indexer for a given namespace. -func (s alertProviderNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.AlertProvider, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.AlertProvider)) - }) - return ret, err -} - -// Get retrieves the AlertProvider from the indexer for a given namespace and name. -func (s alertProviderNamespaceLister) Get(name string) (*v1beta1.AlertProvider, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("alertprovider"), name) - } - return obj.(*v1beta1.AlertProvider), nil + listers.ResourceIndexer[*v1beta1.AlertProvider] } diff --git a/pkg/client/listers/flagger/v1beta1/canary.go b/pkg/client/listers/flagger/v1beta1/canary.go index 2631dba80..dbf864a20 100644 --- a/pkg/client/listers/flagger/v1beta1/canary.go +++ b/pkg/client/listers/flagger/v1beta1/canary.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type CanaryLister interface { // canaryLister implements the CanaryLister interface. type canaryLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Canary] } // NewCanaryLister returns a new CanaryLister. func NewCanaryLister(indexer cache.Indexer) CanaryLister { - return &canaryLister{indexer: indexer} -} - -// List lists all Canaries in the indexer. -func (s *canaryLister) List(selector labels.Selector) (ret []*v1beta1.Canary, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Canary)) - }) - return ret, err + return &canaryLister{listers.New[*v1beta1.Canary](indexer, v1beta1.Resource("canary"))} } // Canaries returns an object that can list and get Canaries. func (s *canaryLister) Canaries(namespace string) CanaryNamespaceLister { - return canaryNamespaceLister{indexer: s.indexer, namespace: namespace} + return canaryNamespaceLister{listers.NewNamespaced[*v1beta1.Canary](s.ResourceIndexer, namespace)} } // CanaryNamespaceLister helps list and get Canaries. @@ -74,26 +66,5 @@ type CanaryNamespaceLister interface { // canaryNamespaceLister implements the CanaryNamespaceLister // interface. type canaryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Canaries in the indexer for a given namespace. -func (s canaryNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Canary, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Canary)) - }) - return ret, err -} - -// Get retrieves the Canary from the indexer for a given namespace and name. -func (s canaryNamespaceLister) Get(name string) (*v1beta1.Canary, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("canary"), name) - } - return obj.(*v1beta1.Canary), nil + listers.ResourceIndexer[*v1beta1.Canary] } diff --git a/pkg/client/listers/flagger/v1beta1/metrictemplate.go b/pkg/client/listers/flagger/v1beta1/metrictemplate.go index d8ac6074f..aca8ae8f6 100644 --- a/pkg/client/listers/flagger/v1beta1/metrictemplate.go +++ b/pkg/client/listers/flagger/v1beta1/metrictemplate.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type MetricTemplateLister interface { // metricTemplateLister implements the MetricTemplateLister interface. type metricTemplateLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.MetricTemplate] } // NewMetricTemplateLister returns a new MetricTemplateLister. func NewMetricTemplateLister(indexer cache.Indexer) MetricTemplateLister { - return &metricTemplateLister{indexer: indexer} -} - -// List lists all MetricTemplates in the indexer. -func (s *metricTemplateLister) List(selector labels.Selector) (ret []*v1beta1.MetricTemplate, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.MetricTemplate)) - }) - return ret, err + return &metricTemplateLister{listers.New[*v1beta1.MetricTemplate](indexer, v1beta1.Resource("metrictemplate"))} } // MetricTemplates returns an object that can list and get MetricTemplates. func (s *metricTemplateLister) MetricTemplates(namespace string) MetricTemplateNamespaceLister { - return metricTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} + return metricTemplateNamespaceLister{listers.NewNamespaced[*v1beta1.MetricTemplate](s.ResourceIndexer, namespace)} } // MetricTemplateNamespaceLister helps list and get MetricTemplates. @@ -74,26 +66,5 @@ type MetricTemplateNamespaceLister interface { // metricTemplateNamespaceLister implements the MetricTemplateNamespaceLister // interface. type metricTemplateNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all MetricTemplates in the indexer for a given namespace. -func (s metricTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.MetricTemplate, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.MetricTemplate)) - }) - return ret, err -} - -// Get retrieves the MetricTemplate from the indexer for a given namespace and name. -func (s metricTemplateNamespaceLister) Get(name string) (*v1beta1.MetricTemplate, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("metrictemplate"), name) - } - return obj.(*v1beta1.MetricTemplate), nil + listers.ResourceIndexer[*v1beta1.MetricTemplate] } diff --git a/pkg/client/listers/gatewayapi/v1/httproute.go b/pkg/client/listers/gatewayapi/v1/httproute.go index ed4c0517f..6759088ea 100644 --- a/pkg/client/listers/gatewayapi/v1/httproute.go +++ b/pkg/client/listers/gatewayapi/v1/httproute.go @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type HTTPRouteLister interface { // hTTPRouteLister implements the HTTPRouteLister interface. type hTTPRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.HTTPRoute] } // NewHTTPRouteLister returns a new HTTPRouteLister. func NewHTTPRouteLister(indexer cache.Indexer) HTTPRouteLister { - return &hTTPRouteLister{indexer: indexer} -} - -// List lists all HTTPRoutes in the indexer. -func (s *hTTPRouteLister) List(selector labels.Selector) (ret []*v1.HTTPRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.HTTPRoute)) - }) - return ret, err + return &hTTPRouteLister{listers.New[*v1.HTTPRoute](indexer, v1.Resource("httproute"))} } // HTTPRoutes returns an object that can list and get HTTPRoutes. func (s *hTTPRouteLister) HTTPRoutes(namespace string) HTTPRouteNamespaceLister { - return hTTPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPRouteNamespaceLister{listers.NewNamespaced[*v1.HTTPRoute](s.ResourceIndexer, namespace)} } // HTTPRouteNamespaceLister helps list and get HTTPRoutes. @@ -74,26 +66,5 @@ type HTTPRouteNamespaceLister interface { // hTTPRouteNamespaceLister implements the HTTPRouteNamespaceLister // interface. type hTTPRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all HTTPRoutes in the indexer for a given namespace. -func (s hTTPRouteNamespaceLister) List(selector labels.Selector) (ret []*v1.HTTPRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.HTTPRoute)) - }) - return ret, err -} - -// Get retrieves the HTTPRoute from the indexer for a given namespace and name. -func (s hTTPRouteNamespaceLister) Get(name string) (*v1.HTTPRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("httproute"), name) - } - return obj.(*v1.HTTPRoute), nil + listers.ResourceIndexer[*v1.HTTPRoute] } diff --git a/pkg/client/listers/gatewayapi/v1beta1/httproute.go b/pkg/client/listers/gatewayapi/v1beta1/httproute.go index 1f7c9ad4f..a89965a84 100644 --- a/pkg/client/listers/gatewayapi/v1beta1/httproute.go +++ b/pkg/client/listers/gatewayapi/v1beta1/httproute.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type HTTPRouteLister interface { // hTTPRouteLister implements the HTTPRouteLister interface. type hTTPRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.HTTPRoute] } // NewHTTPRouteLister returns a new HTTPRouteLister. func NewHTTPRouteLister(indexer cache.Indexer) HTTPRouteLister { - return &hTTPRouteLister{indexer: indexer} -} - -// List lists all HTTPRoutes in the indexer. -func (s *hTTPRouteLister) List(selector labels.Selector) (ret []*v1beta1.HTTPRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.HTTPRoute)) - }) - return ret, err + return &hTTPRouteLister{listers.New[*v1beta1.HTTPRoute](indexer, v1beta1.Resource("httproute"))} } // HTTPRoutes returns an object that can list and get HTTPRoutes. func (s *hTTPRouteLister) HTTPRoutes(namespace string) HTTPRouteNamespaceLister { - return hTTPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPRouteNamespaceLister{listers.NewNamespaced[*v1beta1.HTTPRoute](s.ResourceIndexer, namespace)} } // HTTPRouteNamespaceLister helps list and get HTTPRoutes. @@ -74,26 +66,5 @@ type HTTPRouteNamespaceLister interface { // hTTPRouteNamespaceLister implements the HTTPRouteNamespaceLister // interface. type hTTPRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all HTTPRoutes in the indexer for a given namespace. -func (s hTTPRouteNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.HTTPRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.HTTPRoute)) - }) - return ret, err -} - -// Get retrieves the HTTPRoute from the indexer for a given namespace and name. -func (s hTTPRouteNamespaceLister) Get(name string) (*v1beta1.HTTPRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("httproute"), name) - } - return obj.(*v1beta1.HTTPRoute), nil + listers.ResourceIndexer[*v1beta1.HTTPRoute] } diff --git a/pkg/client/listers/gloo/v1/upstream.go b/pkg/client/listers/gloo/v1/upstream.go index 0f7af0c20..e9cbc0d5c 100644 --- a/pkg/client/listers/gloo/v1/upstream.go +++ b/pkg/client/listers/gloo/v1/upstream.go @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/fluxcd/flagger/pkg/apis/gloo/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type UpstreamLister interface { // upstreamLister implements the UpstreamLister interface. type upstreamLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.Upstream] } // NewUpstreamLister returns a new UpstreamLister. func NewUpstreamLister(indexer cache.Indexer) UpstreamLister { - return &upstreamLister{indexer: indexer} -} - -// List lists all Upstreams in the indexer. -func (s *upstreamLister) List(selector labels.Selector) (ret []*v1.Upstream, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Upstream)) - }) - return ret, err + return &upstreamLister{listers.New[*v1.Upstream](indexer, v1.Resource("upstream"))} } // Upstreams returns an object that can list and get Upstreams. func (s *upstreamLister) Upstreams(namespace string) UpstreamNamespaceLister { - return upstreamNamespaceLister{indexer: s.indexer, namespace: namespace} + return upstreamNamespaceLister{listers.NewNamespaced[*v1.Upstream](s.ResourceIndexer, namespace)} } // UpstreamNamespaceLister helps list and get Upstreams. @@ -74,26 +66,5 @@ type UpstreamNamespaceLister interface { // upstreamNamespaceLister implements the UpstreamNamespaceLister // interface. type upstreamNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Upstreams in the indexer for a given namespace. -func (s upstreamNamespaceLister) List(selector labels.Selector) (ret []*v1.Upstream, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Upstream)) - }) - return ret, err -} - -// Get retrieves the Upstream from the indexer for a given namespace and name. -func (s upstreamNamespaceLister) Get(name string) (*v1.Upstream, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("upstream"), name) - } - return obj.(*v1.Upstream), nil + listers.ResourceIndexer[*v1.Upstream] } diff --git a/pkg/client/listers/gloogateway/v1/routetable.go b/pkg/client/listers/gloogateway/v1/routetable.go index 3298a6b13..a393f7c2f 100644 --- a/pkg/client/listers/gloogateway/v1/routetable.go +++ b/pkg/client/listers/gloogateway/v1/routetable.go @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/fluxcd/flagger/pkg/apis/gloogateway/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type RouteTableLister interface { // routeTableLister implements the RouteTableLister interface. type routeTableLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.RouteTable] } // NewRouteTableLister returns a new RouteTableLister. func NewRouteTableLister(indexer cache.Indexer) RouteTableLister { - return &routeTableLister{indexer: indexer} -} - -// List lists all RouteTables in the indexer. -func (s *routeTableLister) List(selector labels.Selector) (ret []*v1.RouteTable, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.RouteTable)) - }) - return ret, err + return &routeTableLister{listers.New[*v1.RouteTable](indexer, v1.Resource("routetable"))} } // RouteTables returns an object that can list and get RouteTables. func (s *routeTableLister) RouteTables(namespace string) RouteTableNamespaceLister { - return routeTableNamespaceLister{indexer: s.indexer, namespace: namespace} + return routeTableNamespaceLister{listers.NewNamespaced[*v1.RouteTable](s.ResourceIndexer, namespace)} } // RouteTableNamespaceLister helps list and get RouteTables. @@ -74,26 +66,5 @@ type RouteTableNamespaceLister interface { // routeTableNamespaceLister implements the RouteTableNamespaceLister // interface. type routeTableNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all RouteTables in the indexer for a given namespace. -func (s routeTableNamespaceLister) List(selector labels.Selector) (ret []*v1.RouteTable, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.RouteTable)) - }) - return ret, err -} - -// Get retrieves the RouteTable from the indexer for a given namespace and name. -func (s routeTableNamespaceLister) Get(name string) (*v1.RouteTable, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("routetable"), name) - } - return obj.(*v1.RouteTable), nil + listers.ResourceIndexer[*v1.RouteTable] } diff --git a/pkg/client/listers/istio/v1beta1/destinationrule.go b/pkg/client/listers/istio/v1beta1/destinationrule.go index 65c097122..a2f5ced44 100644 --- a/pkg/client/listers/istio/v1beta1/destinationrule.go +++ b/pkg/client/listers/istio/v1beta1/destinationrule.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type DestinationRuleLister interface { // destinationRuleLister implements the DestinationRuleLister interface. type destinationRuleLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.DestinationRule] } // NewDestinationRuleLister returns a new DestinationRuleLister. func NewDestinationRuleLister(indexer cache.Indexer) DestinationRuleLister { - return &destinationRuleLister{indexer: indexer} -} - -// List lists all DestinationRules in the indexer. -func (s *destinationRuleLister) List(selector labels.Selector) (ret []*v1beta1.DestinationRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.DestinationRule)) - }) - return ret, err + return &destinationRuleLister{listers.New[*v1beta1.DestinationRule](indexer, v1beta1.Resource("destinationrule"))} } // DestinationRules returns an object that can list and get DestinationRules. func (s *destinationRuleLister) DestinationRules(namespace string) DestinationRuleNamespaceLister { - return destinationRuleNamespaceLister{indexer: s.indexer, namespace: namespace} + return destinationRuleNamespaceLister{listers.NewNamespaced[*v1beta1.DestinationRule](s.ResourceIndexer, namespace)} } // DestinationRuleNamespaceLister helps list and get DestinationRules. @@ -74,26 +66,5 @@ type DestinationRuleNamespaceLister interface { // destinationRuleNamespaceLister implements the DestinationRuleNamespaceLister // interface. type destinationRuleNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all DestinationRules in the indexer for a given namespace. -func (s destinationRuleNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.DestinationRule, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.DestinationRule)) - }) - return ret, err -} - -// Get retrieves the DestinationRule from the indexer for a given namespace and name. -func (s destinationRuleNamespaceLister) Get(name string) (*v1beta1.DestinationRule, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("destinationrule"), name) - } - return obj.(*v1beta1.DestinationRule), nil + listers.ResourceIndexer[*v1beta1.DestinationRule] } diff --git a/pkg/client/listers/istio/v1beta1/virtualservice.go b/pkg/client/listers/istio/v1beta1/virtualservice.go index f878648a6..bcc83b65d 100644 --- a/pkg/client/listers/istio/v1beta1/virtualservice.go +++ b/pkg/client/listers/istio/v1beta1/virtualservice.go @@ -20,8 +20,8 @@ package v1beta1 import ( v1beta1 "github.com/fluxcd/flagger/pkg/apis/istio/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type VirtualServiceLister interface { // virtualServiceLister implements the VirtualServiceLister interface. type virtualServiceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.VirtualService] } // NewVirtualServiceLister returns a new VirtualServiceLister. func NewVirtualServiceLister(indexer cache.Indexer) VirtualServiceLister { - return &virtualServiceLister{indexer: indexer} -} - -// List lists all VirtualServices in the indexer. -func (s *virtualServiceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VirtualService)) - }) - return ret, err + return &virtualServiceLister{listers.New[*v1beta1.VirtualService](indexer, v1beta1.Resource("virtualservice"))} } // VirtualServices returns an object that can list and get VirtualServices. func (s *virtualServiceLister) VirtualServices(namespace string) VirtualServiceNamespaceLister { - return virtualServiceNamespaceLister{indexer: s.indexer, namespace: namespace} + return virtualServiceNamespaceLister{listers.NewNamespaced[*v1beta1.VirtualService](s.ResourceIndexer, namespace)} } // VirtualServiceNamespaceLister helps list and get VirtualServices. @@ -74,26 +66,5 @@ type VirtualServiceNamespaceLister interface { // virtualServiceNamespaceLister implements the VirtualServiceNamespaceLister // interface. type virtualServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VirtualServices in the indexer for a given namespace. -func (s virtualServiceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VirtualService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.VirtualService)) - }) - return ret, err -} - -// Get retrieves the VirtualService from the indexer for a given namespace and name. -func (s virtualServiceNamespaceLister) Get(name string) (*v1beta1.VirtualService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("virtualservice"), name) - } - return obj.(*v1beta1.VirtualService), nil + listers.ResourceIndexer[*v1beta1.VirtualService] } diff --git a/pkg/client/listers/keda/v1alpha1/scaledobject.go b/pkg/client/listers/keda/v1alpha1/scaledobject.go index eb3752378..30933201c 100644 --- a/pkg/client/listers/keda/v1alpha1/scaledobject.go +++ b/pkg/client/listers/keda/v1alpha1/scaledobject.go @@ -20,8 +20,8 @@ package v1alpha1 import ( v1alpha1 "github.com/fluxcd/flagger/pkg/apis/keda/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type ScaledObjectLister interface { // scaledObjectLister implements the ScaledObjectLister interface. type scaledObjectLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ScaledObject] } // NewScaledObjectLister returns a new ScaledObjectLister. func NewScaledObjectLister(indexer cache.Indexer) ScaledObjectLister { - return &scaledObjectLister{indexer: indexer} -} - -// List lists all ScaledObjects in the indexer. -func (s *scaledObjectLister) List(selector labels.Selector) (ret []*v1alpha1.ScaledObject, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ScaledObject)) - }) - return ret, err + return &scaledObjectLister{listers.New[*v1alpha1.ScaledObject](indexer, v1alpha1.Resource("scaledobject"))} } // ScaledObjects returns an object that can list and get ScaledObjects. func (s *scaledObjectLister) ScaledObjects(namespace string) ScaledObjectNamespaceLister { - return scaledObjectNamespaceLister{indexer: s.indexer, namespace: namespace} + return scaledObjectNamespaceLister{listers.NewNamespaced[*v1alpha1.ScaledObject](s.ResourceIndexer, namespace)} } // ScaledObjectNamespaceLister helps list and get ScaledObjects. @@ -74,26 +66,5 @@ type ScaledObjectNamespaceLister interface { // scaledObjectNamespaceLister implements the ScaledObjectNamespaceLister // interface. type scaledObjectNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ScaledObjects in the indexer for a given namespace. -func (s scaledObjectNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ScaledObject, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ScaledObject)) - }) - return ret, err -} - -// Get retrieves the ScaledObject from the indexer for a given namespace and name. -func (s scaledObjectNamespaceLister) Get(name string) (*v1alpha1.ScaledObject, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("scaledobject"), name) - } - return obj.(*v1alpha1.ScaledObject), nil + listers.ResourceIndexer[*v1alpha1.ScaledObject] } diff --git a/pkg/client/listers/kuma/v1alpha1/trafficroute.go b/pkg/client/listers/kuma/v1alpha1/trafficroute.go index d6869f678..2714562d0 100644 --- a/pkg/client/listers/kuma/v1alpha1/trafficroute.go +++ b/pkg/client/listers/kuma/v1alpha1/trafficroute.go @@ -20,8 +20,8 @@ package v1alpha1 import ( v1alpha1 "github.com/fluxcd/flagger/pkg/apis/kuma/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -39,30 +39,10 @@ type TrafficRouteLister interface { // trafficRouteLister implements the TrafficRouteLister interface. type trafficRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.TrafficRoute] } // NewTrafficRouteLister returns a new TrafficRouteLister. func NewTrafficRouteLister(indexer cache.Indexer) TrafficRouteLister { - return &trafficRouteLister{indexer: indexer} -} - -// List lists all TrafficRoutes in the indexer. -func (s *trafficRouteLister) List(selector labels.Selector) (ret []*v1alpha1.TrafficRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TrafficRoute)) - }) - return ret, err -} - -// Get retrieves the TrafficRoute from the index for a given name. -func (s *trafficRouteLister) Get(name string) (*v1alpha1.TrafficRoute, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("trafficroute"), name) - } - return obj.(*v1alpha1.TrafficRoute), nil + return &trafficRouteLister{listers.New[*v1alpha1.TrafficRoute](indexer, v1alpha1.Resource("trafficroute"))} } diff --git a/pkg/client/listers/projectcontour/v1/httpproxy.go b/pkg/client/listers/projectcontour/v1/httpproxy.go index a9e6b684a..4731e1355 100644 --- a/pkg/client/listers/projectcontour/v1/httpproxy.go +++ b/pkg/client/listers/projectcontour/v1/httpproxy.go @@ -20,8 +20,8 @@ package v1 import ( v1 "github.com/fluxcd/flagger/pkg/apis/projectcontour/v1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type HTTPProxyLister interface { // hTTPProxyLister implements the HTTPProxyLister interface. type hTTPProxyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.HTTPProxy] } // NewHTTPProxyLister returns a new HTTPProxyLister. func NewHTTPProxyLister(indexer cache.Indexer) HTTPProxyLister { - return &hTTPProxyLister{indexer: indexer} -} - -// List lists all HTTPProxies in the indexer. -func (s *hTTPProxyLister) List(selector labels.Selector) (ret []*v1.HTTPProxy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.HTTPProxy)) - }) - return ret, err + return &hTTPProxyLister{listers.New[*v1.HTTPProxy](indexer, v1.Resource("httpproxy"))} } // HTTPProxies returns an object that can list and get HTTPProxies. func (s *hTTPProxyLister) HTTPProxies(namespace string) HTTPProxyNamespaceLister { - return hTTPProxyNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPProxyNamespaceLister{listers.NewNamespaced[*v1.HTTPProxy](s.ResourceIndexer, namespace)} } // HTTPProxyNamespaceLister helps list and get HTTPProxies. @@ -74,26 +66,5 @@ type HTTPProxyNamespaceLister interface { // hTTPProxyNamespaceLister implements the HTTPProxyNamespaceLister // interface. type hTTPProxyNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all HTTPProxies in the indexer for a given namespace. -func (s hTTPProxyNamespaceLister) List(selector labels.Selector) (ret []*v1.HTTPProxy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.HTTPProxy)) - }) - return ret, err -} - -// Get retrieves the HTTPProxy from the indexer for a given namespace and name. -func (s hTTPProxyNamespaceLister) Get(name string) (*v1.HTTPProxy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("httpproxy"), name) - } - return obj.(*v1.HTTPProxy), nil + listers.ResourceIndexer[*v1.HTTPProxy] } diff --git a/pkg/client/listers/smi/v1alpha1/trafficsplit.go b/pkg/client/listers/smi/v1alpha1/trafficsplit.go index c180fa90c..9dd4a9a7c 100644 --- a/pkg/client/listers/smi/v1alpha1/trafficsplit.go +++ b/pkg/client/listers/smi/v1alpha1/trafficsplit.go @@ -20,8 +20,8 @@ package v1alpha1 import ( v1alpha1 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type TrafficSplitLister interface { // trafficSplitLister implements the TrafficSplitLister interface. type trafficSplitLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.TrafficSplit] } // NewTrafficSplitLister returns a new TrafficSplitLister. func NewTrafficSplitLister(indexer cache.Indexer) TrafficSplitLister { - return &trafficSplitLister{indexer: indexer} -} - -// List lists all TrafficSplits in the indexer. -func (s *trafficSplitLister) List(selector labels.Selector) (ret []*v1alpha1.TrafficSplit, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TrafficSplit)) - }) - return ret, err + return &trafficSplitLister{listers.New[*v1alpha1.TrafficSplit](indexer, v1alpha1.Resource("trafficsplit"))} } // TrafficSplits returns an object that can list and get TrafficSplits. func (s *trafficSplitLister) TrafficSplits(namespace string) TrafficSplitNamespaceLister { - return trafficSplitNamespaceLister{indexer: s.indexer, namespace: namespace} + return trafficSplitNamespaceLister{listers.NewNamespaced[*v1alpha1.TrafficSplit](s.ResourceIndexer, namespace)} } // TrafficSplitNamespaceLister helps list and get TrafficSplits. @@ -74,26 +66,5 @@ type TrafficSplitNamespaceLister interface { // trafficSplitNamespaceLister implements the TrafficSplitNamespaceLister // interface. type trafficSplitNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TrafficSplits in the indexer for a given namespace. -func (s trafficSplitNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TrafficSplit, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TrafficSplit)) - }) - return ret, err -} - -// Get retrieves the TrafficSplit from the indexer for a given namespace and name. -func (s trafficSplitNamespaceLister) Get(name string) (*v1alpha1.TrafficSplit, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("trafficsplit"), name) - } - return obj.(*v1alpha1.TrafficSplit), nil + listers.ResourceIndexer[*v1alpha1.TrafficSplit] } diff --git a/pkg/client/listers/smi/v1alpha2/trafficsplit.go b/pkg/client/listers/smi/v1alpha2/trafficsplit.go index 705222c4c..4c888bace 100644 --- a/pkg/client/listers/smi/v1alpha2/trafficsplit.go +++ b/pkg/client/listers/smi/v1alpha2/trafficsplit.go @@ -20,8 +20,8 @@ package v1alpha2 import ( v1alpha2 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type TrafficSplitLister interface { // trafficSplitLister implements the TrafficSplitLister interface. type trafficSplitLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.TrafficSplit] } // NewTrafficSplitLister returns a new TrafficSplitLister. func NewTrafficSplitLister(indexer cache.Indexer) TrafficSplitLister { - return &trafficSplitLister{indexer: indexer} -} - -// List lists all TrafficSplits in the indexer. -func (s *trafficSplitLister) List(selector labels.Selector) (ret []*v1alpha2.TrafficSplit, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TrafficSplit)) - }) - return ret, err + return &trafficSplitLister{listers.New[*v1alpha2.TrafficSplit](indexer, v1alpha2.Resource("trafficsplit"))} } // TrafficSplits returns an object that can list and get TrafficSplits. func (s *trafficSplitLister) TrafficSplits(namespace string) TrafficSplitNamespaceLister { - return trafficSplitNamespaceLister{indexer: s.indexer, namespace: namespace} + return trafficSplitNamespaceLister{listers.NewNamespaced[*v1alpha2.TrafficSplit](s.ResourceIndexer, namespace)} } // TrafficSplitNamespaceLister helps list and get TrafficSplits. @@ -74,26 +66,5 @@ type TrafficSplitNamespaceLister interface { // trafficSplitNamespaceLister implements the TrafficSplitNamespaceLister // interface. type trafficSplitNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TrafficSplits in the indexer for a given namespace. -func (s trafficSplitNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.TrafficSplit, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TrafficSplit)) - }) - return ret, err -} - -// Get retrieves the TrafficSplit from the indexer for a given namespace and name. -func (s trafficSplitNamespaceLister) Get(name string) (*v1alpha2.TrafficSplit, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("trafficsplit"), name) - } - return obj.(*v1alpha2.TrafficSplit), nil + listers.ResourceIndexer[*v1alpha2.TrafficSplit] } diff --git a/pkg/client/listers/smi/v1alpha3/trafficsplit.go b/pkg/client/listers/smi/v1alpha3/trafficsplit.go index 9ce91ffb1..6190e3403 100644 --- a/pkg/client/listers/smi/v1alpha3/trafficsplit.go +++ b/pkg/client/listers/smi/v1alpha3/trafficsplit.go @@ -20,8 +20,8 @@ package v1alpha3 import ( v1alpha3 "github.com/fluxcd/flagger/pkg/apis/smi/v1alpha3" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type TrafficSplitLister interface { // trafficSplitLister implements the TrafficSplitLister interface. type trafficSplitLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha3.TrafficSplit] } // NewTrafficSplitLister returns a new TrafficSplitLister. func NewTrafficSplitLister(indexer cache.Indexer) TrafficSplitLister { - return &trafficSplitLister{indexer: indexer} -} - -// List lists all TrafficSplits in the indexer. -func (s *trafficSplitLister) List(selector labels.Selector) (ret []*v1alpha3.TrafficSplit, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.TrafficSplit)) - }) - return ret, err + return &trafficSplitLister{listers.New[*v1alpha3.TrafficSplit](indexer, v1alpha3.Resource("trafficsplit"))} } // TrafficSplits returns an object that can list and get TrafficSplits. func (s *trafficSplitLister) TrafficSplits(namespace string) TrafficSplitNamespaceLister { - return trafficSplitNamespaceLister{indexer: s.indexer, namespace: namespace} + return trafficSplitNamespaceLister{listers.NewNamespaced[*v1alpha3.TrafficSplit](s.ResourceIndexer, namespace)} } // TrafficSplitNamespaceLister helps list and get TrafficSplits. @@ -74,26 +66,5 @@ type TrafficSplitNamespaceLister interface { // trafficSplitNamespaceLister implements the TrafficSplitNamespaceLister // interface. type trafficSplitNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TrafficSplits in the indexer for a given namespace. -func (s trafficSplitNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.TrafficSplit, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.TrafficSplit)) - }) - return ret, err -} - -// Get retrieves the TrafficSplit from the indexer for a given namespace and name. -func (s trafficSplitNamespaceLister) Get(name string) (*v1alpha3.TrafficSplit, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha3.Resource("trafficsplit"), name) - } - return obj.(*v1alpha3.TrafficSplit), nil + listers.ResourceIndexer[*v1alpha3.TrafficSplit] } diff --git a/pkg/client/listers/traefik/v1alpha1/traefikservice.go b/pkg/client/listers/traefik/v1alpha1/traefikservice.go index 1ca9c744c..bd9a47398 100644 --- a/pkg/client/listers/traefik/v1alpha1/traefikservice.go +++ b/pkg/client/listers/traefik/v1alpha1/traefikservice.go @@ -20,8 +20,8 @@ package v1alpha1 import ( v1alpha1 "github.com/fluxcd/flagger/pkg/apis/traefik/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type TraefikServiceLister interface { // traefikServiceLister implements the TraefikServiceLister interface. type traefikServiceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.TraefikService] } // NewTraefikServiceLister returns a new TraefikServiceLister. func NewTraefikServiceLister(indexer cache.Indexer) TraefikServiceLister { - return &traefikServiceLister{indexer: indexer} -} - -// List lists all TraefikServices in the indexer. -func (s *traefikServiceLister) List(selector labels.Selector) (ret []*v1alpha1.TraefikService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TraefikService)) - }) - return ret, err + return &traefikServiceLister{listers.New[*v1alpha1.TraefikService](indexer, v1alpha1.Resource("traefikservice"))} } // TraefikServices returns an object that can list and get TraefikServices. func (s *traefikServiceLister) TraefikServices(namespace string) TraefikServiceNamespaceLister { - return traefikServiceNamespaceLister{indexer: s.indexer, namespace: namespace} + return traefikServiceNamespaceLister{listers.NewNamespaced[*v1alpha1.TraefikService](s.ResourceIndexer, namespace)} } // TraefikServiceNamespaceLister helps list and get TraefikServices. @@ -74,26 +66,5 @@ type TraefikServiceNamespaceLister interface { // traefikServiceNamespaceLister implements the TraefikServiceNamespaceLister // interface. type traefikServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TraefikServices in the indexer for a given namespace. -func (s traefikServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TraefikService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TraefikService)) - }) - return ret, err -} - -// Get retrieves the TraefikService from the indexer for a given namespace and name. -func (s traefikServiceNamespaceLister) Get(name string) (*v1alpha1.TraefikService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("traefikservice"), name) - } - return obj.(*v1alpha1.TraefikService), nil + listers.ResourceIndexer[*v1alpha1.TraefikService] } From 4c0a26b67598762160c1068e892f150561da134e Mon Sep 17 00:00:00 2001 From: Sanskar Jaiswal Date: Sun, 24 Nov 2024 19:04:25 +0530 Subject: [PATCH 09/14] gatewayapi: return early after creating new http routes Signed-off-by: Sanskar Jaiswal --- pkg/router/gateway_api.go | 1 + pkg/router/gateway_api_v1beta1.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/router/gateway_api.go b/pkg/router/gateway_api.go index 7d2ae79d1..bc398afda 100644 --- a/pkg/router/gateway_api.go +++ b/pkg/router/gateway_api.go @@ -180,6 +180,7 @@ func (gwr *GatewayAPIRouter) Reconcile(canary *flaggerv1.Canary) error { } gwr.logger.With("canary", fmt.Sprintf("%s.%s", canary.Name, canary.Namespace)). Infof("HTTPRoute %s.%s created", route.GetName(), hrNamespace) + return nil } else if err != nil { return fmt.Errorf("HTTPRoute %s.%s get error: %w", apexSvcName, hrNamespace, err) } diff --git a/pkg/router/gateway_api_v1beta1.go b/pkg/router/gateway_api_v1beta1.go index e9042ea28..b9d8e40e1 100644 --- a/pkg/router/gateway_api_v1beta1.go +++ b/pkg/router/gateway_api_v1beta1.go @@ -162,6 +162,7 @@ func (gwr *GatewayAPIV1Beta1Router) Reconcile(canary *flaggerv1.Canary) error { } gwr.logger.With("canary", fmt.Sprintf("%s.%s", canary.Name, canary.Namespace)). Infof("HTTPRoute %s.%s created", route.GetName(), hrNamespace) + return nil } else if err != nil { return fmt.Errorf("HTTPRoute %s.%s get error: %w", apexSvcName, hrNamespace, err) } From 6ee00e14f9d00d4d2b0838913218a5614c4af6c3 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 25 Nov 2024 14:33:38 +0000 Subject: [PATCH 10/14] Build with Go 1.23 Signed-off-by: Stefan Prodan --- .github/workflows/build.yaml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/scan.yml | 2 +- Dockerfile | 2 +- Dockerfile.loadtester | 2 +- Makefile | 2 +- go.mod | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b2eaf715f..97dd9b051 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x cache-dependency-path: | **/go.sum **/go.mod diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba77a9753..6b5762231 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x - uses: fluxcd/flux2/action@main - uses: sigstore/cosign-installer@v3.5.0 - name: Prepare @@ -125,7 +125,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: version: latest - args: release --release-notes=notes.md --rm-dist --skip-validate + args: release --release-notes=notes.md --clean --skip-validate env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Generate SLSA metadata diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 72b60d21f..cb87dba98 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -34,7 +34,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/Dockerfile b/Dockerfile index 6a70981e6..2fd8760e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22-alpine as builder +FROM golang:1.23-alpine as builder ARG TARGETPLATFORM ARG REVISON diff --git a/Dockerfile.loadtester b/Dockerfile.loadtester index ea2b5502d..1aad9b910 100644 --- a/Dockerfile.loadtester +++ b/Dockerfile.loadtester @@ -1,4 +1,4 @@ -FROM golang:1.22-alpine as builder +FROM golang:1.23-alpine as builder ARG TARGETPLATFORM ARG TARGETARCH diff --git a/Makefile b/Makefile index cbfd85978..25eda686b 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ build: CGO_ENABLED=0 go build -a -o ./bin/flagger ./cmd/flagger tidy: - rm -f go.sum; go mod tidy -compat=1.22 + rm -f go.sum; go mod tidy -compat=1.23 vet: go vet ./... diff --git a/go.mod b/go.mod index 46d9f6e71..727ec4fb0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/fluxcd/flagger -go 1.22.0 +go 1.23.0 require ( cloud.google.com/go/monitoring v1.21.2 From c04ff05aa48f9f4a385c74d0aabb37ff7017bf06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:43:40 +0000 Subject: [PATCH 11/14] Bump the ci group across 1 directory with 4 updates Bumps the ci group with 4 updates in the / directory: [codecov/codecov-action](https://github.com/codecov/codecov-action), [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer), [docker/build-push-action](https://github.com/docker/build-push-action) and [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action). Updates `codecov/codecov-action` from 4 to 5 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4...v5) Updates `sigstore/cosign-installer` from 3.5.0 to 3.7.0 - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](https://github.com/sigstore/cosign-installer/compare/v3.5.0...v3.7.0) Updates `docker/build-push-action` from 5 to 6 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v5...v6) Updates `goreleaser/goreleaser-action` from 5 to 6 - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/v5...v6) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci - dependency-name: sigstore/cosign-installer dependency-type: direct:production update-type: version-update:semver-minor dependency-group: ci - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: ci ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yaml | 2 +- .github/workflows/push-ld.yml | 4 ++-- .github/workflows/release.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 97dd9b051..bdfeec71f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -45,7 +45,7 @@ jobs: exit 1 fi - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: file: ./coverage.txt - name: Build container image diff --git a/.github/workflows/push-ld.yml b/.github/workflows/push-ld.yml index bea33785d..3e8aab32d 100644 --- a/.github/workflows/push-ld.yml +++ b/.github/workflows/push-ld.yml @@ -17,7 +17,7 @@ jobs: packages: write steps: - uses: actions/checkout@v4 - - uses: sigstore/cosign-installer@v3.5.0 + - uses: sigstore/cosign-installer@v3.7.0 - name: Prepare id: prep run: | @@ -45,7 +45,7 @@ jobs: type=raw,value=${{ steps.prep.outputs.VERSION }} - name: Publish image id: build-push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: true builder: ${{ steps.buildx.outputs.name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b5762231..612a1b8fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: with: go-version: 1.23.x - uses: fluxcd/flux2/action@main - - uses: sigstore/cosign-installer@v3.5.0 + - uses: sigstore/cosign-installer@v3.7.0 - name: Prepare id: prep run: | @@ -67,7 +67,7 @@ jobs: type=raw,value=${{ steps.prep.outputs.VERSION }} - name: Publish image id: build-push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: sbom: true provenance: true @@ -121,7 +121,7 @@ jobs: - uses: anchore/sbom-action/download-syft@v0 - name: Create release and SBOM id: run-goreleaser - uses: goreleaser/goreleaser-action@v5 + uses: goreleaser/goreleaser-action@v6 if: startsWith(github.ref, 'refs/tags/v') with: version: latest From 7754cdb89a19bc39a4019b511904ad7927c5dcc6 Mon Sep 17 00:00:00 2001 From: Sanskar Jaiswal Date: Mon, 25 Nov 2024 23:26:35 +0530 Subject: [PATCH 12/14] Release v1.39.0 Signed-off-by: Sanskar Jaiswal --- CHANGELOG.md | 32 +++++++++++++++++++++++ artifacts/flagger/deployment.yaml | 2 +- charts/flagger/Chart.yaml | 4 +-- charts/flagger/values.yaml | 2 +- kustomize/base/flagger/kustomization.yaml | 2 +- pkg/version/version.go | 2 +- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b0b071a6..9b3cd259a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,38 @@ All notable changes to this project are documented in this file. +## 1.39.0 + +**Release date:** 2024-07-30 + +This release comes with fixes and improvements. There is a new +`.spec.analysis.webhooks[].disableTLS` field which disables TLS verification +for that webhook request. +A bug in the Gateway API provider was fixed which could lead to unecessary restarts. + +This release is built with Go 1.23. Lastly, all Go dependencies, Alpine and +Kubernetes libraries were updated. + +#### Improvements +- Add validation for `primaryScalerReplicas` field in the CRD + [#1702](https://github.com/fluxcd/flagger/pull/1702) +- feat: add `disableTLS` option for webhooks request + [#1709](https://github.com/fluxcd/flagger/pull/1709) +- Update dependencies to Kubernetes v1.31.3 + [#1723](https://github.com/fluxcd/flagger/pull/1723) +- Update generated client for Kubernetes 1.31 + [#1725](https://github.com/fluxcd/flagger/pull/1725) +- Build with Go 1.23 + [#1726](https://github.com/fluxcd/flagger/pull/1726) + +#### Fixes +- Gateway API: Sort header filters to avoid canary restarts + [#1713](https://github.com/fluxcd/flagger/pull/1713) +- fix: fix codegen script and update generated code + [#1724](https://github.com/fluxcd/flagger/pull/1724) +- fix(helm): podinfo fails to create the hpa object + [#1721](https://github.com/fluxcd/flagger/pull/1721) + ## 1.38.0 **Release date:** 2024-07-30 diff --git a/artifacts/flagger/deployment.yaml b/artifacts/flagger/deployment.yaml index 222ee63b0..2fef04374 100644 --- a/artifacts/flagger/deployment.yaml +++ b/artifacts/flagger/deployment.yaml @@ -22,7 +22,7 @@ spec: serviceAccountName: flagger containers: - name: flagger - image: ghcr.io/fluxcd/flagger:1.38.0 + image: ghcr.io/fluxcd/flagger:1.39.0 imagePullPolicy: IfNotPresent ports: - name: http diff --git a/charts/flagger/Chart.yaml b/charts/flagger/Chart.yaml index 51b82c21a..87f396b38 100644 --- a/charts/flagger/Chart.yaml +++ b/charts/flagger/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: flagger -version: 1.38.0 -appVersion: 1.38.0 +version: 1.39.0 +appVersion: 1.39.0 kubeVersion: ">=1.19.0-0" engine: gotpl description: Flagger is a progressive delivery operator for Kubernetes diff --git a/charts/flagger/values.yaml b/charts/flagger/values.yaml index 52d335097..6f3b4975c 100644 --- a/charts/flagger/values.yaml +++ b/charts/flagger/values.yaml @@ -5,7 +5,7 @@ image: repository: ghcr.io/fluxcd/flagger - tag: 1.38.0 + tag: 1.39.0 pullPolicy: IfNotPresent pullSecret: diff --git a/kustomize/base/flagger/kustomization.yaml b/kustomize/base/flagger/kustomization.yaml index 877335274..6579a10d5 100644 --- a/kustomize/base/flagger/kustomization.yaml +++ b/kustomize/base/flagger/kustomization.yaml @@ -9,4 +9,4 @@ resources: images: - name: ghcr.io/fluxcd/flagger newName: ghcr.io/fluxcd/flagger - newTag: 1.38.0 + newTag: 1.39.0 diff --git a/pkg/version/version.go b/pkg/version/version.go index 882044390..c6d8f5b76 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -16,5 +16,5 @@ limitations under the License. package version -var VERSION = "1.38.0" +var VERSION = "1.39.0" var REVISION = "unknown" From 0ef356706abb87f5acdf227b626fa57c4881a554 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 26 Nov 2024 11:56:09 +0000 Subject: [PATCH 13/14] Optimize build with XX Signed-off-by: Stefan Prodan --- .github/workflows/release.yml | 2 +- Dockerfile | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 612a1b8fc..b049a2097 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,7 +125,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: version: latest - args: release --release-notes=notes.md --clean --skip-validate + args: release --release-notes=notes.md --clean --skip=validate env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Generate SLSA metadata diff --git a/Dockerfile b/Dockerfile index 2fd8760e6..52044ed50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,11 @@ -FROM golang:1.23-alpine as builder +ARG GO_VERSION=1.23 +ARG XX_VERSION=1.4.0 + +FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine as builder + +# copy build utilities +COPY --from=xx / / ARG TARGETPLATFORM ARG REVISON @@ -17,7 +24,8 @@ COPY cmd/ cmd/ COPY pkg/ pkg/ # build -RUN CGO_ENABLED=0 go build \ +ENV CGO_ENABLED=0 +RUN xx-go build \ -ldflags "-s -w -X github.com/fluxcd/flagger/pkg/version.REVISION=${REVISON}" \ -a -o flagger ./cmd/flagger From 25fd9be1dbfd0ed5ba4a8dd06495b094a5736e44 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 26 Nov 2024 12:12:17 +0000 Subject: [PATCH 14/14] Fix changelog date for 1.39 release Signed-off-by: Stefan Prodan --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b3cd259a..2790ab7ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project are documented in this file. ## 1.39.0 -**Release date:** 2024-07-30 +**Release date:** 2024-11-26 This release comes with fixes and improvements. There is a new `.spec.analysis.webhooks[].disableTLS` field which disables TLS verification