Skip to content

Commit

Permalink
add helper for determining app protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
KauzClay committed Jan 3, 2024
1 parent a34a5c5 commit f6b7746
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/apis/networking/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const (

// ServicePortNameHTTPS is the name of the external port of the service for HTTPS
ServicePortNameHTTPS = "https"

// AppProtocolH2C is the name of the external port of the service for HTTP/2
AppProtocolH2C = "kubernetes.io/h2c"
)

// ServicePortName returns the port for the app level protocol.
Expand All @@ -55,3 +58,11 @@ func ServicePort(proto ProtocolType) int {
}
return ServiceHTTPPort
}

// AppProtocol returns the value for app level protocol based on the ProtocolType
func AppProtocol(proto ProtocolType) string {
if proto == ProtocolH2C {
return AppProtocolH2C
}
return ""
}

0 comments on commit f6b7746

Please sign in to comment.