Skip to content

Commit 22da47c

Browse files
committed
--amend
1 parent 1fc6979 commit 22da47c

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

pkg/monitor/cluster/clusterwideproxystatus.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (mon *Monitor) emitCWPStatus(ctx context.Context) error {
175175
// Our SRE testing has also not identified any functionality issues with this configuration.
176176
// Therefore, we will make this check optional if the clusterDomain is already included in the list.
177177
// This check is not aligned with our documentation,
178-
// but we are implementing it this way for the sake of code optimization.
178+
// but we are implementing it this way for code optimization.
179179
if !clusterDomaincheck {
180180
if !(noProxyMap[".apps."+clusterDomain]) {
181181
missing_no_proxy_list = append(missing_no_proxy_list, clusterDomain)

pkg/monitor/cluster/clusterwideproxystatus_test.go

+61
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func TestEmitCWPStatus(t *testing.T) {
3636
tests := []struct {
3737
name string
3838
proxyConfig *configv1.Proxy
39+
infraConfig *configv1.Infrastructure
40+
apiServerURL string
3941
expectErr bool
4042
expectedError string
4143
setupMocks func(*mock_metrics.MockEmitter)
@@ -81,6 +83,65 @@ func TestEmitCWPStatus(t *testing.T) {
8183
Times(1)
8284
},
8385
},
86+
{
87+
name: "missing clusterDomain and .apps.clusterDomain in no_proxy",
88+
proxyConfig: &configv1.Proxy{
89+
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
90+
Spec: configv1.ProxySpec{
91+
NoProxy: "localhost,.svc,.cluster.local",
92+
},
93+
},
94+
infraConfig: &configv1.Infrastructure{
95+
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
96+
Status: configv1.InfrastructureStatus{
97+
APIServerInternalURL: "https://api-int.clusterDomain:6443",
98+
},
99+
},
100+
apiServerURL: "https://api.clusterDomain:6443",
101+
expectErr: false,
102+
expectedError: "",
103+
setupMocks: func(m *mock_metrics.MockEmitter) {
104+
m.EXPECT().
105+
EmitGauge("clusterWideProxy.status", int64(1), gomock.Any()).
106+
Times(1)
107+
},
108+
},
109+
{
110+
name: "CWP enabled with complete no_proxy list",
111+
proxyConfig: &configv1.Proxy{
112+
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
113+
Spec: configv1.ProxySpec{
114+
NoProxy: "localhost,127.0.0.1,.svc,.cluster.local,169.254.169.254,168.63.129.16,.apps.clusterDomain,api.clusterDomain,api-int.clusterDomain",
115+
},
116+
},
117+
infraConfig: &configv1.Infrastructure{
118+
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
119+
Status: configv1.InfrastructureStatus{
120+
APIServerInternalURL: "https://api-int.clusterDomain:6443",
121+
},
122+
},
123+
expectErr: false,
124+
setupMocks: func(m *mock_metrics.MockEmitter) {
125+
m.EXPECT().
126+
EmitGauge("clusterWideProxy.status", int64(1), gomock.Any()).
127+
Times(1)
128+
},
129+
},
130+
{
131+
name: "CWP enabled with complete with clusterDomain (not having api or api-int or .apps.clusterDomain)int no_proxy list",
132+
proxyConfig: &configv1.Proxy{
133+
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
134+
Spec: configv1.ProxySpec{
135+
NoProxy: "localhost,127.0.0.1,.svc,.cluster.local,169.254.169.254,168.63.129.16,clusterDomain",
136+
},
137+
},
138+
expectErr: false,
139+
setupMocks: func(m *mock_metrics.MockEmitter) {
140+
m.EXPECT().
141+
EmitGauge("clusterWideProxy.status", int64(1), gomock.Any()).
142+
Times(1)
143+
},
144+
},
84145
}
85146

86147
for _, tt := range tests {

0 commit comments

Comments
 (0)