mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
fix api
This commit is contained in:
parent
ecaf269d3c
commit
0c4df64092
@ -88,11 +88,11 @@ type Certificate struct {
|
||||
// Name of the certificate.
|
||||
Name string
|
||||
|
||||
// ExpirationDate defines certificate expiration date.
|
||||
// ExpirationDate defines certificate expiration date in UTC following the RFC3339 format.
|
||||
ExpirationDate metav1.Time
|
||||
|
||||
// ResidualTime represents the residual time before expiration.
|
||||
ResidualTime metav1.Duration
|
||||
// ResidualTimeSeconds represents the duration in seconds relative to the residual time before expiration.
|
||||
ResidualTimeSeconds int64
|
||||
|
||||
// ExternallyManaged defines if the certificate is externally managed.
|
||||
ExternallyManaged bool
|
||||
|
@ -88,11 +88,11 @@ type Certificate struct {
|
||||
// Name of the certificate.
|
||||
Name string `json:"name"`
|
||||
|
||||
// ExpirationDate defines certificate expiration date.
|
||||
// ExpirationDate defines certificate expiration date in UTC following the RFC3339 format.
|
||||
ExpirationDate metav1.Time `json:"expirationDate"`
|
||||
|
||||
// ResidualTime represents the residual time before expiration.
|
||||
ResidualTime metav1.Duration `json:"residualTime"`
|
||||
// ResidualTimeSeconds represents the duration in seconds relative to the residual time before expiration.
|
||||
ResidualTimeSeconds int64 `json:"residualTime"`
|
||||
|
||||
// ExternallyManaged defines if the certificate is externally managed.
|
||||
ExternallyManaged bool `json:"externallyManaged"`
|
||||
|
@ -132,7 +132,7 @@ func Convert_output_BootstrapToken_To_v1alpha3_BootstrapToken(in *output.Bootstr
|
||||
func autoConvert_v1alpha3_Certificate_To_output_Certificate(in *Certificate, out *output.Certificate, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.ExpirationDate = in.ExpirationDate
|
||||
out.ResidualTime = in.ResidualTime
|
||||
out.ResidualTimeSeconds = in.ResidualTimeSeconds
|
||||
out.ExternallyManaged = in.ExternallyManaged
|
||||
out.CAName = in.CAName
|
||||
out.Missing = in.Missing
|
||||
@ -147,7 +147,7 @@ func Convert_v1alpha3_Certificate_To_output_Certificate(in *Certificate, out *ou
|
||||
func autoConvert_output_Certificate_To_v1alpha3_Certificate(in *output.Certificate, out *Certificate, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.ExpirationDate = in.ExpirationDate
|
||||
out.ResidualTime = in.ResidualTime
|
||||
out.ResidualTimeSeconds = in.ResidualTimeSeconds
|
||||
out.ExternallyManaged = in.ExternallyManaged
|
||||
out.CAName = in.CAName
|
||||
out.Missing = in.Missing
|
||||
|
@ -55,7 +55,6 @@ func (in *BootstrapToken) DeepCopyObject() runtime.Object {
|
||||
func (in *Certificate) DeepCopyInto(out *Certificate) {
|
||||
*out = *in
|
||||
in.ExpirationDate.DeepCopyInto(&out.ExpirationDate)
|
||||
out.ResidualTime = in.ResidualTime
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@ func (in *BootstrapToken) DeepCopyObject() runtime.Object {
|
||||
func (in *Certificate) DeepCopyInto(out *Certificate) {
|
||||
*out = *in
|
||||
in.ExpirationDate.DeepCopyInto(&out.ExpirationDate)
|
||||
out.ResidualTime = in.ResidualTime
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
|
||||
"github.com/lithammer/dedent"
|
||||
"github.com/pkg/errors"
|
||||
@ -379,11 +380,11 @@ func fetchCertificateExpirationInfo(rm *renewal.Manager) (*outputapiv1alpha3.Cer
|
||||
return nil, err
|
||||
}
|
||||
info.Certificates = append(info.Certificates, outputapiv1alpha3.Certificate{
|
||||
Name: e.Name,
|
||||
ExpirationDate: metav1.Time{Time: e.ExpirationDate},
|
||||
ResidualTime: metav1.Duration{Duration: e.ResidualTime()},
|
||||
CAName: handler.CAName,
|
||||
ExternallyManaged: e.ExternallyManaged,
|
||||
Name: e.Name,
|
||||
ExpirationDate: metav1.Time{Time: e.ExpirationDate},
|
||||
ResidualTimeSeconds: int64(e.ResidualTime() / time.Second),
|
||||
CAName: handler.CAName,
|
||||
ExternallyManaged: e.ExternallyManaged,
|
||||
})
|
||||
} else {
|
||||
// the certificate does not exist (for any reason)
|
||||
@ -401,10 +402,10 @@ func fetchCertificateExpirationInfo(rm *renewal.Manager) (*outputapiv1alpha3.Cer
|
||||
return nil, err
|
||||
}
|
||||
info.CertificateAuthorities = append(info.CertificateAuthorities, outputapiv1alpha3.Certificate{
|
||||
Name: e.Name,
|
||||
ExpirationDate: metav1.Time{Time: e.ExpirationDate},
|
||||
ResidualTime: metav1.Duration{Duration: e.ResidualTime()},
|
||||
ExternallyManaged: e.ExternallyManaged,
|
||||
Name: e.Name,
|
||||
ExpirationDate: metav1.Time{Time: e.ExpirationDate},
|
||||
ResidualTimeSeconds: int64(e.ResidualTime() / time.Second),
|
||||
ExternallyManaged: e.ExternallyManaged,
|
||||
})
|
||||
} else {
|
||||
// the CA does not exist (for any reason)
|
||||
@ -515,7 +516,7 @@ func (p *certTextPrinter) PrintObj(obj runtime.Object, writer io.Writer) error {
|
||||
s := fmt.Sprintf("%s\t%s\t%s\t%s\t%-8v",
|
||||
cert.Name,
|
||||
cert.ExpirationDate.Format("Jan 02, 2006 15:04 MST"),
|
||||
duration.ShortHumanDuration(cert.ResidualTime.Duration),
|
||||
duration.ShortHumanDuration(time.Duration(cert.ResidualTimeSeconds)*time.Second),
|
||||
cert.CAName,
|
||||
yesNo(cert.ExternallyManaged),
|
||||
)
|
||||
@ -534,7 +535,7 @@ func (p *certTextPrinter) PrintObj(obj runtime.Object, writer io.Writer) error {
|
||||
s := fmt.Sprintf("%s\t%s\t%s\t%-8v",
|
||||
ca.Name,
|
||||
ca.ExpirationDate.Format("Jan 02, 2006 15:04 MST"),
|
||||
duration.ShortHumanDuration(ca.ResidualTime.Duration),
|
||||
duration.ShortHumanDuration(time.Duration(ca.ResidualTimeSeconds)*time.Second),
|
||||
yesNo(ca.ExternallyManaged),
|
||||
)
|
||||
fmt.Fprintln(tabw, s)
|
||||
|
Loading…
Reference in New Issue
Block a user