Skip to content

Commit

Permalink
Adapt cluster-stack plugin based on changes made in target branch and…
Browse files Browse the repository at this point in the history
… update README

Signed-off-by: michal.gubricky <[email protected]>
  • Loading branch information
michal-gubricky committed Nov 5, 2024
1 parent f136577 commit eefc02f
Show file tree
Hide file tree
Showing 8 changed files with 383 additions and 308 deletions.
2 changes: 2 additions & 0 deletions Tests/kaas/clusterspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ clusters:
default:
branch: default
kubeconfig: kubeconfig.yaml
clouds_yaml_path: <clouds_yaml_path>
v1.29:
branch: "1.29"
kubeconfig: kubecfg129.yaml
clouds_yaml_path: <clouds_yaml_path>
v1.30:
branch: "1.30"
kubeconfig: kubecfg130.yaml
88 changes: 81 additions & 7 deletions Tests/kaas/plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

## Development environment

### requirements
### Requirements

* [docker](https://docs.docker.com/engine/install/)
* [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
* [sonobuoy](https://sonobuoy.io/docs/v0.57.1/#installation)

### setup for development
### Setup for Development

1. Generate python 3.10 env
1. **Generate python 3.10 env**

```bash
sudo apt-get install python3.10-dev
Expand All @@ -23,17 +23,91 @@

```

2. Install dependencies:
2. **Install dependencies:**

```bash
(venv) pip install pip-tools
(venv) pip-compile requirements.in
(venv) pip-sync requirements.txt
```

3. Set environment variables and launch the process:
3. **Create a Cluster**

To create a cluster, run:

```bash
(venv) export CLUSTER_PROVIDER="kind"
(venv) python run.py
(venv) python run_plugin.py create <plugin-name> ../clusterspec.yaml
```

## Setting up and running the cluster-stacks plugin

This section covers how to configure and run the `cluster-stacks` plugin to provision Kubernetes clusters and perform conformance tests.

### Requirements for cluster-stacks plugin

In addition to the core requirements, ensure the following are set up:

* An **OpenStack** environment configured and accessible.
* A `clouds.yaml` file defining OpenStack credentials and endpoints.
* An installing the envsubst via this command:
```bash
GOBIN=/tmp go install github.com/drone/envsubst/v2/cmd/envsubst@latest
```

### Environment Variables

Before running the `cluster-stacks` plugin, you need to set up the following environment variable:

- **GIT_ACCESS_TOKEN**: This token is required for Git operations, especially if your repository is private.

To set the `GIT_ACCESS_TOKEN`, run the following command in your terminal:

```bash
export GIT_ACCESS_TOKEN=<your-github-token>
```

### Configuring clusterspec.yaml file

The `clusterspec.yaml` file is used to set parameters for creating a Kubernetes cluster with the `cluster-stacks` plugin. This file allows you to specify details related to the cluster-stack, Git integration, and cluster configurations.

### Mandatory Parameter

The only mandatory parameter in `clusterspec.yaml` is `clouds_yaml_path` field, which points to the `clouds.yaml` file for OpenStack. If other parameters are omitted, the default values will be used.

### Optional Parameters

You can include additional parameters in `clusterspec.yaml` to customize the cluster setup. These optional parameters are grouped below by their category.

#### Cluster-Stack Related Parameters

These parameters configure specific settings for the cluster-stack:

```yaml
cs_name: <cs_name> # Default: "scs"
cs_k8s_version: <cs_k8s_version> # Default: "1.29"
cs_version: <cs_version> # Default: "v1"
cs_channel: <cs_channel> # Default: "stable"
cs_cloudname: <cs_cloudname> # Default: "openstack"
```

#### Git-Related Parameters

The [Cluster Stack Operator](https://github.com/sovereignCloudStack/cluster-stack-operator/) (CSO) utilizing the [Cluster Stack Provider OpenStack](https://github.com/SovereignCloudStack/cluster-stacks/tree/main/providers/openstack) (CSPO) must be directed to the Cluster Stacks repository housing releases for the OpenStack provider. Modify the following parameters if you wish to redirect CSO and CSPO to an alternative Git repository

```yaml
git_provider: <git_provider> # Default: "github"
git_org_name: <git_org_name> # Default: "SovereignCloudStack"
git_repo_name: <git_repo_name> # Default: "cluster-stacks"
```

#### Cluster Parameters

Set these parameters to customize the configuration for your cluster.

```yaml
cs_cluster_name: <cs_cluster_name> # Default: "cs-cluster"
cs_pod_cidr: <cs_pod_cidr> # Default: "192.168.0.0/16"
cs_service_cidr: <cs_service_cidr> # Default: "10.96.0.0/12"
cs_external_id: <cs_external_id> # Default: A generated UUID
cs_k8s_patch_version: <cs_k8s_patch_version> # Default: "6"
```
2 changes: 1 addition & 1 deletion Tests/kaas/plugin/clusterstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ spec:
spec:
identityRef:
kind: Secret
name: ${CS_SECRETNAME}
name: ${CS_SECRETNAME}
9 changes: 3 additions & 6 deletions Tests/kaas/plugin/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,18 @@ def _delete_cluster(self, cluster_name) -> (str, int):
pass

@final
def create(self, name="scs-cluster", version=None, kubeconfig_filepath=None):
def create(self, name="scs-cluster", version=None, kubeconfig_filepath=None, **kwargs):
"""
This method is to be called to create a k8s cluster
:param: kubernetes_version:
:return: uuid
"""
self.cluster_name = name
self.cluster_version = version
<<<<<<< HEAD
=======
self.kubeconfig_filepath = kubeconfig_filepath

try:
self._create_cluster()
>>>>>>> Add ability to remove kubeconfig
# Store any additional configuration options
self.config_options = kwargs # Store in a dictionary for later use

self._create_cluster() # TODO: maybe we do not need to use try exept here?
# try:
Expand Down
20 changes: 20 additions & 0 deletions Tests/kaas/plugin/kubeconfig-cs-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM2akNDQWRLZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJME1URXdOVEV6TURZd05Gb1hEVE0wTVRFd016RXpNVEV3TkZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBS085Cjh4eUREYmVneXJzbnB5RUdic0V0aWF4SXk4QTh5ampkS2M0WEJtVllXdFdDTGhsUXJsUk03YTJYbXFSbzlqWUkKWjVJVlJSV2lINys3dExBYUdJT25jeExJTWRTTzNBcFE5UHZMMUx6OXJNcTdiNjBVVzlGa09qSm81MzM2SDhsagpuL25GWFhqU0lodnNINkRjeVROUTdIMlhJanU1eVVqZ1F0U1NEVmRwQzRtd01DVVBlNFZJcmE1d1N0ejllSWJuCk1WcWprY2ZJdGdGYmtpRzJiUEprRXFSWDNld3NlblRoTmtMNUk5ZVk0L0tkQ0dMRzJNbGVEb0tCUEFKWGM2TUMKcUs4YjA3cTBqVUxHQ05RNXlpOUpXMVZBR0MzS2htNk4wazlYSkVOWGhtSkJDcDgvWmtTalNmMUlNWk5aRjB1MApJTCtNbkRWeEhTeG9aTXdqbzJNQ0F3RUFBYU5GTUVNd0RnWURWUjBQQVFIL0JBUURBZ0trTUJJR0ExVWRFd0VCCi93UUlNQVlCQWY4Q0FRQXdIUVlEVlIwT0JCWUVGS3c4YUd0YlV1TVdBZmoyTkFSUTJwSWlDaE1sTUEwR0NTcUcKU0liM0RRRUJDd1VBQTRJQkFRQ2V4MkJ4Z0VuNGxEem16LzR5Nis3VHJMZDBoaEhCVThaK01kN2ZXOFlaYldWSwpaVm5CRGh2N1o2akt3TFdrYVFhVGJabWJ6eG1GNjBYQ0hTUVZ2ZkJyVzlibFIyc1JuVlJySXQybHdKTUxhc2lYCkNxR21MOG40R0RObEdMemZySVVSSkFPZzB6YlFLZ0NRaTN3UGhoOHlrV1o0dTlrQnkvb29rUmFPbWxIeDUvNGkKQXgzeUprMERHNjYyTnppaGJoUDBjdm5qZ1hKRkxOby9kZUE0VEpLK2h1enliMEVER21kTTEzL3h5c24rY2xyVQowSmpzRHlxaUNZdklZWHVJcE1iYXlnL2UydmViNHh6cWFnNmxiMExzTWxYbjFrOVZmNUJVQ2lmMXhEc3dVUUd2CnRoRmdXWk5XWWpYYkdhdEg2UVplbVhtanYwSCt6SzR5b0Frd0h6WnQKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://213.131.230.24:6443
name: cs-cluster
contexts:
- context:
cluster: cs-cluster
user: cs-cluster-admin
name: cs-cluster-admin@cs-cluster
current-context: cs-cluster-admin@cs-cluster
kind: Config
preferences: {}
users:
- name: cs-cluster-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lJZTV5T2Z3c1FiRWd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRFeE1EVXhNekEyTURSYUZ3MHlOVEV4TURVeE16RXhNRFJhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQThaRGdNdjlZazRjRXpQclgKRFhjYU53dmVEcFJMSFVwNDhGOFFKZFh6ZG5PckVmVi90QjhIOFQvcU5HUVJSSXFzZ2FtU3JzRHJHRWZtKzdxTwppdU9OcGxWOFJYVlBadmx5aU5TS3IybEJOMHJIMWlrdEU3S3lOemJkemhlMU1TazVyQzJSY2tOMEQvM29BSThFClRJTHh2cXRjRVdZQktzWGRoOXdiZUJLYzZkenYwczlkWVk1Vkxjd095ejdBQTExRVhabnZYZmYxQTgreVczT2gKMUxLWDVpMFRNSHN3ZDc5ZkFORGhQRE45NG83RGVoWHdqQ0lmZGpLeVdiNUFyUVRVM0VwRG1heDZvRFhOeWdHMwppM0FjSlpLSWs5Q0RUUDM2RFB3a1luSWIxTXlWMlVzSzVsVG85RG9GRGIwbHdrZUt4UTZsNDRTa3NiRS9McjB1CnFTUHA1d0lEQVFBQm8wZ3dSakFPQmdOVkhROEJBZjhFQkFNQ0JhQXdFd1lEVlIwbEJBd3dDZ1lJS3dZQkJRVUgKQXdJd0h3WURWUjBqQkJnd0ZvQVVyRHhvYTF0UzR4WUIrUFkwQkZEYWtpSUtFeVV3RFFZSktvWklodmNOQVFFTApCUUFEZ2dFQkFIekx5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