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: Show S3 snapshots in ETCDMachineSnapshot status #1088

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

yiannistri
Copy link
Contributor

@yiannistri yiannistri commented Feb 20, 2025

What this PR does / why we need it:

The ETCDSnapshotFile resources that represent S3 snapshots in downstream clusters, do not have a node/machine name in their spec, as it's always set to S3. Local snapshots on the other hand have a node name that captures the name of the RKE2 CP node that the snapshot was captured on. Because of the way that the check for the node name was done before, we would exclude any S3 snapshots from appearing in status. By moving that part of the code further down, that no longer happens.

S3 snapshot

 kubectl --kubeconfig rke2.kubeconfig get etcdsnapshotfiles.k3s.cattle.io s3-etcd-snapshot-rke2-control-plane-dxqfw-1740039301-bb47e5 -o yaml
apiVersion: k3s.cattle.io/v1
kind: ETCDSnapshotFile
metadata:
  annotations:
    etcd.rke2.cattle.io/snapshot-token-hash: ff2427fc2541
  creationTimestamp: "2025-02-20T08:15:05Z"
  finalizers:
  - wrangler.cattle.io/managed-etcd-snapshots-controller
  generation: 1
  labels:
    etcd.rke2.cattle.io/snapshot-storage-node: s3
  name: s3-etcd-snapshot-rke2-control-plane-dxqfw-1740039301-bb47e5
  resourceVersion: "4723"
  uid: d313efac-5a22-4a93-ac58-b65964b15f5e
spec:
  location: s3://etcd-snapshots-2025/etcd-snapshot-rke2-control-plane-dxqfw-1740039301
  nodeName: s3
  s3:
    bucket: etcd-snapshots-2025
    endpoint: s3.amazonaws.com
    region: eu-west-1
    skipSSLVerify: true
  snapshotName: etcd-snapshot-rke2-control-plane-dxqfw-1740039301
status:
  creationTime: "2025-02-20T08:15:01Z"
  readyToUse: true
  size: "13803552

Local snapshot

kubectl --kubeconfig rke2.kubeconfig get etcdsnapshotfiles.k3s.cattle.io local-etcd-snapshot-rke2-control-plane-dxqfw-1740039301-c4212e -o yaml
apiVersion: k3s.cattle.io/v1
kind: ETCDSnapshotFile
metadata:
  annotations:
    etcd.rke2.cattle.io/snapshot-token-hash: ff2427fc2541
  creationTimestamp: "2025-02-20T08:15:01Z"
  finalizers:
  - wrangler.cattle.io/managed-etcd-snapshots-controller
  generation: 1
  labels:
    etcd.rke2.cattle.io/snapshot-storage-node: rke2-control-plane-dxqfw
  name: local-etcd-snapshot-rke2-control-plane-dxqfw-1740039301-c4212e
  resourceVersion: "4706"
  uid: 56b3ef9c-aed6-431d-a70a-5727c0dbb71d
spec:
  location: file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-dxqfw-1740039301
  nodeName: rke2-control-plane-dxqfw
  snapshotName: etcd-snapshot-rke2-control-plane-dxqfw-1740039301
status:
  creationTime: "2025-02-20T08:15:01Z"
  readyToUse: true
  size: "13803552"

Special notes for your reviewer:

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@yiannistri yiannistri added kind/bug Something isn't working area/etcdsnapshot-restore Categorizes issue or PR as related to Turtles ETCD Snapshot & Restore feature labels Feb 20, 2025
@yiannistri yiannistri marked this pull request as ready for review February 20, 2025 09:58
@yiannistri yiannistri requested a review from a team as a code owner February 20, 2025 09:58
@yiannistri yiannistri added kind/bug Something isn't working and removed kind/bug Something isn't working labels Feb 20, 2025
@alexander-demicev alexander-demicev merged commit 1244529 into rancher:main Feb 21, 2025
14 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/etcdsnapshot-restore Categorizes issue or PR as related to Turtles ETCD Snapshot & Restore feature kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants