experimental. -> extensions.

This commit is contained in:
Chao Xu
2015-10-09 15:49:10 -07:00
parent 2816eb0f8a
commit 7c9f4cc42f
81 changed files with 839 additions and 839 deletions

View File

@@ -40,10 +40,10 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against replication controllers.
func NewREST(s storage.Interface) *REST {
store := &etcdgeneric.Etcd{
NewFunc: func() runtime.Object { return &experimental.Ingress{} },
NewFunc: func() runtime.Object { return &extensions.Ingress{} },
// NewListFunc returns an object capable of storing results of an etcd list.
NewListFunc: func() runtime.Object { return &experimental.IngressList{} },
NewListFunc: func() runtime.Object { return &extensions.IngressList{} },
// Produces a ingress that etcd understands, to the root of the resource
// by combining the namespace in the context with the given prefix
KeyRootFunc: func(ctx api.Context) string {
@@ -56,7 +56,7 @@ func NewREST(s storage.Interface) *REST {
},
// Retrieve the name field of a replication controller
ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*experimental.Ingress).Name, nil
return obj.(*extensions.Ingress).Name, nil
},
// Used to match objects based on labels/fields for list and watch
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {

View File

@@ -48,12 +48,12 @@ var (
type IngressRuleValues map[string]string
func toHTTPIngressPaths(pathMap map[string]string) []experimental.HTTPIngressPath {
httpPaths := []experimental.HTTPIngressPath{}
func toHTTPIngressPaths(pathMap map[string]string) []extensions.HTTPIngressPath {
httpPaths := []extensions.HTTPIngressPath{}
for path, backend := range pathMap {
httpPaths = append(httpPaths, experimental.HTTPIngressPath{
httpPaths = append(httpPaths, extensions.HTTPIngressPath{
Path: path,
Backend: experimental.IngressBackend{
Backend: extensions.IngressBackend{
ServiceName: backend,
ServicePort: defaultBackendPort,
},
@@ -62,13 +62,13 @@ func toHTTPIngressPaths(pathMap map[string]string) []experimental.HTTPIngressPat
return httpPaths
}
func toIngressRules(hostRules map[string]IngressRuleValues) []experimental.IngressRule {
rules := []experimental.IngressRule{}
func toIngressRules(hostRules map[string]IngressRuleValues) []extensions.IngressRule {
rules := []extensions.IngressRule{}
for host, pathMap := range hostRules {
rules = append(rules, experimental.IngressRule{
rules = append(rules, extensions.IngressRule{
Host: host,
IngressRuleValue: experimental.IngressRuleValue{
HTTP: &experimental.HTTPIngressRuleValue{
IngressRuleValue: extensions.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{
Paths: toHTTPIngressPaths(pathMap),
},
},
@@ -77,14 +77,14 @@ func toIngressRules(hostRules map[string]IngressRuleValues) []experimental.Ingre
return rules
}
func newIngress(pathMap map[string]string) *experimental.Ingress {
return &experimental.Ingress{
func newIngress(pathMap map[string]string) *extensions.Ingress {
return &extensions.Ingress{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: experimental.IngressSpec{
Backend: &experimental.IngressBackend{
Spec: extensions.IngressSpec{
Backend: &extensions.IngressBackend{
ServiceName: defaultBackendName,
ServicePort: defaultBackendPort,
},
@@ -92,7 +92,7 @@ func newIngress(pathMap map[string]string) *experimental.Ingress {
defaultHostname: pathMap,
}),
},
Status: experimental.IngressStatus{
Status: extensions.IngressStatus{
LoadBalancer: api.LoadBalancerStatus{
Ingress: []api.LoadBalancerIngress{
{IP: defaultLoadBalancer},
@@ -102,7 +102,7 @@ func newIngress(pathMap map[string]string) *experimental.Ingress {
}
}
func validIngress() *experimental.Ingress {
func validIngress() *extensions.Ingress {
return newIngress(defaultPathMap)
}
@@ -111,8 +111,8 @@ func TestCreate(t *testing.T) {
test := registrytest.New(t, fakeClient, storage.Etcd)
ingress := validIngress()
noDefaultBackendAndRules := validIngress()
noDefaultBackendAndRules.Spec.Backend = &experimental.IngressBackend{}
noDefaultBackendAndRules.Spec.Rules = []experimental.IngressRule{}
noDefaultBackendAndRules.Spec.Backend = &extensions.IngressBackend{}
noDefaultBackendAndRules.Spec.Rules = []extensions.IngressRule{}
badPath := validIngress()
badPath.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
"foo.bar.com": {"/invalid[": "svc"}})
@@ -132,7 +132,7 @@ func TestUpdate(t *testing.T) {
validIngress(),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
"bar.foo.com": {"/bar": defaultBackendName},
})
@@ -140,19 +140,19 @@ func TestUpdate(t *testing.T) {
},
// invalid updateFunc: ObjeceMeta is not to be tampered with.
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.UID = "newUID"
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.Name = ""
return object
},
func(obj runtime.Object) runtime.Object {
object := obj.(*experimental.Ingress)
object := obj.(*extensions.Ingress)
object.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
"foo.bar.com": {"/invalid[": "svc"}})
return object

View File

@@ -46,16 +46,16 @@ func (ingressStrategy) NamespaceScoped() bool {
// PrepareForCreate clears the status of an Ingress before creation.
func (ingressStrategy) PrepareForCreate(obj runtime.Object) {
ingress := obj.(*experimental.Ingress)
ingress.Status = experimental.IngressStatus{}
ingress := obj.(*extensions.Ingress)
ingress.Status = extensions.IngressStatus{}
ingress.Generation = 1
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func (ingressStrategy) PrepareForUpdate(obj, old runtime.Object) {
newIngress := obj.(*experimental.Ingress)
oldIngress := old.(*experimental.Ingress)
newIngress := obj.(*extensions.Ingress)
oldIngress := old.(*extensions.Ingress)
//TODO: Clear Ingress status once we have a sub-resource.
// Any changes to the spec increment the generation number, any changes to the
@@ -69,7 +69,7 @@ func (ingressStrategy) PrepareForUpdate(obj, old runtime.Object) {
// Validate validates a new Ingress.
func (ingressStrategy) Validate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList {
ingress := obj.(*experimental.Ingress)
ingress := obj.(*extensions.Ingress)
err := validation.ValidateIngress(ingress)
return err
}
@@ -81,8 +81,8 @@ func (ingressStrategy) AllowCreateOnUpdate() bool {
// ValidateUpdate is the default update validation for an end user.
func (ingressStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList {
validationErrorList := validation.ValidateIngress(obj.(*experimental.Ingress))
updateErrorList := validation.ValidateIngressUpdate(old.(*experimental.Ingress), obj.(*experimental.Ingress))
validationErrorList := validation.ValidateIngress(obj.(*extensions.Ingress))
updateErrorList := validation.ValidateIngressUpdate(old.(*extensions.Ingress), obj.(*extensions.Ingress))
return append(validationErrorList, updateErrorList...)
}
@@ -92,7 +92,7 @@ func (ingressStrategy) AllowUnconditionalUpdate() bool {
}
// IngressToSelectableFields returns a label set that represents the object.
func IngressToSelectableFields(ingress *experimental.Ingress) fields.Set {
func IngressToSelectableFields(ingress *extensions.Ingress) fields.Set {
return fields.Set{
"metadata.name": ingress.Name,
}
@@ -106,7 +106,7 @@ func MatchIngress(label labels.Selector, field fields.Selector) generic.Matcher
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
ingress, ok := obj.(*experimental.Ingress)
ingress, ok := obj.(*extensions.Ingress)
if !ok {
return nil, nil, fmt.Errorf("Given object is not an Ingress.")
}