Skip to content

Commit

Permalink
Handle host headers in dataplane for identification of channel instan…
Browse files Browse the repository at this point in the history
  • Loading branch information
aliok authored and pierDipi committed May 12, 2022
1 parent bf1924e commit fffc6ce
Show file tree
Hide file tree
Showing 16 changed files with 593 additions and 695 deletions.
269 changes: 122 additions & 147 deletions control-plane/pkg/contract/contract.pb.go

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions control-plane/pkg/contract/log_marshaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,8 @@ func (x *Resource) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
}

func (x *Ingress) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
switch it := x.IngressType.(type) {
case *Ingress_Path:
encoder.AddString("ingress_path", it.Path)
case *Ingress_Host:
encoder.AddString("ingress_host", it.Host)
}

encoder.AddString("ingress_path", x.Path)
encoder.AddString("ingress_host", x.Host)
encoder.AddString("contentMode", x.ContentMode.String())
return nil
}
Expand Down
40 changes: 10 additions & 30 deletions control-plane/pkg/core/config/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
},
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
BootstrapServers: "broker:9092",
Expand All @@ -122,9 +120,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
Uid: "1",
Topics: []string{"topic-name-1"},
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
Egresses: []*contract.Egress{
Expand All @@ -148,9 +144,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
Uid: "2",
Topics: []string{"topic-name-1"},
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
Egresses: []*contract.Egress{
Expand Down Expand Up @@ -184,9 +178,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand Down Expand Up @@ -215,9 +207,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand All @@ -243,9 +233,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092,broker-2:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand All @@ -269,9 +257,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092,broker-2:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand Down Expand Up @@ -300,9 +286,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand All @@ -326,9 +310,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand All @@ -353,9 +335,7 @@ func TestAddOrUpdateResourcesConfig(t *testing.T) {
},
BootstrapServers: "broker:9092",
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: "/broker-ns/broker-name",
},
Path: "/broker-ns/broker-name",
ContentMode: contract.ContentMode_STRUCTURED,
},
},
Expand Down
4 changes: 1 addition & 3 deletions control-plane/pkg/reconciler/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,7 @@ func (r *Reconciler) reconcilerBrokerResource(ctx context.Context, topic string,
Uid: string(broker.UID),
Topics: []string{topic},
Ingress: &contract.Ingress{
IngressType: &contract.Ingress_Path{
Path: receiver.PathFromObject(broker),
},
Path: receiver.PathFromObject(broker),
},
BootstrapServers: config.GetBootstrapServers(),
Reference: &contract.Reference{
Expand Down

0 comments on commit fffc6ce

Please sign in to comment.