Skip to content

Conversation

@cipheraxat
Copy link

Summary

Fixes #433

This PR addresses the confusion around the registry_enabled field in Kubernetes cluster creation. The field is read-only in the API and cannot be set during cluster creation.

Problem

Users expect to be able to pass registry_enabled: True when creating a Kubernetes cluster, but this parameter is ignored because it's a read-only field in the API response.

Solution

This PR:

  1. Documents the limitation clearly in the README with a dedicated section explaining the correct approach
  2. Adds comprehensive tests demonstrating the proper workflow:
    • Integration test showing create → add_registry → verify → remove_registry flow
    • Mocked test demonstrating the same behavior

The Correct Approach

To enable container registry integration with a Kubernetes cluster:

# 1. Create the cluster (registry_enabled will be False by default)
cluster = client.kubernetes.create_cluster({
    'name': 'my-cluster',
    'region': 'ams3',
    'version': '1.32',
    'node_pools': [...]
})

# 2. Enable registry integration using add_registry
client.kubernetes.add_registry({
    'cluster_uuids': [cluster['kubernetes_cluster']['id']]
})

# 3. Verify registry is now enabled
updated_cluster = client.kubernetes.get_cluster(cluster_id)
assert updated_cluster['kubernetes_cluster']['registry_enabled'] is True

Changes

Testing

All existing tests continue to pass, and the new tests verify the correct behavior.

Fixes digitalocean#433

The registry_enabled field is read-only in Kubernetes cluster responses
and cannot be set during cluster creation. This is a limitation of the
DigitalOcean API, not the pydo client.

Changes:
- Added comprehensive documentation in README explaining the correct
  approach for enabling container registry integration
- Added integration test demonstrating the proper workflow:
  1. Create cluster (registry_enabled defaults to False)
  2. Call add_registry to enable integration
  3. Verify registry_enabled is True
  4. Call remove_registry to disable integration
  5. Verify registry_enabled is False
- Added mocked test showing the expected behavior
- Both tests reference issue digitalocean#433 for context

The correct approach is to use the add_registry operation after
cluster creation, rather than attempting to pass registry_enabled
during creation.
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.

client.kubernetes.create_cluster does not implement registry_enabled as advertised

1 participant