• Kubernetes Submit Queue's avatar
    Merge pull request #39369 from CallMeFoxie/validation-hostip · 9dec47dc
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 40971, 41027, 40709, 40903, 39369)
    
    Validate unique  against HostPort/Protocol/HostIP
    
    **What this PR does / why we need it**:
    We can bind to specific IPs however validation will fail for different HostIP:HostPort combination. This is a small fix to check combination of HostPort/Protocol/HostIP rather than just HostPort/Protocol.
    
    Sample configuration
    ...
    "ports": [
                  {
                    "protocol": "TCP",
                    "containerPort": 53,
                    "hostPort": 55,
                    "hostIP": "127.0.0.1",
                    "name": "dns-local-tcp"
                  },
                  {
                    "protocol": "TCP",
                    "containerPort": 53,
                    "hostPort": 55,
                    "hostIP": "127.0.0.2",
                    "name": "dns-local-tcp2"
                  }
    ]
    
    Before:
    * spec.template.spec.containers[1].ports[2].hostPort: Duplicate value: "55/TCP"
    * spec.template.spec.containers[1].ports[3].hostPort: Duplicate value: "55/TCP"
    
    After applying the patch:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:55            0.0.0.0:*               LISTEN      3644/docker-proxy
    tcp        0      0 127.0.0.2:55            0.0.0.0:*               LISTEN      3629/docker-proxy
    
    Thanks
    Ashley
    
    **Release note**:
    
    ```release-note
    ```
    9dec47dc
Name
Last commit
Last update
..
testdata/v1 Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
doc.go Loading commit data...
events.go Loading commit data...
events_test.go Loading commit data...
schema.go Loading commit data...
schema_test.go Loading commit data...
validation.go Loading commit data...
validation_test.go Loading commit data...