Skip to content

Commit

Permalink
Update all Server usages to v1beta3Â
Browse files Browse the repository at this point in the history
  • Loading branch information
alpeb committed Jul 16, 2024
1 parent df0c62a commit 42400d1
Show file tree
Hide file tree
Showing 41 changed files with 153 additions and 153 deletions.
2 changes: 1 addition & 1 deletion bin/install-deps
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CGO_ENABLED=0 GOOS=linux GOARCH=$arch go install -mod=readonly \
k8s.io/client-go/kubernetes/typed/admissionregistration/v1 \
k8s.io/client-go/kubernetes/typed/apps/v1 \
k8s.io/client-go/kubernetes/typed/apps/v1beta1 \
k8s.io/client-go/kubernetes/typed/apps/v1beta2 \
k8s.io/client-go/kubernetes/typed/apps/v1beta3 \
k8s.io/client-go/kubernetes/typed/authentication/v1 \
k8s.io/client-go/kubernetes/typed/authentication/v1beta1 \
k8s.io/client-go/kubernetes/typed/authorization/v1 \
Expand Down
2 changes: 1 addition & 1 deletion charts/linkerd-crds/templates/policy/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
served: true
storage: false
deprecated: true
deprecationWarning: "policy.linkerd.io/v1alpha1 Server is deprecated; use policy.linkerd.io/v1beta2 Server"
deprecationWarning: "policy.linkerd.io/v1alpha1 Server is deprecated; use policy.linkerd.io/v1beta3 Server"
schema:
openAPIV3Schema:
type: object
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_crds.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_helm_crds_output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_helm_crds_output_ha.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions controller/api/destination/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/linkerd/linkerd2-proxy-api/go/net"
"github.com/linkerd/linkerd2/controller/api/destination/watcher"
"github.com/linkerd/linkerd2/controller/api/util"
"github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2"
"github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3"
"github.com/linkerd/linkerd2/controller/k8s"
"github.com/linkerd/linkerd2/pkg/addr"
pkgk8s "github.com/linkerd/linkerd2/pkg/k8s"
Expand Down Expand Up @@ -315,13 +315,13 @@ func testOpaque(t *testing.T, name string) {
// Update the Server's pod selector so that it no longer selects the
// pod. This should result in the proxy protocol no longer being marked
// as opaque.
srv, err := client.ServerV1beta2().Servers("ns").Get(context.Background(), name, metav1.GetOptions{})
srv, err := client.ServerV1beta3().Servers("ns").Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
t.Fatal(err)
}
// PodSelector is updated to NOT select the pod
srv.Spec.PodSelector.MatchLabels = map[string]string{"app": "FOOBAR"}
_, err = client.ServerV1beta2().Servers("ns").Update(context.Background(), srv, metav1.UpdateOptions{})
_, err = client.ServerV1beta3().Servers("ns").Update(context.Background(), srv, metav1.UpdateOptions{})
if err != nil {
t.Fatal(err)
}
Expand All @@ -345,7 +345,7 @@ func testOpaque(t *testing.T, name string) {
// as opaque.
srv.Spec.PodSelector.MatchLabels = map[string]string{"app": name}

_, err = client.ServerV1beta2().Servers("ns").Update(context.Background(), srv, metav1.UpdateOptions{})
_, err = client.ServerV1beta3().Servers("ns").Update(context.Background(), srv, metav1.UpdateOptions{})
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1072,12 +1072,12 @@ func TestGetProfiles(t *testing.T) {
}

// Server is created, setting the port to opaque
l5dClient.ServerV1beta2().Servers("ns").Create(context.Background(), &v1beta2.Server{
l5dClient.ServerV1beta3().Servers("ns").Create(context.Background(), &v1beta3.Server{
ObjectMeta: metav1.ObjectMeta{
Name: "srv-hostport-mapping-2",
Namespace: "ns",
},
Spec: v1beta2.ServerSpec{
Spec: v1beta3.ServerSpec{
PodSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "hostport-mapping-2",
Expand Down
6 changes: 3 additions & 3 deletions controller/api/destination/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ spec:
name: http
protocol: TCP`,
`
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
name: policy-test
Expand All @@ -460,7 +460,7 @@ spec:
port: 80
proxyProtocol: opaque`,
`
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
name: policy-test-external-workload
Expand Down Expand Up @@ -534,7 +534,7 @@ spec:
name: http
protocol: TCP`,
`
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
name: native
Expand Down
16 changes: 8 additions & 8 deletions controller/api/destination/watcher/endpoints_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"time"

ewv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/externalworkload/v1beta1"
"github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2"
"github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3"
"github.com/linkerd/linkerd2/controller/k8s"
consts "github.com/linkerd/linkerd2/pkg/k8s"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -536,7 +536,7 @@ func (ew *EndpointsWatcher) getServicePublisher(id ServiceID) (sp *servicePublis
func (ew *EndpointsWatcher) addServer(obj interface{}) {
ew.Lock()
defer ew.Unlock()
server := obj.(*v1beta2.Server)
server := obj.(*v1beta3.Server)
for _, sp := range ew.publishers {
sp.updateServer(nil, server)
}
Expand All @@ -546,8 +546,8 @@ func (ew *EndpointsWatcher) updateServer(oldObj interface{}, newObj interface{})
ew.Lock()
defer ew.Unlock()

oldServer := oldObj.(*v1beta2.Server)
newServer := newObj.(*v1beta2.Server)
oldServer := oldObj.(*v1beta3.Server)
newServer := newObj.(*v1beta3.Server)
if oldServer != nil && newServer != nil {
oldUpdated := latestUpdated(oldServer.ManagedFields)
updated := latestUpdated(newServer.ManagedFields)
Expand Down Expand Up @@ -576,7 +576,7 @@ func (ew *EndpointsWatcher) updateServer(oldObj interface{}, newObj interface{})
func (ew *EndpointsWatcher) deleteServer(obj interface{}) {
ew.Lock()
defer ew.Unlock()
server := obj.(*v1beta2.Server)
server := obj.(*v1beta3.Server)
for _, sp := range ew.publishers {
sp.updateServer(server, nil)
}
Expand Down Expand Up @@ -751,7 +751,7 @@ func (sp *servicePublisher) metricsLabels(port Port, hostname string) prometheus
return endpointsLabels(sp.cluster, sp.id.Namespace, sp.id.Name, strconv.Itoa(int(port)), hostname)
}

func (sp *servicePublisher) updateServer(oldServer, newServer *v1beta2.Server) {
func (sp *servicePublisher) updateServer(oldServer, newServer *v1beta3.Server) {
sp.Lock()
defer sp.Unlock()

Expand Down Expand Up @@ -1311,7 +1311,7 @@ func (pp *portPublisher) unsubscribe(listener EndpointUpdateListener) {

pp.metrics.setSubscribers(len(pp.listeners))
}
func (pp *portPublisher) updateServer(oldServer, newServer *v1beta2.Server) {
func (pp *portPublisher) updateServer(oldServer, newServer *v1beta3.Server) {
updated := false
for id, address := range pp.addresses.Addresses {

Expand All @@ -1335,7 +1335,7 @@ func (pp *portPublisher) updateServer(oldServer, newServer *v1beta2.Server) {
}
}

func (pp *portPublisher) isAddressSelected(address Address, server *v1beta2.Server) bool {
func (pp *portPublisher) isAddressSelected(address Address, server *v1beta3.Server) bool {
if server == nil {
return false
}
Expand Down
16 changes: 8 additions & 8 deletions controller/api/destination/watcher/workload_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

ext "github.com/linkerd/linkerd2/controller/gen/apis/externalworkload/v1beta1"
"github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2"
"github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3"
"github.com/linkerd/linkerd2/controller/k8s"
consts "github.com/linkerd/linkerd2/pkg/k8s"
"github.com/linkerd/linkerd2/pkg/util"
Expand Down Expand Up @@ -299,8 +299,8 @@ func (ww *WorkloadWatcher) submitExternalWorkloadUpdate(externalWorkload *ext.Ex
}

func (ww *WorkloadWatcher) updateServer(oldObj interface{}, newObj interface{}) {
oldServer := oldObj.(*v1beta2.Server)
newServer := newObj.(*v1beta2.Server)
oldServer := oldObj.(*v1beta3.Server)
newServer := newObj.(*v1beta3.Server)

oldUpdated := latestUpdated(oldServer.ManagedFields)
updated := latestUpdated(newServer.ManagedFields)
Expand All @@ -314,14 +314,14 @@ func (ww *WorkloadWatcher) updateServer(oldObj interface{}, newObj interface{})
}

func (ww *WorkloadWatcher) addOrDeleteServer(obj interface{}) {
server, ok := obj.(*v1beta2.Server)
server, ok := obj.(*v1beta3.Server)
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
ww.log.Errorf("Couldn't get object from DeletedFinalStateUnknown %#v", obj)
return
}
server, ok = tombstone.Obj.(*v1beta2.Server)
server, ok = tombstone.Obj.(*v1beta3.Server)
if !ok {
ww.log.Errorf("DeletedFinalStateUnknown contained object that is not a Server %#v", obj)
return
Expand All @@ -334,7 +334,7 @@ func (ww *WorkloadWatcher) addOrDeleteServer(obj interface{}) {
// whose pod matches the any of the Servers' podSelector or whose
// externalworkload matches any of the Servers' externalworkload selection. This
// function is an event handler so it cannot block.
func (ww *WorkloadWatcher) updateServers(servers ...*v1beta2.Server) {
func (ww *WorkloadWatcher) updateServers(servers ...*v1beta3.Server) {
ww.mu.RLock()
defer ww.mu.RUnlock()

Expand Down Expand Up @@ -390,7 +390,7 @@ func (ww *WorkloadWatcher) updateServers(servers ...*v1beta2.Server) {
}
}

func (ww *WorkloadWatcher) isPodSelectedByAny(pod *corev1.Pod, servers ...*v1beta2.Server) bool {
func (ww *WorkloadWatcher) isPodSelectedByAny(pod *corev1.Pod, servers ...*v1beta3.Server) bool {
for _, s := range servers {
selector, err := metav1.LabelSelectorAsSelector(s.Spec.PodSelector)
if err != nil {
Expand All @@ -404,7 +404,7 @@ func (ww *WorkloadWatcher) isPodSelectedByAny(pod *corev1.Pod, servers ...*v1bet
return false
}

func (ww *WorkloadWatcher) isExternalWorkloadSelectedByAny(ew *ext.ExternalWorkload, servers ...*v1beta2.Server) bool {
func (ww *WorkloadWatcher) isExternalWorkloadSelectedByAny(ew *ext.ExternalWorkload, servers ...*v1beta3.Server) bool {
for _, s := range servers {
selector, err := metav1.LabelSelectorAsSelector(s.Spec.ExternalWorkloadSelector)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions controller/k8s/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
l5dcrdclient "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned"
l5dcrdinformer "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions"
ewinformers "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/externalworkload/v1beta1"
srvinformers "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/server/v1beta2"
srvinformers "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/server/v1beta3"
spinformers "github.com/linkerd/linkerd2/controller/gen/client/informers/externalversions/serviceprofile/v1alpha2"
"github.com/linkerd/linkerd2/pkg/k8s"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -279,7 +279,7 @@ func newAPI(
if l5dCrdSharedInformers == nil {
panic("Linkerd CRD shared informer not configured")
}
api.srv = l5dCrdSharedInformers.Server().V1beta2().Servers()
api.srv = l5dCrdSharedInformers.Server().V1beta3().Servers()
api.syncChecks = append(api.syncChecks, api.srv.Informer().HasSynced)
api.promGauges.addInformerSize(k8s.Server, informerLabels, api.srv.Informer())
case SS:
Expand Down
4 changes: 2 additions & 2 deletions controller/k8s/api_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package k8s
import (
"strings"

serverv1beta2 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta2"
serverv1beta3 "github.com/linkerd/linkerd2/controller/gen/apis/server/v1beta3"
sazv1beta1 "github.com/linkerd/linkerd2/controller/gen/apis/serverauthorization/v1beta1"
spv1alpha2 "github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2"
"github.com/linkerd/linkerd2/pkg/k8s"
Expand Down Expand Up @@ -84,7 +84,7 @@ func (res APIResource) GVK() (schema.GroupVersionKind, error) {
case SS:
return appsv1.SchemeGroupVersion.WithKind("StatefulSet"), nil
case Srv:
return serverv1beta2.SchemeGroupVersion.WithKind("Server"), nil
return serverv1beta3.SchemeGroupVersion.WithKind("Server"), nil
case Svc:
return v1.SchemeGroupVersion.WithKind("Service"), nil
default:
Expand Down
2 changes: 1 addition & 1 deletion controller/script/policy-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
}
client := versioned.NewForConfigOrDie(config)

srvWatch, err := client.ServerV1beta2().Servers(*namespace).Watch(context.Background(), metav1.ListOptions{})
srvWatch, err := client.ServerV1beta3().Servers(*namespace).Watch(context.Background(), metav1.ListOptions{})
if err != nil {
fmt.Fprintf(os.Stderr, "failed to watch Servers: %s", err)
os.Exit(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand Down
20 changes: 10 additions & 10 deletions jaeger/charts/linkerd-jaeger/templates/tracing-policy.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ if .Values.collector.enabled -}}
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand All @@ -18,7 +18,7 @@ spec:
port: 4317
proxyProtocol: gRPC
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand All @@ -35,7 +35,7 @@ spec:
port: 4318
proxyProtocol: HTTP/1
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand All @@ -53,7 +53,7 @@ spec:
port: 55678
proxyProtocol: gRPC
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand All @@ -70,7 +70,7 @@ spec:
component: collector
port: 9411
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand All @@ -87,7 +87,7 @@ spec:
component: collector
port: 14268
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand All @@ -104,7 +104,7 @@ spec:
component: collector
port: 14250
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand Down Expand Up @@ -236,7 +236,7 @@ spec:
# allow connections from any pod (meshed or not) sending trace data
requiredAuthenticationRefs: []
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand Down Expand Up @@ -275,7 +275,7 @@ spec:
name: collector
namespace: {{.Release.Namespace}}
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand Down Expand Up @@ -315,7 +315,7 @@ spec:
name: prometheus
namespace: linkerd-viz
---
apiVersion: policy.linkerd.io/v1beta2
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
namespace: {{ .Release.Namespace }}
Expand Down
Loading

0 comments on commit 42400d1

Please sign in to comment.