Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump github.com/kong/kubernetes-telemetry from 0.0.3 to 0.0.4 #3977

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/google/uuid v1.3.0
github.com/kong/deck v1.20.0
github.com/kong/go-kong v0.41.0
github.com/kong/kubernetes-telemetry v0.0.3
github.com/kong/kubernetes-telemetry v0.0.4
github.com/kong/kubernetes-testing-framework v0.30.1
github.com/lithammer/dedent v1.1.0
github.com/miekg/dns v1.1.54
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ github.com/kong/deck v1.20.0 h1:q8+8VBnvv0O+9mYjcPdJP5prG3KzbvR4XfePwkTx+Zc=
github.com/kong/deck v1.20.0/go.mod h1:yJWEu6/xnYiaNBg2vP4EsYLtbt33J67Zsolye3JpJmI=
github.com/kong/go-kong v0.41.0 h1:0rn+Haf8wfT0VWFVjQPNETLju5ZuNhfbrHYyjpliDBU=
github.com/kong/go-kong v0.41.0/go.mod h1:S/Mx/ZjgwsREPcpMXgCFt5wX7LBpyFlTKENri7E3KTg=
github.com/kong/kubernetes-telemetry v0.0.3 h1:EAgX/5t732NCTGTzBZSz8LXeFFGm/SrrYeib/5EfyTk=
github.com/kong/kubernetes-telemetry v0.0.3/go.mod h1:xopN/XY+5xCXoY8kfnjHf83yT6n4ezVcWKJxA7gmJUw=
github.com/kong/kubernetes-telemetry v0.0.4 h1:6iDDocM4b/pIKJ/KrSSoQjvyaHBIBtBb4U9LdOqg8Js=
github.com/kong/kubernetes-telemetry v0.0.4/go.mod h1:xopN/XY+5xCXoY8kfnjHf83yT6n4ezVcWKJxA7gmJUw=
github.com/kong/kubernetes-testing-framework v0.30.1 h1:FZCThCgf2xOi/pUbSzd5hW1ghUnZYihmvy9a3DHMRAE=
github.com/kong/kubernetes-testing-framework v0.30.1/go.mod h1:gnq+/PEPMXqH1lc1/tR4O9goQ3P2pR0T9llthQYebGQ=
github.com/kong/semver/v4 v4.0.1 h1:DIcNR8W3gfx0KabFBADPalxxsp+q/5COwIFkkhrFQ2Y=
Expand Down
169 changes: 115 additions & 54 deletions internal/manager/telemetry/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/kong/kubernetes-telemetry/pkg/types"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
discoveryv1 "k8s.io/api/discovery/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
apitypes "k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -122,13 +123,14 @@ func TestCreateManager(t *testing.T) {
"k8sv=v1.24.5;"+
"k8sv_semver=v1.24.5;"+
"k8s_nodes_count=4;"+
"k8s_pods_count=8;"+
"k8s_services_count=17;"+
"k8s_pods_count=10;"+
"k8s_services_count=18;"+
"kinm=c3,l2,l3,l4;"+
"mdep=i3,k3,km3,l3,t3;"+
"mdist=all17,c1,i2,k1,km1,l2,t1;"+
"mdist=all18,c1,i2,k1,km1,l3,t1;"+
"\n",
hostname),
hostname,
),
actualReport,
)
},
Expand Down Expand Up @@ -295,22 +297,21 @@ func prepareObjects(pod apitypes.NamespacedName) []runtime.Object {
Name: "kong-proxy",
},
},
// endpoints.
&corev1.Endpoints{
// Service with multiple EndpointSlices.
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: pod.Namespace,
Name: "kong-proxy",
Name: "kong-proxy-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "kong-proxy",
},
},
Subsets: []corev1.EndpointSubset{
Endpoints: []discoveryv1.Endpoint{
{
Addresses: []corev1.EndpointAddress{
{
TargetRef: &corev1.ObjectReference{
Kind: "Pod",
Namespace: pod.Namespace,
Name: pod.Name,
},
},
TargetRef: &corev1.ObjectReference{
Kind: "Pod",
Namespace: pod.Namespace,
Name: pod.Name,
},
},
},
Expand Down Expand Up @@ -391,82 +392,118 @@ func prepareObjects(pod apitypes.NamespacedName) []runtime.Object {
},
},
},
// service with no endpoints.
// Service with no EndpointSlices.
&corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "service3",
},
},
// endpoints.
&corev1.Endpoints{
// Service with multiple EndpointSlices.
&corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "service4",
},
},
// EndpointSlices for Pods.
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1",
Name: "service1",
Name: "service1-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service1",
},
},
Subsets: []corev1.EndpointSubset{
Endpoints: []discoveryv1.Endpoint{
{
Addresses: []corev1.EndpointAddress{
{
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns1", Name: "pod1"},
},
},
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns1", Name: "pod1"},
},
},
},
&corev1.Endpoints{
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1",
Name: "service2",
Name: "service2-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service2",
},
},
Subsets: []corev1.EndpointSubset{
Endpoints: []discoveryv1.Endpoint{
{
Addresses: []corev1.EndpointAddress{
{
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns1", Name: "pod2"},
},
},
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns1", Name: "pod2"},
},
},
},
&corev1.Endpoints{
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1",
Name: "service3",
Name: "service3-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service3",
},
},
// endpoints with no subsets.
// EndpointSlice with no endpoints.
},
&corev1.Endpoints{
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "service1",
Name: "service1-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service1",
},
},
Subsets: []corev1.EndpointSubset{
Endpoints: []discoveryv1.Endpoint{
{
Addresses: []corev1.EndpointAddress{
{
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns2", Name: "pod1"},
},
},
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns2", Name: "pod1"},
},
},
},
&corev1.Endpoints{
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "service2",
Name: "service2-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service2",
},
},
Subsets: []corev1.EndpointSubset{
Endpoints: []discoveryv1.Endpoint{
{
Addresses: []corev1.EndpointAddress{
{
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns2", Name: "pod2"},
},
},
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns2", Name: "pod2"},
},
{},
},
},
// Two EndpointSlices for the same service.
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "service3-1",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service3",
},
},
Endpoints: []discoveryv1.Endpoint{
{
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns2", Name: "pod3-1"},
},
},
},
// pods.
&discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "service3-2",
Labels: map[string]string{
discoveryv1.LabelServiceName: "service3",
},
},
Endpoints: []discoveryv1.Endpoint{
{
TargetRef: &corev1.ObjectReference{Kind: "Pod", Namespace: "ns2", Name: "pod3-2"},
},
},
},
// Pods referenced by EndpointSlices.
&corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1",
Expand Down Expand Up @@ -515,5 +552,29 @@ func prepareObjects(pod apitypes.NamespacedName) []runtime.Object {
},
},
},
// One Pod has service mesh sidecar, the other doesn't.
&corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "pod3-1",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{Name: "worker"},
{Name: "linkerd-proxy"},
},
},
},
&corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Namespace: "ns2",
Name: "pod3-2",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{Name: "worker"},
},
},
},
}
}