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

activate tproxy mode even when a cluster IP is not assigned to pod #3974

Merged
merged 4 commits into from
May 8, 2024
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
3 changes: 3 additions & 0 deletions .changelog/3974.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Create Consul service with mode transparent-proxy even when a cluster IP is not assigned to the service..
```
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func (r *Controller) createServiceRegistrations(pod corev1.Pod, serviceEndpoints

if tproxyEnabled {
var k8sService corev1.Service

proxyService.Proxy.Mode = api.ProxyModeTransparent
err = r.Client.Get(r.Context, types.NamespacedName{Name: serviceEndpoints.Name, Namespace: serviceEndpoints.Namespace}, &k8sService)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -625,7 +625,6 @@ func (r *Controller) createServiceRegistrations(pod corev1.Pod, serviceEndpoints
service.TaggedAddresses = taggedAddresses
proxyService.TaggedAddresses = taggedAddresses

proxyService.Proxy.Mode = api.ProxyModeTransparent
} else {
r.Log.Info("skipping syncing service cluster IP to Consul", "name", k8sService.Name, "ns", k8sService.Namespace, "ip", k8sService.Spec.ClusterIP)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5547,7 +5547,7 @@ func TestCreateServiceRegistrations_withTransparentProxy(t *testing.T) {
},
},
},
expProxyMode: api.ProxyModeDefault,
expProxyMode: api.ProxyModeTransparent,
expTaggedAddresses: nil,
expErr: "",
},
Expand All @@ -5567,7 +5567,7 @@ func TestCreateServiceRegistrations_withTransparentProxy(t *testing.T) {
},
},
},
expProxyMode: api.ProxyModeDefault,
expProxyMode: api.ProxyModeTransparent,
expTaggedAddresses: nil,
expErr: "",
},
Expand All @@ -5588,7 +5588,7 @@ func TestCreateServiceRegistrations_withTransparentProxy(t *testing.T) {
},
},
expTaggedAddresses: nil,
expProxyMode: api.ProxyModeDefault,
expProxyMode: api.ProxyModeTransparent,
expErr: "",
},
"service with an IPv6 clusterIP": {
Expand Down
Loading