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

[BACKPORT][v1.6.1][BUG] Failed to restore a backup to file by the scripts/restore-backup-to-file.sh with a CIFS backup target. #8128

Closed
github-actions bot opened this issue Mar 7, 2024 · 3 comments
Assignees
Labels
kind/backport Backport request kind/bug require/backport Require backport. Only used when the specific versions to backport have not been definied. require/qa-review-coverage Require QA to review coverage
Milestone

Comments

@github-actions
Copy link

github-actions bot commented Mar 7, 2024

backport #8126

@github-actions github-actions bot added kind/backport Backport request kind/bug require/backport Require backport. Only used when the specific versions to backport have not been definied. require/qa-review-coverage Require QA to review coverage labels Mar 7, 2024
@github-actions github-actions bot added this to the v1.6.1 milestone Mar 7, 2024
@longhorn-io-github-bot
Copy link

longhorn-io-github-bot commented Mar 8, 2024

Pre Ready-For-Testing Checklist

@mantissahz mantissahz self-assigned this Mar 8, 2024
@roger-ryao roger-ryao self-assigned this Mar 13, 2024
@roger-ryao
Copy link

Verified on v1.6.1-rc1 20240314

The test steps

#8126 (comment)

  1. Deploy the CIFS service.
    kubectl create -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/backupstores/cifs-backupstore.yaml`
  2. Set Backup Target to cifs://longhorn-test-cifs-svc.default/backupstore
  3. Set Backup Target Credential Secret to cifs-secret
  4. Create a volume and backup
  5. Check which node longhorn-test-cifs-xxx-xxxx pod was applied to and confirm its IP:
    > kubectl get pod -w -owide 
    NAME                                    READY   STATUS    RESTARTS   AGE     IP             NODE                         NOMINATED NODE       READINESS GATES
    longhorn-test-cifs-6968778858-bx7n5     1/1     Running   0          28m     10.42.3.58     ryao-161-w2-50978cc1-ltj2q   <none>               <none>
    ubuntu-mountvol0                        1/1     Running   0          57m     10.42.2.50     ryao-161-w3-8b7eea2f-4d776   <none>               <none>
  6. get the backup file url
    > k -n longhorn-system get backup backup-bc3e9c2e3d3b49f4 -oyaml |grep url
    url: cifs://longhorn-test-cifs-svc.default/backupstore?backup=backup-bc3e9c2e3d3b49f4&volume=vol-0
  7. Access the node to which longhorn-test-cifs-xxx-xxxx was applied.
  8. Clone the longhorn repository git clone -b v1.6.1-rc1 https://github.com/longhorn/longhorn.git
  9. Execute the script located at longhorn/scripts
    ./restore-backup-to-file.sh --cifs-username "longhorn-cifs-username"  \
              --cifs-username "longhorn-cifs-password" \
              --backup-url "cifs://10.42.3.58/backupstore?backup=backup-bc3e9c2e3d3b49f4&volume=vol-0" \
              --output-file "volume.raw" \
              --output-format raw \
              -v v1.6.1-rc1
  10. mount volume.raw and confirm data consistency in the mount point.
    mount /tmp/restore/volume.raw /mnt
    

Result Passed

@roger-ryao
Copy link

To provide additional context
To enable access to our CIFS server via an AWS public IP, we can modify the cifs-backupstore.yaml file as follows:

diff --git a/deploy/backupstores/cifs-backupstore.yaml b/deploy/backupstores/cifs-backupstore.yaml
index 8ac586d..6739d4c 100644
--- a/deploy/backupstores/cifs-backupstore.yaml
+++ b/deploy/backupstores/cifs-backupstore.yaml
@@ -74,10 +74,13 @@ apiVersion: v1
 metadata:
   name: longhorn-test-cifs-svc
   namespace: default
+  annotations:
+    service.beta.kubernetes.io/aws-load-balancer-internal: "false" # For AWS ELB, set this to "false" for public access
 spec:
+  type: LoadBalancer  # Change this to LoadBalancer
   selector:
     app: longhorn-test-cifs
-  clusterIP: None
+#  clusterIP: None
   ports:
   - name: netbios-port
     port: 139

After applying this change, you can verify the service's external IP using the following command:

> kubectl get svc longhorn-test-cifs-svc -n default
NAME                     TYPE           CLUSTER-IP      EXTERNAL-IP                                PORT(S)                       AGE
longhorn-test-cifs-svc   LoadBalancer   10.43.111.236   34.223.148.37,52.122.15.136,54.170.247.242   139:31674/TCP,445:31087/TCP   30m

This should display a LoadBalancer service with an external IP assigned, allowing access to the CIFS server. You can then update the domain from cifs://longhorn-test-cifs-svc.default/backupstore to cifs://<external_ip>/backupstore for access using the node's public IP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/backport Backport request kind/bug require/backport Require backport. Only used when the specific versions to backport have not been definied. require/qa-review-coverage Require QA to review coverage
Projects
None yet
Development

No branches or pull requests

3 participants