certificates.Apply returns the patched certificate

Signed-off-by: irbekrm <irbekrm@gmail.com>
This commit is contained in:
irbekrm 2022-04-28 14:41:22 +01:00
parent a221c4cce2
commit 54a487f1fb
2 changed files with 4 additions and 6 deletions

View File

@ -35,18 +35,16 @@ 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, crt *cmapi.Certificate) error {
func Apply(ctx context.Context, cl cmclient.Interface, fieldManager string, crt *cmapi.Certificate) (*cmapi.Certificate, error) {
crtData, err := serializeApply(crt)
if err != nil {
return err
return nil, err
}
_, err = cl.CertmanagerV1().Certificates(crt.Namespace).Patch(
return cl.CertmanagerV1().Certificates(crt.Namespace).Patch(
ctx, crt.Name, apitypes.ApplyPatchType, crtData,
metav1.PatchOptions{Force: pointer.Bool(true), FieldManager: fieldManager},
)
return err
}
// ApplyStatus will make a Patch API call with the given client to the

View File

@ -135,7 +135,7 @@ func SyncFnFor(
for _, crt := range updateCrts {
if utilfeature.DefaultFeatureGate.Enabled(feature.ServerSideApply) {
err = internalcertificates.Apply(ctx, cmClient, fieldManager, &cmapi.Certificate{
_, err = internalcertificates.Apply(ctx, cmClient, fieldManager, &cmapi.Certificate{
ObjectMeta: metav1.ObjectMeta{
Name: crt.Name,
Namespace: crt.Namespace,