-
Notifications
You must be signed in to change notification settings - Fork 326
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
[NET-6938] Create workloads in Consul for mesh gateway pods #3382
Changes from all commits
e3eb693
32dacd1
e9b547b
66739e7
e518860
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -150,7 +150,7 @@ func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu | |||||
|
||||||
r.Log.Info("retrieved", "name", pod.Name, "ns", pod.Namespace) | ||||||
|
||||||
if inject.HasBeenMeshInjected(pod) { | ||||||
if inject.HasBeenMeshInjected(pod) || inject.IsGateway(pod) { | ||||||
|
||||||
// It is possible the pod was scheduled but doesn't have an allocated IP yet, so safely requeue | ||||||
if pod.Status.PodIP == "" { | ||||||
|
@@ -336,9 +336,11 @@ func (r *Controller) writeWorkload(ctx context.Context, pod corev1.Pod) error { | |||||
} | ||||||
data := inject.ToProtoAny(workload) | ||||||
|
||||||
resourceID := getWorkloadID(pod.GetName(), r.getConsulNamespace(pod.Namespace), r.getPartition()) | ||||||
r.Log.Info("registering workload with Consul", getLogFieldsForResource(resourceID)...) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds helpful logging analogous to what we do elsewhere consul-k8s/control-plane/connect-inject/controllers/serviceaccount/serviceaccount_controller.go Line 112 in 2b0ef6a
consul-k8s/control-plane/connect-inject/controllers/endpointsv2/endpoints_controller.go Line 336 in 2b0ef6a
|
||||||
req := &pbresource.WriteRequest{ | ||||||
Resource: &pbresource.Resource{ | ||||||
Id: getWorkloadID(pod.GetName(), r.getConsulNamespace(pod.Namespace), r.getPartition()), | ||||||
Id: resourceID, | ||||||
Metadata: metaFromPod(pod), | ||||||
Data: data, | ||||||
}, | ||||||
|
@@ -762,3 +764,11 @@ func getDestinationsID(name, namespace, partition string) *pbresource.ID { | |||||
}, | ||||||
} | ||||||
} | ||||||
|
||||||
func getLogFieldsForResource(id *pbresource.ID) []any { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be helpful to move this out into a commonly-used package at some point but didn't do this now |
||||||
return []any{ | ||||||
"name", id.Name, | ||||||
"ns", id.Tenancy.Namespace, | ||||||
"partition", id.Tenancy.Partition, | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This utilizes a known annotation added to all v2 mesh gateway (and api/terminating in the future) pods
consul-k8s/control-plane/gateways/deployment.go
Line 65 in c8e5d9e