Make kubectl tolerate other versions of the CSR API
Kubernetes-commit: ea6e5e53de03b791c2d30781e29ba9a0c5e0cbf6
This commit is contained in:
parent
3b8f4baf88
commit
695c3d2c06
|
|
@ -222,7 +222,7 @@ func (o *CertificateOptions) modifyCertificateCondition(builder *resource.Builde
|
|||
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
|
||||
ContinueOnError().
|
||||
FilenameParam(false, &o.FilenameOptions).
|
||||
ResourceNames("certificatesigningrequest", o.csrNames...).
|
||||
ResourceNames("certificatesigningrequests.v1beta1.certificates.k8s.io", o.csrNames...).
|
||||
RequireObject(true).
|
||||
Flatten().
|
||||
Latest().
|
||||
|
|
@ -232,7 +232,10 @@ func (o *CertificateOptions) modifyCertificateCondition(builder *resource.Builde
|
|||
return err
|
||||
}
|
||||
for i := 0; ; i++ {
|
||||
csr := info.Object.(*certificatesv1beta1.CertificateSigningRequest)
|
||||
csr, ok := info.Object.(*certificatesv1beta1.CertificateSigningRequest)
|
||||
if !ok {
|
||||
return fmt.Errorf("can only handle certificates.k8s.io/v1beta1 certificate signing requests")
|
||||
}
|
||||
csr, hasCondition := modify(csr)
|
||||
if !hasCondition || force {
|
||||
_, err = clientSet.CertificateSigningRequests().UpdateApproval(context.TODO(), csr, metav1.UpdateOptions{})
|
||||
|
|
|
|||
Loading…
Reference in New Issue