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

Fix group for VEI issuers #72

Merged
merged 3 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion internal/kubernetes/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ func FetchClusterBackup(ctx context.Context, opts ClusterBackupOptions) (*Cluste
if err != nil {
return nil, fmt.Errorf("failed to list CRDs to determine the cert-manager API version in use: %s", err)
}
policyCRDsFound := false
for _, crd := range crds.Items {
if crd.Spec.Group == v1alpha1approverpolicy.SchemeGroupVersion.Group {
policyCRDsFound = true
}
if crd.Spec.Group != "cert-manager.io" {
continue
}
Expand Down Expand Up @@ -161,7 +165,7 @@ func FetchClusterBackup(ctx context.Context, opts ClusterBackupOptions) (*Cluste
// fetch certificate request policies
// Note: this back up data is not used in the migration to an operator managed installation.
// These resourcse are only included for disaster recovery purposes.
if opts.IncludeCertificateRequestPolicies {
if policyCRDsFound && opts.IncludeCertificateRequestPolicies {
certificateRequestPolicyClient, err := clients.NewCertificateRequestPolicyClient(opts.RestConfig)
if err != nil {
return &ClusterBackup{}, fmt.Errorf("failed to create client for certificate request policies: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions internal/kubernetes/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func findIssuers(ctx context.Context, cfg *rest.Config) ([]summaryIssuer, error)
}
for _, issuer := range issuers.Items {
summaryIssuers = append(summaryIssuers, summaryIssuer{
APIVersion: kmsissuerv1alpha1.GroupVersion.String(),
APIVersion: veiv1alpha1.SchemeGroupVersion.String(),
Name: issuer.Name,
Namespace: issuer.Namespace,
Kind: issuer.Kind,
Expand All @@ -394,7 +394,7 @@ func findIssuers(ctx context.Context, cfg *rest.Config) ([]summaryIssuer, error)
}
for _, issuer := range issuers.Items {
summaryIssuers = append(summaryIssuers, summaryIssuer{
APIVersion: kmsissuerv1alpha1.GroupVersion.String(),
APIVersion: veiv1alpha1.SchemeGroupVersion.String(),
Name: issuer.Name,
Kind: issuer.Kind,
})
Expand Down