Adds explicit field manager to requestsmanager controller Create call

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
This commit is contained in:
joshvanl 2022-02-07 11:04:17 +00:00
parent 2f922cf37d
commit da67eb2b65
3 changed files with 5 additions and 5 deletions

View File

@ -72,7 +72,7 @@ type controller struct {
// fieldManager is the string which will be used as the Field Manager on
// fields created or edited by the cert-manager Kubernetes client during
// Apply API calls.
// Create or Apply API calls.
fieldManager string
}
@ -395,7 +395,7 @@ func (c *controller) createNewCertificateRequest(ctx context.Context, crt *cmapi
},
}
cr, err = c.client.CertmanagerV1().CertificateRequests(cr.Namespace).Create(ctx, cr, metav1.CreateOptions{})
cr, err = c.client.CertmanagerV1().CertificateRequests(cr.Namespace).Create(ctx, cr, metav1.CreateOptions{FieldManager: c.fieldManager})
if err != nil {
c.recorder.Eventf(crt, corev1.EventTypeWarning, reasonRequestFailed, "Failed to create CertificateRequest: "+err.Error())
return err

View File

@ -69,7 +69,7 @@ func Test_Apply(t *testing.T) {
req.Annotations = nil
t.Log("creating CertificateRequest")
_, err = cmClient.CertmanagerV1().CertificateRequests(namespace).Create(ctx, req, metav1.CreateOptions{})
_, err = cmClient.CertmanagerV1().CertificateRequests(namespace).Create(ctx, req, metav1.CreateOptions{FieldManager: "cert-manager-test"})
assert.NoError(t, err)
t.Log("ensuring apply will can set annotations and labels")

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 The cert-manager Authors.
Copyright 2022 The cert-manager Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -77,7 +77,7 @@ func Test_ConditionsListType(t *testing.T) {
req.Name = name
t.Log("creating CertificateRequest")
_, err = aliceCMClient.CertmanagerV1().CertificateRequests(namespace).Create(ctx, req, metav1.CreateOptions{})
_, err = aliceCMClient.CertmanagerV1().CertificateRequests(namespace).Create(ctx, req, metav1.CreateOptions{FieldManager: "cert-manager-test"})
assert.NoError(t, err)
t.Log("ensuring alice can set Ready condition")