mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 09:57:52 +00:00
generated: run refactor
This commit is contained in:
@@ -18,6 +18,7 @@ limitations under the License.
|
||||
package approver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"reflect"
|
||||
@@ -129,7 +130,7 @@ func (a *sarApprover) authorize(csr *capi.CertificateSigningRequest, rattrs auth
|
||||
ResourceAttributes: &rattrs,
|
||||
},
|
||||
}
|
||||
sar, err := a.client.AuthorizationV1().SubjectAccessReviews().Create(sar)
|
||||
sar, err := a.client.AuthorizationV1().SubjectAccessReviews().Create(context.TODO(), sar)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ limitations under the License.
|
||||
package cleaner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
@@ -108,7 +109,7 @@ func (ccc *CSRCleanerController) handle(csr *capi.CertificateSigningRequest) err
|
||||
return err
|
||||
}
|
||||
if isIssuedPastDeadline(csr) || isDeniedPastDeadline(csr) || isPendingPastDeadline(csr) || isIssuedExpired {
|
||||
if err := ccc.csrClient.Delete(csr.Name, nil); err != nil {
|
||||
if err := ccc.csrClient.Delete(context.TODO(), csr.Name, nil); err != nil {
|
||||
return fmt.Errorf("unable to delete CSR %q: %v", csr.Name, err)
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package rootcacertpublisher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
@@ -178,7 +179,7 @@ func (c *Publisher) syncNamespace(ns string) error {
|
||||
cm, err := c.cmLister.ConfigMaps(ns).Get(RootCACertConfigMapName)
|
||||
switch {
|
||||
case apierrors.IsNotFound(err):
|
||||
_, err := c.client.CoreV1().ConfigMaps(ns).Create(&v1.ConfigMap{
|
||||
_, err := c.client.CoreV1().ConfigMaps(ns).Create(context.TODO(), &v1.ConfigMap{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: RootCACertConfigMapName,
|
||||
},
|
||||
@@ -201,7 +202,7 @@ func (c *Publisher) syncNamespace(ns string) error {
|
||||
|
||||
cm.Data = data
|
||||
|
||||
_, err = c.client.CoreV1().ConfigMaps(ns).Update(cm)
|
||||
_, err = c.client.CoreV1().ConfigMaps(ns).Update(context.TODO(), cm)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ limitations under the License.
|
||||
package signer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"time"
|
||||
@@ -94,7 +95,7 @@ func (s *signer) handle(csr *capi.CertificateSigningRequest) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("error auto signing csr: %v", err)
|
||||
}
|
||||
_, err = s.client.CertificatesV1beta1().CertificateSigningRequests().UpdateStatus(csr)
|
||||
_, err = s.client.CertificatesV1beta1().CertificateSigningRequests().UpdateStatus(context.TODO(), csr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error updating signature for csr: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user