Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch L7-ILB versions to Beta #835

Merged
merged 1 commit into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/backends/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ var (
// versionToFeatures stores the mapping from the required API
// version to feature names.
versionToFeatures = map[meta.Version][]string{
meta.VersionAlpha: []string{FeatureL7ILB},
meta.VersionBeta: []string{FeatureSecurityPolicy, FeatureHTTP2},
meta.VersionBeta: []string{FeatureSecurityPolicy, FeatureHTTP2, FeatureL7ILB},
}
// TODO: (shance) refactor all scope to be above the serviceport level
scopeToFeatures = map[meta.KeyType][]string{
Expand Down
48 changes: 0 additions & 48 deletions pkg/composite/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,54 +46,6 @@ func CreateKey(gceCloud *gce.Cloud, name string, scope meta.KeyType) (*meta.Key,
return nil, fmt.Errorf("invalid resource type: %s", scope)
}

// TODO: (shance) generate this
// TODO: (shance) populate scope
// TODO: (shance) figure out a more accurate way to obtain version
// ListAllUrlMaps() merges all configured List() calls into one list of composite UrlMaps
// This function combines both global and regional resources into one slice
// so users must use ScopeFromSelfLink() to determine the correct scope
// before issuing an API call.
func ListAllBackendServices(gceCloud *gce.Cloud) ([]*BackendService, error) {
resultMap := map[string]*BackendService{}
key1, err := CreateKey(gceCloud, "", meta.Global)
if err != nil {
return nil, err
}
key2, err := CreateKey(gceCloud, "", meta.Regional)
if err != nil {
return nil, err
}

// List ga-global and regional-alpha
versions := []meta.Version{meta.VersionGA, meta.VersionAlpha}
keys := []*meta.Key{key1, key2}

for i := range versions {
list, err := ListBackendServices(gceCloud, keys[i], versions[i])
if err != nil {
return nil, fmt.Errorf("error listing all urlmaps: %v", err)
}
for _, bs := range list {
resultMap[bs.SelfLink] = bs
}
}

// Convert map to slice
result := []*BackendService{}
for _, bs := range resultMap {
result = append(result, bs)
}
return result, nil
}

// IsRegionalUrlMap() returns if the url map is regional
func IsRegionalUrlMap(um *UrlMap) (bool, error) {
if um != nil {
return IsRegionalResource(um.SelfLink)
}
return false, nil
}

// IsRegionalResource() returns true if the resource URL is regional
func IsRegionalResource(selfLink string) (bool, error) {
scope, err := ScopeFromSelfLink(selfLink)
Expand Down
2 changes: 1 addition & 1 deletion pkg/healthchecks/healthchecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func TestVersion(t *testing.T) {
forILB: true,
ForNEG: true,
},
version: meta.VersionAlpha,
version: meta.VersionBeta,
},
}
for _, tc := range testCases {
Expand Down
14 changes: 7 additions & 7 deletions pkg/loadbalancers/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ var (

// All of these fields must be filled in to allow L7ILBVersions() to work
l7IlbVersions = ResourceVersions{
UrlMap: meta.VersionAlpha,
ForwardingRule: meta.VersionAlpha,
TargetHttpProxy: meta.VersionAlpha,
TargetHttpsProxy: meta.VersionAlpha,
SslCertificate: meta.VersionAlpha,
BackendService: meta.VersionAlpha,
HealthCheck: meta.VersionAlpha,
UrlMap: meta.VersionBeta,
ForwardingRule: meta.VersionBeta,
TargetHttpProxy: meta.VersionBeta,
TargetHttpsProxy: meta.VersionBeta,
SslCertificate: meta.VersionBeta,
BackendService: meta.VersionBeta,
HealthCheck: meta.VersionBeta,
}
)

Expand Down