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

Support the restoring of issuers from backup files #70

Merged
merged 31 commits into from
Nov 25, 2022

Conversation

charlieegan3
Copy link
Contributor

This allows the loading of cert-manager issuers and cluster issuers from a jsctl backup.

For example, with a backup.yaml as follows, the output for the installation will be as seen below. Note that the warnings of other issuers are logged to stderr in the process. In this case, a GoogleCASIssuer.

 $ cat backup.yaml 
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  creationTimestamp: null
  name: cm-cluster-issuer-sample
spec:
  acme:
    email: dummy-email@example.com
    preferredChain: ""
    privateKeySecretRef:
      name: example
    server: https://
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  creationTimestamp: null
  name: cm-issuer-sample
  namespace: jetstack-secure
spec:
  ca:
    secretName: ca-key-pair
---
apiVersion: cas-issuer.jetstack.io/v1beta1
kind: GoogleCASIssuer
metadata:
  creationTimestamp: null
  name: googlecasissuer-sample
  namespace: jetstack-secure
spec:
  caPoolId: my-pool
  credentials:
    key: example
    name: googlesa
  location: us-east1
  project: example
---



$ go run main.go operator installations apply --stdout --experimental-issuers-backup-file=backup.yaml
The following issuers cannot be managed by the operator and must be restored manually: GoogleCASIssuer/googlecasissuer-sample
apiVersion: operator.jetstack.io/v1alpha1
kind: Installation
metadata:
  creationTimestamp: null
  name: installation
spec:
  approverPolicy: {}
  certManager:
    controller:
      replicas: 2
    webhook:
      replicas: 2
  issuers:
  - ca:
      secretName: ca-key-pair
    name: cm-issuer-sample
    namespace: jetstack-secure
  - acme:
      email: dummy-email@example.com
      preferredChain: ""
      privateKeySecretRef:
        name: example
      server: https://
    clusterScope: true
    name: cm-cluster-issuer-sample

Copy link
Contributor

@irbekrm irbekrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this Charlie!

I think the new flag looks good already for a first iteration. I've left a couple commands, most notably about distinguishing different issuer types that might not be backed up.
Additionally it'd be good if we printed out which issuers got restored (it kind of is obvious from Installation spec for us, but maybe not for someone less familiar with that CR).

We also don't parse any List types at all, but I think this is okay for now.

internal/command/operator/apply.go Outdated Show resolved Hide resolved
internal/command/operator/apply.go Outdated Show resolved Hide resolved
internal/command/operator/deploy.go Outdated Show resolved Hide resolved
internal/command/operator/deploy.go Outdated Show resolved Hide resolved
internal/kubernetes/restore/restore.go Outdated Show resolved Hide resolved
internal/command/operator/apply.go Outdated Show resolved Hide resolved
internal/kubernetes/restore/restore.go Outdated Show resolved Hide resolved
internal/kubernetes/restore/restore.go Outdated Show resolved Hide resolved
internal/command/operator/apply.go Outdated Show resolved Hide resolved
Copy link
Contributor

@irbekrm irbekrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Charlie, I've ran the new command and it looks good to me 👍🏼

/lgtm

@charlieegan3
Copy link
Contributor Author

Thanks for the feedback and for testing this out too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants