Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cert Renewal #130

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions client/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,31 @@ func (h *V1Client) UpdatePauseAgentUpgradeSettingCluster(upgradeSetting *models.
}
return nil
}

// InitiateTheCertRenewal initiates the certificate renewal process for the specified cluster.
func (h *V1Client) InitiateTheCertRenewal(clusterUID string) error {
params := clientv1.NewV1SpectroClustersCertificatesRenewParamsWithContext(h.ctx).WithUID(clusterUID)
_, err := h.Client.V1SpectroClustersCertificatesRenew(params)
if err != nil {
return fmt.Errorf("error while renewing the cluster certificates: %w", err)
}
return nil
}

// GetTheKubernetesCerts retrieves the Kubernetes certificates for the specified cluster.
func (h *V1Client) GetTheKubernetesCerts(clusterUID string) (*models.V1MachineCertificates,error) {
params := clientv1.NewV1SpectroClustersK8CertificateParamsWithContext(h.ctx).WithUID(clusterUID)
resp, err := h.Client.V1SpectroClustersK8Certificate(params)
if err != nil {
return nil,fmt.Errorf("error while getting the cluster certificates: %w", err)
}
certList := resp.GetPayload()
// Check if the list contains any machine certificates
if len(certList.MachineCertificates) == 0 {
fmt.Println("No machine certificates found.")
return nil,nil
}

return certList,nil
}

Loading