mirror of https://github.com/k3s-io/k3s
Remove ignoring of object not found on deletion
This is all handled properly at the caller sitespull/6/head
parent
9710da8be5
commit
8de8a6d8f2
|
@ -18,7 +18,6 @@ package gce
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
computealpha "google.golang.org/api/compute/v0.alpha"
|
computealpha "google.golang.org/api/compute/v0.alpha"
|
||||||
compute "google.golang.org/api/compute/v1"
|
compute "google.golang.org/api/compute/v1"
|
||||||
|
@ -66,11 +65,7 @@ func (gce *GCECloud) UpdateAlphaGlobalBackendService(bg *computealpha.BackendSer
|
||||||
// DeleteGlobalBackendService deletes the given BackendService by name.
|
// DeleteGlobalBackendService deletes the given BackendService by name.
|
||||||
func (gce *GCECloud) DeleteGlobalBackendService(name string) error {
|
func (gce *GCECloud) DeleteGlobalBackendService(name string) error {
|
||||||
mc := newBackendServiceMetricContext("delete", "")
|
mc := newBackendServiceMetricContext("delete", "")
|
||||||
err := gce.c.BackendServices().Delete(context.Background(), meta.GlobalKey(name))
|
return mc.Observe(gce.c.BackendServices().Delete(context.Background(), meta.GlobalKey(name)))
|
||||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return mc.Observe(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateGlobalBackendService creates the given BackendService.
|
// CreateGlobalBackendService creates the given BackendService.
|
||||||
|
@ -119,11 +114,7 @@ func (gce *GCECloud) UpdateRegionBackendService(bg *compute.BackendService, regi
|
||||||
// DeleteRegionBackendService deletes the given BackendService by name.
|
// DeleteRegionBackendService deletes the given BackendService by name.
|
||||||
func (gce *GCECloud) DeleteRegionBackendService(name, region string) error {
|
func (gce *GCECloud) DeleteRegionBackendService(name, region string) error {
|
||||||
mc := newBackendServiceMetricContext("delete", region)
|
mc := newBackendServiceMetricContext("delete", region)
|
||||||
err := gce.c.RegionBackendServices().Delete(context.Background(), meta.RegionalKey(name, region))
|
return mc.Observe(gce.c.RegionBackendServices().Delete(context.Background(), meta.RegionalKey(name, region)))
|
||||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
return mc.Observe(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateRegionBackendService creates the given BackendService.
|
// CreateRegionBackendService creates the given BackendService.
|
||||||
|
|
|
@ -18,7 +18,6 @@ package gce
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
compute "google.golang.org/api/compute/v1"
|
compute "google.golang.org/api/compute/v1"
|
||||||
|
|
||||||
|
@ -50,11 +49,7 @@ func (gce *GCECloud) CreateSslCertificate(sslCerts *compute.SslCertificate) (*co
|
||||||
// DeleteSslCertificate deletes the SslCertificate by name.
|
// DeleteSslCertificate deletes the SslCertificate by name.
|
||||||
func (gce *GCECloud) DeleteSslCertificate(name string) error {
|
func (gce *GCECloud) DeleteSslCertificate(name string) error {
|
||||||
mc := newCertMetricContext("delete")
|
mc := newCertMetricContext("delete")
|
||||||
err := gce.c.SslCertificates().Delete(context.Background(), meta.GlobalKey(name))
|
return mc.Observe(gce.c.SslCertificates().Delete(context.Background(), meta.GlobalKey(name)))
|
||||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
return mc.Observe(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSslCertificates lists all SslCertificates in the project.
|
// ListSslCertificates lists all SslCertificates in the project.
|
||||||
|
|
|
@ -18,7 +18,6 @@ package gce
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
compute "google.golang.org/api/compute/v1"
|
compute "google.golang.org/api/compute/v1"
|
||||||
|
|
||||||
|
@ -53,11 +52,7 @@ func (gce *GCECloud) SetUrlMapForTargetHttpProxy(proxy *compute.TargetHttpProxy,
|
||||||
// DeleteTargetHttpProxy deletes the TargetHttpProxy by name.
|
// DeleteTargetHttpProxy deletes the TargetHttpProxy by name.
|
||||||
func (gce *GCECloud) DeleteTargetHttpProxy(name string) error {
|
func (gce *GCECloud) DeleteTargetHttpProxy(name string) error {
|
||||||
mc := newTargetProxyMetricContext("delete")
|
mc := newTargetProxyMetricContext("delete")
|
||||||
err := gce.c.TargetHttpProxies().Delete(context.Background(), meta.GlobalKey(name))
|
return mc.Observe(gce.c.TargetHttpProxies().Delete(context.Background(), meta.GlobalKey(name)))
|
||||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
return mc.Observe(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListTargetHttpProxies lists all TargetHttpProxies in the project.
|
// ListTargetHttpProxies lists all TargetHttpProxies in the project.
|
||||||
|
@ -101,11 +96,7 @@ func (gce *GCECloud) SetSslCertificateForTargetHttpsProxy(proxy *compute.TargetH
|
||||||
// DeleteTargetHttpsProxy deletes the TargetHttpsProxy by name.
|
// DeleteTargetHttpsProxy deletes the TargetHttpsProxy by name.
|
||||||
func (gce *GCECloud) DeleteTargetHttpsProxy(name string) error {
|
func (gce *GCECloud) DeleteTargetHttpsProxy(name string) error {
|
||||||
mc := newTargetProxyMetricContext("delete")
|
mc := newTargetProxyMetricContext("delete")
|
||||||
err := gce.c.TargetHttpsProxies().Delete(context.Background(), meta.GlobalKey(name))
|
return mc.Observe(gce.c.TargetHttpsProxies().Delete(context.Background(), meta.GlobalKey(name)))
|
||||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
return mc.Observe(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListTargetHttpsProxies lists all TargetHttpsProxies in the project.
|
// ListTargetHttpsProxies lists all TargetHttpsProxies in the project.
|
||||||
|
|
|
@ -18,7 +18,6 @@ package gce
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
compute "google.golang.org/api/compute/v1"
|
compute "google.golang.org/api/compute/v1"
|
||||||
|
|
||||||
|
@ -52,11 +51,7 @@ func (gce *GCECloud) UpdateUrlMap(urlMap *compute.UrlMap) error {
|
||||||
// DeleteUrlMap deletes a url map by name.
|
// DeleteUrlMap deletes a url map by name.
|
||||||
func (gce *GCECloud) DeleteUrlMap(name string) error {
|
func (gce *GCECloud) DeleteUrlMap(name string) error {
|
||||||
mc := newUrlMapMetricContext("delete")
|
mc := newUrlMapMetricContext("delete")
|
||||||
err := gce.c.UrlMaps().Delete(context.Background(), meta.GlobalKey(name))
|
return mc.Observe(gce.c.UrlMaps().Delete(context.Background(), meta.GlobalKey(name)))
|
||||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
return mc.Observe(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListUrlMaps lists all UrlMaps in the project.
|
// ListUrlMaps lists all UrlMaps in the project.
|
||||||
|
|
Loading…
Reference in New Issue