Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
izturn committed Aug 26, 2024
2 parents cc402f6 + 63f5e19 commit 654e5bd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/6616-Krast76-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contour, support http and https as AppProtocol in k8s' services
9 changes: 2 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Contour Documentation

The contents of this directory have moved to [projectcontour.io](https://projectcontour.io/).
Specifically;
The contents of this directory have moved to corresponding directories in [../site/content](../site/content).

* Guides and How-to's have moved to [projectcontour.io/guides](https://projectcontour.io/guides)
* Versioned release documentation has moved to [projectcontour.io/docs](https://projectcontour.io/docs)
* Project related and non-versioned documentation has moved to [projectcontour.io/resources](https://projectcontour.io/resources/)

For more about how we're thinking of Contour's future, check out [the design docs](../design/).
For more information on how to contribute to the Contour documentation, see the [Contour Technical Documentation Contributing Guide](https://projectcontour.io/resources/contributing-docs/).
4 changes: 4 additions & 0 deletions internal/dag/accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ func validateExternalName(svc *core_v1.Service, enableExternalNameSvc bool) erro
const (
protoK8sH2C = "kubernetes.io/h2c"
protoK8sWS = "kubernetes.io/ws"
protoHTTPS = "https"
protoHTTP = "http"
)

func toContourProtocol(appProtocol string) (string, bool) {
proto, ok := map[string]string{
// *NOTE: for gateway-api: the websocket is enabled by default
protoK8sWS: "",
protoK8sH2C: "h2c",
protoHTTP: "",
protoHTTPS: "tls",
}[appProtocol]
return proto, ok
}
Expand Down
22 changes: 22 additions & 0 deletions internal/dag/accessors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ func TestBuilderLookupService(t *testing.T) {
AppProtocol: ptr.To("kubernetes.io/wss"),
Port: 8444,
},
{
Name: "iana-https",
Protocol: "TCP",
AppProtocol: ptr.To("https"),
Port: 8445,
},
{
Name: "iana-http",
Protocol: "TCP",
AppProtocol: ptr.To("http"),
Port: 8446,
},
},
},
}
Expand Down Expand Up @@ -218,6 +230,16 @@ func TestBuilderLookupService(t *testing.T) {
port: 8444,
want: appProtcolService(appProtoService, "", 1),
},
"lookup service by port number with supported IANA app protocol: https": {
NamespacedName: types.NamespacedName{Name: appProtoService.Name, Namespace: appProtoService.Namespace},
port: 8445,
want: appProtcolService(appProtoService, "tls", 2),
},
"lookup service by port number with supported IANA app protocol: http": {
NamespacedName: types.NamespacedName{Name: appProtoService.Name, Namespace: appProtoService.Namespace},
port: 8446,
want: appProtcolService(appProtoService, "", 3),
},
}

for name, tc := range tests {
Expand Down

0 comments on commit 654e5bd

Please sign in to comment.