Skip to content
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 dubbod/discovery/pkg/bootstrap/inherent_xds_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ func isInherentTriplePod(pod *corev1.Pod) bool {
if pod == nil {
return false
}
if strings.EqualFold(pod.Annotations["cni.dubbo.apache.org/redirection"], "enabled") {
return true
}
for _, templateName := range strings.Split(pod.Annotations[inject.InherentInjectTemplatesAnnoName], ",") {
if strings.TrimSpace(templateName) == inject.InherentTripleTemplateName {
return true
Expand Down
1 change: 1 addition & 0 deletions manifests/charts/dubbod/files/triple-engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ metadata:
annotations:
dubbo.apache.org/rev: default
inject.dubbo.apache.org/templates: triple-engine
cni.dubbo.apache.org/redirection: enabled
spec:
volumes:
- name: dubbo-xds
Expand Down
5 changes: 4 additions & 1 deletion pkg/kube/inject/inherent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,16 @@ func assertDirectXDSConnection(t *testing.T, pod *corev1.Pod, containerName, sec
t.Fatalf("prometheus scrape annotation = %q, want true", got)
}

if got := pod.Annotations["cni.dubbo.apache.org/redirection"]; got != "enabled" {
t.Fatalf("cni redirection annotation = %q, want enabled", got)
}

for _, want := range []struct {
name string
value string
}{
{name: "XDS_ADDRESS", value: "dubbod.dubbo-system.svc:26012"},
{name: "CA_ADDRESS", value: "dubbod.dubbo-system.svc:26012"},
{name: "TRIPLE_ADDRESS", value: ""},
{name: "TRIPLE_XDS_EXPERIMENTAL_SECURITY_SUPPORT", value: "true"},
{name: "DUBBO_META_GENERATOR", value: "triple"},
{name: "DUBBO_META_CLUSTER_ID", value: "Kubernetes"},
Expand Down
17 changes: 13 additions & 4 deletions pkg/kube/inject/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,24 @@ func addApplicationContainerConfig(pod *corev1.Pod, req InjectionParameters) err
})
ensureApplicationMetricsAnnotations(pod)
}
xdsAddr := discoveryAddress
if xdsAddr == "" {
xdsAddr = "dubbod.dubbo-system.svc:26012"
}
if pod.Annotations == nil {
pod.Annotations = map[string]string{}
}
if _, exists := pod.Annotations["cni.dubbo.apache.org/redirection"]; !exists {
pod.Annotations["cni.dubbo.apache.org/redirection"] = "enabled"
}
staticEnvs := []corev1.EnvVar{
{Name: InherentTripleBootstrapEnvName, Value: InherentTripleBootstrapPath},
{Name: "XDS_ADDRESS", Value: "dubbod.dubbo-system.svc:26012"},
{Name: "CA_ADDRESS", Value: "dubbod.dubbo-system.svc:26012"},
{Name: "TRIPLE_ADDRESS", Value: ""},
{Name: "XDS_ADDRESS", Value: xdsAddr},
{Name: "CA_ADDRESS", Value: xdsAddr},
{Name: "TRIPLE_XDS_EXPERIMENTAL_SECURITY_SUPPORT", Value: "true"},
{Name: "DUBBO_META_GENERATOR", Value: "triple"},
{Name: "DUBBO_META_CLUSTER_ID", Value: "Kubernetes"},
{Name: "DUBBO_META_MESH_ID", Value: "cluster.local"},
{Name: "DUBBO_META_MESH_ID", Value: trustDomain},
{Name: "TRUST_DOMAIN", Value: trustDomain},
{
Name: "POD_NAMESPACE",
Expand Down
Loading