mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 12:03:33 +00:00
feat(dns): allow to specify http(s) ports without hostname to default to cluster domain
This commit is contained in:
+25
-33
@@ -50,6 +50,22 @@ func TestPortSpec_Validate(t *testing.T) {
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ingress mode without hostname http",
|
||||
spec: PortSpec{
|
||||
ContainerPort: 8080,
|
||||
Protocol: ProtocolHTTP,
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ingress mode without hostname https",
|
||||
spec: PortSpec{
|
||||
ContainerPort: 8080,
|
||||
Protocol: ProtocolHTTPS,
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ingress mode with hostname and http",
|
||||
spec: PortSpec{
|
||||
@@ -164,24 +180,6 @@ func TestPortSpec_Validate(t *testing.T) {
|
||||
},
|
||||
wantErr: "invalid hostname 'app': must be a valid domain name containing at least one dot",
|
||||
},
|
||||
{
|
||||
name: "missing hostname with http",
|
||||
spec: PortSpec{
|
||||
ContainerPort: 8080,
|
||||
Protocol: ProtocolHTTP,
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
wantErr: "hostname is required with 'http' or 'https' protocols",
|
||||
},
|
||||
{
|
||||
name: "missing hostname with https",
|
||||
spec: PortSpec{
|
||||
ContainerPort: 8080,
|
||||
Protocol: ProtocolHTTPS,
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
wantErr: "hostname is required with 'http' or 'https' protocols",
|
||||
},
|
||||
{
|
||||
name: "host IP in ingress mode",
|
||||
spec: PortSpec{
|
||||
@@ -468,6 +466,15 @@ func TestParsePortSpec(t *testing.T) {
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "container port http without hostname",
|
||||
port: "8080/http",
|
||||
expected: PortSpec{
|
||||
ContainerPort: 8080,
|
||||
Protocol: ProtocolHTTP,
|
||||
Mode: PortModeIngress,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "hostname and container port http",
|
||||
port: "app.example.com:8080/http",
|
||||
@@ -602,21 +609,6 @@ func TestParsePortSpec(t *testing.T) {
|
||||
port: "app.example.com:invalid:8080",
|
||||
wantErr: "invalid published port",
|
||||
},
|
||||
{
|
||||
name: "missing hostname with http",
|
||||
port: "8080/http",
|
||||
wantErr: "hostname is required",
|
||||
},
|
||||
{
|
||||
name: "missing hostname with http",
|
||||
port: "8080/https",
|
||||
wantErr: "hostname is required",
|
||||
},
|
||||
{
|
||||
name: "missing hostname with published https port",
|
||||
port: "8000:8080/https",
|
||||
wantErr: "hostname is required",
|
||||
},
|
||||
{
|
||||
name: "invalid hostname",
|
||||
port: "app:8080/http",
|
||||
|
||||
Reference in New Issue
Block a user