Skip to content

Documentation - Create Cluster

This developer documentation explains how to implement the "Create Cluster" functionality in the Cluster Manager project. Developers can use this guide to understand the underlying code and components involved in allowing users to create virtual clusters within the application.

Prerequisites

Before proceeding, make sure you are familiar with the project's overall architecture, including the frontend (React.js) and backend (Python-based microservices), as well as any related services such as Keycloak for authentication.

Implementation Steps

1. User Authentication

Ensure that the user is authenticated and logged in before allowing them to create a cluster. You can leverage Keycloak or the chosen authentication mechanism for this purpose.

2. Frontend Integration

  • In the React.js frontend, create a user interface (UI) element for users to initiate cluster creation. This UI element may be a button, form, or any user-friendly component.
  • Implement the necessary form fields, such as cluster name, region selection, and host cluster choice, within the UI.

3. Backend Microservices

3.1 Cluster API (Validation and Database)

  • Develop or modify the Cluster API microservice to handle cluster creation requests.
  • Implement validation checks for user input, such as ensuring unique cluster names and verifying host cluster availability.
  • Store cluster information in the database for future reference.

3.2 Cluster Service (Kubernetes Integration)

  • Extend or modify the Cluster Service to integrate with Kubernetes.
  • Implement the logic for creating a virtual cluster within the chosen host cluster. This may involve Kubernetes API interactions, Helm charts, or other relevant tools.

4. Cluster Status and Notifications

  • Implement mechanisms to track the progress of cluster creation and notify users when the process is complete.
  • Update the UI to reflect the cluster's status (e.g., "Creating," "Active").

5. Cluster Access

  • Optionally, provide users with the ability to download the kubeconfig file for the newly created cluster.
  • Ensure that users can seamlessly access and manage the cluster using Kubernetes tools.

Testing

  • Develop unit tests and integration tests to verify the "Create Cluster" functionality's correctness and robustness.
  • Test different scenarios, including edge cases and error handling.

Conclusion

Implementing the "Create Cluster" functionality in the Cluster Manager project involves frontend and backend integration, user authentication, Kubernetes interaction, and status tracking. By following this developer documentation, you can ensure that users can create virtual clusters effectively within the application.

For advanced cluster management features, refer to the relevant sections in the developer documentation, such as editing, deleting, starting, and stopping clusters.