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
232ebadc
Commit
232ebadc
authored
Jun 21, 2018
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add beta healthcheck in gce cloud provider
parent
3248fa2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
gce_healthchecks.go
pkg/cloudprovider/providers/gce/gce_healthchecks.go
+29
-0
No files found.
pkg/cloudprovider/providers/gce/gce_healthchecks.go
View file @
232ebadc
...
...
@@ -20,6 +20,7 @@ import (
"github.com/golang/glog"
computealpha
"google.golang.org/api/compute/v0.alpha"
computebeta
"google.golang.org/api/compute/v0.beta"
compute
"google.golang.org/api/compute/v1"
"k8s.io/api/core/v1"
...
...
@@ -173,6 +174,16 @@ func (gce *GCECloud) GetAlphaHealthCheck(name string) (*computealpha.HealthCheck
return
v
,
mc
.
Observe
(
err
)
}
// GetBetaHealthCheck returns the given beta HealthCheck by name.
func
(
gce
*
GCECloud
)
GetBetaHealthCheck
(
name
string
)
(
*
computebeta
.
HealthCheck
,
error
)
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
defer
cancel
()
mc
:=
newHealthcheckMetricContextWithVersion
(
"get"
,
computeBetaVersion
)
v
,
err
:=
gce
.
c
.
BetaHealthChecks
()
.
Get
(
ctx
,
meta
.
GlobalKey
(
name
))
return
v
,
mc
.
Observe
(
err
)
}
// UpdateHealthCheck applies the given HealthCheck as an update.
func
(
gce
*
GCECloud
)
UpdateHealthCheck
(
hc
*
compute
.
HealthCheck
)
error
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
...
...
@@ -191,6 +202,15 @@ func (gce *GCECloud) UpdateAlphaHealthCheck(hc *computealpha.HealthCheck) error
return
mc
.
Observe
(
gce
.
c
.
AlphaHealthChecks
()
.
Update
(
ctx
,
meta
.
GlobalKey
(
hc
.
Name
),
hc
))
}
// UpdateBetaHealthCheck applies the given beta HealthCheck as an update.
func
(
gce
*
GCECloud
)
UpdateBetaHealthCheck
(
hc
*
computebeta
.
HealthCheck
)
error
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
defer
cancel
()
mc
:=
newHealthcheckMetricContextWithVersion
(
"update"
,
computeBetaVersion
)
return
mc
.
Observe
(
gce
.
c
.
BetaHealthChecks
()
.
Update
(
ctx
,
meta
.
GlobalKey
(
hc
.
Name
),
hc
))
}
// DeleteHealthCheck deletes the given HealthCheck by name.
func
(
gce
*
GCECloud
)
DeleteHealthCheck
(
name
string
)
error
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
...
...
@@ -218,6 +238,15 @@ func (gce *GCECloud) CreateAlphaHealthCheck(hc *computealpha.HealthCheck) error
return
mc
.
Observe
(
gce
.
c
.
AlphaHealthChecks
()
.
Insert
(
ctx
,
meta
.
GlobalKey
(
hc
.
Name
),
hc
))
}
// CreateBetaHealthCheck creates the given beta HealthCheck.
func
(
gce
*
GCECloud
)
CreateBetaHealthCheck
(
hc
*
computebeta
.
HealthCheck
)
error
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
defer
cancel
()
mc
:=
newHealthcheckMetricContextWithVersion
(
"create"
,
computeBetaVersion
)
return
mc
.
Observe
(
gce
.
c
.
BetaHealthChecks
()
.
Insert
(
ctx
,
meta
.
GlobalKey
(
hc
.
Name
),
hc
))
}
// ListHealthChecks lists all HealthCheck in the project.
func
(
gce
*
GCECloud
)
ListHealthChecks
()
([]
*
compute
.
HealthCheck
,
error
)
{
ctx
,
cancel
:=
cloud
.
ContextWithCallTimeout
()
...
...
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