Create a Cluster page to add a new cluster on GKE
Description
We have a project-level service integration for Kubernetes that asks for credentials. We should make it easy to create a new cluster on Google's GKE (and automatically fill in these credentials).
Notes:
- We already have Google login with OAuth, so we'll need to figure out how to escalate the granted permissions to include cluster creation.
- Ideally, we'd support managing clusters at a group level, but we already have a project-level integration, and this is how people are going to start toying with k8s deploys, so it makes sense to start here.
- We should automatically install Prometheus, ingress, etc. but keeping that out of scope for first iteration.
Proposal
- existing k8s integration is managed only in the old Settings > Integration page (no changes)
- new cluster creation is managed in CI/CD > Cluster page
- single cluster support
- if one, show name + link to manage on GCP (no details about the cluster)
- if one, show "disable" and "soft delete" buttons (if Master)
- if none, show "create" button + requirements (if Master)
- ask to login with Google, if not yet done
- create will ask parameters, as inputbox (plus link to explanation if for free)
When creating a cluster we ask for: GCP project name (required), Cluster name (required), Cluster size, Machine type, Number of nodes, Zone, Project namespace (similar to Kubernetes integration),
- Frontend shows cluster creation form / or info form depending whether this is created or not,
- I expect to use HAML with Javascript,
- We create a new database model which holds
google_cloud_clusters
, or justclusters
, - We store all data about cluster, including a unique identifier that allows us to interact with cluster,
- We all operations for cluster creation, or status pulling of cluster do with sidekiq job (for creation), status pulling (reactive cache),
- For frontend, we provide an API for query cluster status, an API to login to Google Cloud,
We should have usage ping to track new cluster creation.
Design
Important: All copy in these designs must be reviewed by Product
If the user has not signed in with Google
If the user has not linked their Google account yet, they are shown a button to sign in with Google.
Some help text is shown on this page to let the user know about the requirements their account must meet. Links to GCP documentation are included in this section.
TO DO: Find the appropriate GCP documenation pages to link to
If authentication fails, an error banner is shown
If Google authentication is not set up on the GitLab instance, a message is shown to the user telling them to contact the administrator
Sign in | Error | OAuth not set up |
---|---|---|
After authentication succeeds
After Google authentication succeeds, a form is shown where the user can enter the necessary values for the new cluster. Similar help text to the previous page is shown here.
There is an additional line which links to our own help page on how to fill out this form.
The fields GCP project ID
, Zone
and Machine type
have links to GCP where the user can see a list of appropriate values.
TO DO: Find the appropriate GCP pages to link to.
Viewing the cluster
Once the cluster has been created, the Cluster no longer shows a creation form. It has the following elements:
- A
Enable / Disable
cluster integration switch - A
Save
button to apply the sate selected with the switch - A link to GKE so the user can manage their cluster
- The cluster's name
- A panel to remove cluster integration from the project
A banner message is shown while the cluster is being created. This banner cannot be dismissed.
The banner is replaced with a different message once cluster creation succeeds. This banner can be dismissed.
If an error occurs while creating the cluster, an error banner is shown
View cluster | Creating | Success | Error |
---|---|---|---|
Users without permissions
Users without permissions can only see cluster integration status and the cluster's name.
If cluster integration is not set up for the project, the cluster name field is not displayed.
In both cases HTML element for the switch is disabled and cannot be interacted with.
Integration not set up | Disabled | Enabled |
---|---|---|
Links / references
- Create/manage Kubernetes cluster on GKE for GitLab group: https://gitlab.com/gitlab-org/gitlab-ce/issues/27888
Documentation blurb
Overview
What is it? Why should someone use this feature? What is the underlying (business) problem? How do you use this feature?
Use cases
Who is this for? Provide one or more use cases.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml