mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 08:09:58 +00:00
behaviors: enforce behavior id must have suite id as prefix
This commit is contained in:
parent
85724cf2c3
commit
d960bf1903
@ -23,6 +23,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
@ -68,6 +69,9 @@ func ValidateSuite(suite *Suite) error {
|
|||||||
if _, ok := behaviorsByID[b.ID]; ok {
|
if _, ok := behaviorsByID[b.ID]; ok {
|
||||||
errs = append(errs, fmt.Errorf("Duplicate behavior ID: %s", b.ID))
|
errs = append(errs, fmt.Errorf("Duplicate behavior ID: %s", b.ID))
|
||||||
}
|
}
|
||||||
|
if !strings.HasPrefix(b.ID, suite.Suite) {
|
||||||
|
errs = append(errs, fmt.Errorf("Invalid behavior ID: %s, must have suite name as prefix: %s", b.ID, suite.Suite))
|
||||||
|
}
|
||||||
behaviorsByID[b.ID] = true
|
behaviorsByID[b.ID] = true
|
||||||
}
|
}
|
||||||
return utilerrors.NewAggregate(errs)
|
return utilerrors.NewAggregate(errs)
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
suite: service/spec
|
suite: service/spec
|
||||||
description: Base suite for services
|
description: Base suite for services
|
||||||
behaviors:
|
behaviors:
|
||||||
- id: service/basic-create/selector
|
- id: service/spec/selector/present-during-create
|
||||||
description: When a Service resource is created with type "ClusterIP", "NodePort", or "LoadBalancer",
|
description: When a Service resource is created with type "ClusterIP", "NodePort", or "LoadBalancer",
|
||||||
and a selector is specified, an Endpoints object is generated based with the IPs of pods with
|
and a selector is specified, an Endpoints object is generated based with the IPs of pods with
|
||||||
label keys and values matching the selector.
|
label keys and values matching the selector.
|
||||||
- id: service/basic-create/no-selector
|
- id: service/spec/selector/absent-during-create
|
||||||
description: When a Service resource is created and a no selector is specified, no changes are made
|
description: When a Service resource is created and a no selector is specified, no changes are made
|
||||||
to any corresponding Endpoints object.
|
to any corresponding Endpoints object.
|
||||||
- id: service/type/ClusterIP/empty
|
- id: service/spec/type/ClusterIP/empty
|
||||||
description: When the Service type is specified as "ClusterIP" and the clusterIP
|
description: When the Service type is specified as "ClusterIP" and the clusterIP
|
||||||
field is empty, a cluster-internal IP address for load-balancing to endpoints is
|
field is empty, a cluster-internal IP address for load-balancing to endpoints is
|
||||||
allocated.
|
allocated.
|
||||||
- id: service/type/ClusterIP/static
|
- id: service/spec/type/ClusterIP/static
|
||||||
description: When the Service type is specified as "ClusterIP" and the clusterIP
|
description: When the Service type is specified as "ClusterIP" and the clusterIP
|
||||||
field is specified as an IP address in the cluster service range, and that IP is
|
field is specified as an IP address in the cluster service range, and that IP is
|
||||||
not already assigned to another service, that IP is be allocated as a cluster-internal
|
not already assigned to another service, that IP is be allocated as a cluster-internal
|
||||||
IP address for load-balancing to endpoints.
|
IP address for load-balancing to endpoints.
|
||||||
- id: service/type/ClusterIP/None
|
- id: service/spec/type/ClusterIP/None
|
||||||
description: When the Service type is specified as "ClusterIP" and the clusterIP
|
description: When the Service type is specified as "ClusterIP" and the clusterIP
|
||||||
field is "None", no virtual IP is allocated and the endpoints are published as a
|
field is "None", no virtual IP is allocated and the endpoints are published as a
|
||||||
set of endpoints rather than a stable IP.
|
set of endpoints rather than a stable IP.
|
||||||
- id: service/type/NodePort
|
- id: service/spec/type/NodePort
|
||||||
description: When the Service type is specified as "NodePort" , a cluster-internal
|
description: When the Service type is specified as "NodePort" , a cluster-internal
|
||||||
IP address for load-balancing to endpoints is allocated as for type "ClusterIP".
|
IP address for load-balancing to endpoints is allocated as for type "ClusterIP".
|
||||||
Additionally, a cluster-wide port is allocated on every node, routing to the clusterIP.
|
Additionally, a cluster-wide port is allocated on every node, routing to the clusterIP.
|
||||||
- id: service/type/ExternalName
|
- id: service/spec/type/ExternalName
|
||||||
description: When the Service type is specified as "ExternalName", the cluster DNS provider
|
description: When the Service type is specified as "ExternalName", the cluster DNS provider
|
||||||
publishes a CNAME pointing from the service to the specified external name.
|
publishes a CNAME pointing from the service to the specified external name.
|
||||||
|
Loading…
Reference in New Issue
Block a user