Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2aa62506
Commit
2aa62506
authored
Aug 10, 2017
by
Nick Sardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GCE: Specify alpha in annotation key, deprecate lower case of LB type
parent
4217e10b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
gce_annotations.go
pkg/cloudprovider/providers/gce/gce_annotations.go
+19
-7
No files found.
pkg/cloudprovider/providers/gce/gce_annotations.go
View file @
2aa62506
...
...
@@ -16,7 +16,10 @@ limitations under the License.
package
gce
import
"k8s.io/api/core/v1"
import
(
"github.com/golang/glog"
"k8s.io/api/core/v1"
)
type
LoadBalancerType
string
...
...
@@ -26,12 +29,16 @@ const (
// Currently, only "internal" is supported.
ServiceAnnotationLoadBalancerType
=
"cloud.google.com/load-balancer-type"
LBTypeInternal
LoadBalancerType
=
"internal"
LBTypeInternal
LoadBalancerType
=
"Internal"
// Deprecating the lowercase spelling of Internal.
deprecatedTypeInternalLowerCase
LoadBalancerType
=
"internal"
// ServiceAnnotationInternalBackendShare is annotated on a service with "true" when users
// want to share GCP Backend Services for a set of internal load balancers.
// ALPHA feature - this may be removed in a future release.
ServiceAnnotationILBBackendShare
=
"cloud.google.com/load-balancer-backend-share"
ServiceAnnotationILBBackendShare
=
"alpha.cloud.google.com/load-balancer-backend-share"
// This annotation did not correctly specify "alpha", so both annotations will be checked.
deprecatedServiceAnnotationILBBackendShare
=
"cloud.google.com/load-balancer-backend-share"
)
// GetLoadBalancerAnnotationType returns the type of GCP load balancer which should be assembled.
...
...
@@ -48,8 +55,8 @@ func GetLoadBalancerAnnotationType(service *v1.Service) (LoadBalancerType, bool)
}
switch
v
{
case
LBTypeInternal
:
return
v
,
true
case
LBTypeInternal
,
deprecatedTypeInternalLowerCase
:
return
LBTypeInternal
,
true
default
:
return
v
,
false
}
...
...
@@ -58,8 +65,13 @@ func GetLoadBalancerAnnotationType(service *v1.Service) (LoadBalancerType, bool)
// GetLoadBalancerAnnotationBackendShare returns whether this service's backend service should be
// shared with other load balancers. Health checks and the healthcheck firewall will be shared regardless.
func
GetLoadBalancerAnnotationBackendShare
(
service
*
v1
.
Service
)
bool
{
l
,
exists
:=
service
.
Annotations
[
ServiceAnnotationILBBackendShare
]
if
exists
&&
l
==
"true"
{
if
l
,
exists
:=
service
.
Annotations
[
ServiceAnnotationILBBackendShare
];
exists
&&
l
==
"true"
{
return
true
}
// Check for deprecated annotation key
if
l
,
exists
:=
service
.
Annotations
[
deprecatedServiceAnnotationILBBackendShare
];
exists
&&
l
==
"true"
{
glog
.
Warningf
(
"Annotation %q is deprecated and replaced with an alpha-specific key: %q"
,
deprecatedServiceAnnotationILBBackendShare
,
ServiceAnnotationILBBackendShare
)
return
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment