Skip to content

Conversation

@sasikanthmasini
Copy link

@sasikanthmasini sasikanthmasini commented Jan 30, 2026

Jira ticket link : ERA-60184

Implementation as part of the PR:

  1. Cluster Name Resolution: Requires the NDB clusters API endpoint. If not available, cluster name resolution will fail with a clear error message.
  2. Snapshot Name Resolution: Requires the source database's time machine ID. The implementation automatically fetches this when resolving snapshot names.
  3. Unique Names: This feature only works for entities that have unique names in NDB. If NDB doesn't enforce unique names, the operator cannot distinguish between entities with the same name.
  4. Backward Compatibility: Existing specs using UUIDs continue to work. The operator accepts either UUIDs or names.

###Tests
In Progress:

MongoDB Provision :

=== RUN   TestMongoProvisioningSingleInstanceTestSuite/TestTimeMachineSuccess
--- PASS: TestMongoProvisioningSingleInstanceTestSuite (1627.08s)
    --- PASS: TestMongoProvisioningSingleInstanceTestSuite/TestAppConnectivity (4.19s)
    --- PASS: TestMongoProvisioningSingleInstanceTestSuite/TestProvisioningSuccess (1.04s)
    --- PASS: TestMongoProvisioningSingleInstanceTestSuite/TestTimeMachineSuccess (1.42s)
PASS
ok      github.com/nutanix-cloud-native/ndb-operator/automation/tests/provisioning/mongo-si_test      1627.764s

MSSQL Provisioning :

        >       /Users/sasikanth.masini/.go/src/testing/testing.go:1997 +0x364
=== RUN   TestMSSQLProvisioningSingleInstanceTestSuite/TestTimeMachineSuccess
--- PASS: TestMSSQLProvisioningSingleInstanceTestSuite (1953.63s)
    --- PASS: TestMSSQLProvisioningSingleInstanceTestSuite/TestAppConnectivity (2.44s)
    --- PASS: TestMSSQLProvisioningSingleInstanceTestSuite/TestProvisioningSuccess (1.16s)
    --- PASS: TestMSSQLProvisioningSingleInstanceTestSuite/TestTimeMachineSuccess (1.33s)
PASS
ok      github.com/nutanix-cloud-native/ndb-operator/automation/tests/provisioning/mssql-si_test 1954.367s
sasikanth.masini@C39962346T ndb-operator % 

PGSI Cloning :

sasikanth.masini@C39962346T ndb-operator % make run-automation-cl
oning
Enter the test directories with spacing to run (mongo-si_test mssql-si_test mysql-si_test pg-si_test). Else all directories will be run: pg-si_test
=== RUN   TestPostgresCloningSingleInstanceTestSuite
=== RUN   TestPostgresCloningSingleInstanceTestSuite/TestAppConnectivity
=== RUN   TestPostgresCloningSingleInstanceTestSuite/TestCloningSuccess
[controller-runtime] log.SetLogger(...) was never called; logs will not be displayed.
Detected at:
        >  goroutine 189 [running]:
        >       /Users/sasikanth.masini/.go/src/testing/testing.go:1997 +0x364
--- PASS: TestPostgresCloningSingleInstanceTestSuite (455.88s)
    --- PASS: TestPostgresCloningSingleInstanceTestSuite/TestAppConnectivity (3.69s)
    --- PASS: TestPostgresCloningSingleInstanceTestSuite/TestCloningSuccess (1.04s)
PASS
ok      github.com/nutanix-cloud-native/ndb-operator/automation/tests/cloning/pg-si_test 456.644s

Mysql Cloning:

sasikanth.masini@C39962346T ndb-operator % make run-automation-cloning
Enter the test directories with spacing to run (mongo-si_test mssql-si_test mysql-si_test pg-si_test). Else all directories will be run: mysql-si_test
=== RUN   TestMySQLCloneSingleInstanceTestSuite


=== RUN   TestMySQLCloneSingleInstanceTestSuite/TestAppConnectivity
=== RUN   TestMySQLCloneSingleInstanceTestSuite/TestCloningSuccess
[controller-runtime] log.SetLogger(...) was never called; logs will not be displayed.
Detected at:
        >  goroutine 199 [running]:
        >  runtime/debug.Stack()
--- PASS: TestMySQLCloneSingleInstanceTestSuite (773.04s)
    --- PASS: TestMySQLCloneSingleInstanceTestSuite/TestAppConnectivity (12.10s)
    --- PASS: TestMySQLCloneSingleInstanceTestSuite/TestCloningSuccess (1.05s)
PASS
ok      github.com/nutanix-cloud-native/ndb-operator/automation/tests/cloning/mysql-si_test     773.799s
sasikanth.masini@C39962346T ndb-operator % 

Cloning with snapshot name and source database name using "kubectl apply -f yaml" :

Yaml File :

---
apiVersion: v1
kind: Secret
metadata:
  name: ndb-secret-clone
  namespace: default
type: Opaque
stringData:
  username: admin
  password: Nutanix.1
---
apiVersion: v1
kind: Secret
metadata:
  name: clone-db-secret
  namespace: default
type: Opaque
stringData:
  password: Nutanix.1
  ssh_public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwyAhpllp2WwrUB1aO/0/DN5nIWNXJWQ3ybhuEG4U+kHl8xFFKnPOTDQtTK8UwByoSf6wqIfTr10ESAoHySOpxHk2gyVHVmUmRZ1WFiNR5tW3Q4qbq1qKpIVy1jH9ZRoTJwzg0J33W9W8SZzhM8Nj0nwuDqp6FS8ui7q9H3tgM+9bYYxETTg52NEw7jTVQx6KaZgG+p/8armoYPKh9DGhBYGY3oCmGiOYlm/phSlj3R63qghZIsBXKxeJDEs4cLolQ+9QYoRqqusdEGVCp7Ba/GtUPdBPYdTy+xuXGiALEpsCrqyUstxypHZVJEQfmqS8uy9UB8KFg2YepwhPgX1oN noname
---
apiVersion: ndb.nutanix.com/v1alpha1
kind: NDBServer
metadata:
  name: ndb-53
  namespace: default
spec:
  credentialSecret: ndb-secret-clone
  server: https://10.102.128.53:8443/era/v0.9
  skipCertificateVerification: true
---
apiVersion: ndb.nutanix.com/v1alpha1
kind: Database
metadata:
  name: test-snapshot-fix-20260210
  namespace: default
spec:
  ndbRef: ndb-53
  isClone: true
  clone:
    name: test-snapshot-fix-20260210
    type: postgres
    description: Testing snapshot fix - should use latest snapshot cb7d85f2 (Feb 05)
    # Using NAME-based resolution on NDB 10.102.128.53
    clusterName: "auto_cluster_nested_694182877298f65764903f49"
    sourceDatabaseName: "PGSI_INS_53_fd_jan"
    snapshotName: "era_auto_snapshot"  # Should pick latest: cb7d85f2-53b0-47c1-8936-916cc5a36c7e
    credentialSecret: clone-db-secret
    timezone: UTC
    profiles: {}
    additionalArguments: {}
image

…pshot

- Add name fields (clusterName, sourceDatabaseName, snapshotName) to API types
- Make UUID fields optional when name is provided
- Add NDB API functions to resolve names to UUIDs
- Update validation to accept either UUID or name
- Integrate name resolution in controller before API calls
- Maintain backward compatibility with UUID inputs
- Add optional name fields (clusterName, sourceDatabaseName, snapshotName) to test configs
- Keep clusterId/sourceDatabaseId/snapshotId for backward compatibility
- Update test setup to support both UUID and name inputs via env vars
- Update cloning helpers to respect names if provided
- Update README documentation with name examples
- Update test expectations to match new validation messages
- Fix variable shadowing in instance_manager (err assignment)
- Tests now expect 'Either X or Y must be provided' messages
- Update RBAC role with latest controller-gen v0.18.0
- Format code with go fmt
When multiple snapshots share the same name, the operator now correctly
picks the most recent snapshot instead of the first one encountered.

Changes:
- Added SnapshotTimeStampDate field to SnapshotResponse struct
- Modified ResolveSnapshotNameToId to collect all matching snapshots,
  compare timestamps, and return the ID of the most recent one

Verified: Clone operation now uses cb7d85f2... (Feb 05) instead of
aa34c323... (Jan 23) when given snapshotName "era_auto_snapshot"

Co-authored-by: Cursor <[email protected]>
Copy link
Contributor

@shivaprasadmb shivaprasadmb left a comment

Choose a reason for hiding this comment

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

Most of the changes look good. Please check on below points:

  • image name and tag for controller
  • run go fmt (format) once for all go files.

Also please update PR description with thorough testing details done for provisioning/cloning DBs using operator logic (not automation test logic)

- name: controller
newName: ghcr.io/nutanix-cloud-native/ndb-operator/controller
newTag: v0.5.2
newName: mrshivaprasad/ndb-operator-test
Copy link
Contributor

Choose a reason for hiding this comment

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

please keep this as

  newName: ghcr.io/nutanix-cloud-native/ndb-operator/controller
  newTag: v0.5.3

because the github workflow will create a new container image using these values.

@sasikanthmasini sasikanthmasini changed the title Name based resolution ERA-60184 : Name based resolution Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants