Return CR object from apply helper
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
This commit is contained in:
parent
26c26c7ce2
commit
9a04b3cb08
@ -14,6 +14,7 @@ filegroup(
|
||||
"//internal/apis/config/webhook:all-srcs",
|
||||
"//internal/apis/meta:all-srcs",
|
||||
"//internal/cainjector/feature:all-srcs",
|
||||
"//internal/controller/certificaterequests:all-srcs",
|
||||
"//internal/controller/certificates:all-srcs",
|
||||
"//internal/controller/feature:all-srcs",
|
||||
"//internal/ingress:all-srcs",
|
||||
|
||||
40
internal/controller/certificaterequests/BUILD.bazel
Normal file
40
internal/controller/certificaterequests/BUILD.bazel
Normal file
@ -0,0 +1,40 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["apply.go"],
|
||||
importpath = "github.com/cert-manager/cert-manager/internal/controller/certificaterequests",
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//pkg/apis/certmanager/v1:go_default_library",
|
||||
"//pkg/client/clientset/versioned:go_default_library",
|
||||
"@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
|
||||
"@io_k8s_apimachinery//pkg/types:go_default_library",
|
||||
"@io_k8s_utils//pointer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["apply_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//pkg/apis/certmanager/v1:go_default_library",
|
||||
"@com_github_google_gofuzz//:go_default_library",
|
||||
"@com_github_stretchr_testify//assert:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@ -35,17 +35,15 @@ import (
|
||||
// The given fieldManager is will be used as the FieldManager in
|
||||
// the Apply call.
|
||||
// Always sets Force Apply to true.
|
||||
func Apply(ctx context.Context, cl cmclient.Interface, fieldManager string, req *cmapi.CertificateRequest) error {
|
||||
func Apply(ctx context.Context, cl cmclient.Interface, fieldManager string, req *cmapi.CertificateRequest) (*cmapi.CertificateRequest, error) {
|
||||
reqData, err := serializeApplyStatus(req)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = cl.CertmanagerV1().CertificateRequests(req.Namespace).Patch(
|
||||
return cl.CertmanagerV1().CertificateRequests(req.Namespace).Patch(
|
||||
ctx, req.Name, apitypes.ApplyPatchType, reqData,
|
||||
metav1.PatchOptions{Force: pointer.Bool(true), FieldManager: fieldManager})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// ApplyStatus will make an Apply API call with the given client to the
|
||||
|
||||
29
test/integration/certificaterequests/BUILD.bazel
Normal file
29
test/integration/certificaterequests/BUILD.bazel
Normal file
@ -0,0 +1,29 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["condition_list_type_test.go"],
|
||||
deps = [
|
||||
"//pkg/apis/certmanager/v1:go_default_library",
|
||||
"//pkg/util:go_default_library",
|
||||
"//test/integration/framework:go_default_library",
|
||||
"@com_github_stretchr_testify//assert:go_default_library",
|
||||
"@io_k8s_api//core/v1:go_default_library",
|
||||
"@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
|
||||
"@io_k8s_utils//clock/testing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
Loading…
Reference in New Issue
Block a user