Skip to content

Commit

Permalink
fix(contrib): delete some useless configurations on helm (#3932)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and yesnault committed Feb 12, 2019
1 parent fa49851 commit d0fb495
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 15 deletions.
201 changes: 195 additions & 6 deletions contrib/helm/cds/README.md
Expand Up @@ -6,8 +6,10 @@ Documentation is available at https://ovh.github.io/cds/
## TL;DR;

```console
$ cd contrib/helm/cds;
helm dependency update;
cd contrib/helm/cds
# To let CDS spawn workers on your kubernetes cluster you need to copy your kubeconfig.yaml in the current directory
cp yourPathToKubeconfig.yaml kubeconfig.yaml
helm dependency update
helm install .
```

Expand Down Expand Up @@ -42,19 +44,201 @@ It starts a PostgreSQL server, a Redis server and an Elasticsearch server using
To install the chart with the release name `my-release`:

```console
$ helm install --name my-release stable/cds
# Inside of cds/contrib/helm/cds
# To let CDS spawn workers on your kubernetes cluster you need to copy your kubeconfig.yaml in the current directory
cp yourPathToKubeconfig.yaml kubeconfig.yaml
helm dependency update
helm install --name my-cds .
```

The command deploys CDS on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`
This will install all the CDS services:

```console
$ helm install .
NAME: my-cds
LAST DEPLOYED: Thu Feb 7 12:07:24 2019
NAMESPACE: cds
STATUS: DEPLOYED

RESOURCES:
==> v1/PersistentVolumeClaim
NAME AGE
my-cds-postgresql 59s
my-cds-cds-api 59s
my-cds-cds-repositories 59s

==> v1/Service
my-cds-elasticsearch-client 59s
my-cds-elasticsearch-discovery 59s
my-cds-postgresql 59s
my-cds-redis-master 59s
my-cds-redis-slave 59s
my-cds-cds-api 59s
my-cds-cds-elasticsearch 59s
my-cds-cds-hatchery-k8s 59s
my-cds-cds-hooks 58s
my-cds-cds-repositories 58s
my-cds-cds-ui 58s
my-cds-cds-vcs 58s

==> v1beta1/Deployment
my-cds-elasticsearch-client 58s
my-cds-postgresql 58s
my-cds-redis-slave 58s
my-cds-cds-api 58s
my-cds-cds-elasticsearch 58s
my-cds-cds-hatchery-k8s 58s
my-cds-cds-hooks 58s
my-cds-cds-repositories 58s
my-cds-cds-ui 58s
my-cds-cds-vcs 58s

==> v1beta1/StatefulSet
my-cds-elasticsearch-data 58s
my-cds-elasticsearch-master 58s

==> v1beta2/StatefulSet
my-cds-redis-master 58s

==> v1/Pod(related)

NAME READY STATUS RESTARTS AGE
my-cds-elasticsearch-client-5797cb88cd-bdtx4 0/1 Running 0 58s
my-cds-postgresql-554cff77b5-tb2c9 1/1 Running 0 58s
my-cds-redis-slave-544478d54c-m2mg8 0/1 Running 0 58s
my-cds-cds-api-799f8c7c55-lf4zt 0/1 CrashLoopBackOff 1 58s
my-cds-cds-elasticsearch-7d666db5bf-8gngf 1/1 Running 1 58s
my-cds-cds-hatchery-k8s-554bccb9d5-ftsrj 1/1 Running 1 58s
my-cds-cds-hooks-765d94b886-lpsss 1/1 Running 1 58s
my-cds-cds-repositories-689b5c755f-kk5t4 1/1 Running 1 58s
my-cds-cds-ui-74b78df797-76kzs 1/1 Running 0 58s
my-cds-cds-vcs-6b58d46766-4pj24 1/1 Running 1 58s
my-cds-elasticsearch-data-0 0/1 PodInitializing 0 58s
my-cds-elasticsearch-master-0 0/1 Running 0 58s
my-cds-redis-master-0 0/1 ContainerCreating 0 57s

==> v1/Secret

NAME AGE
my-cds-postgresql 59s
my-cds-cds 59s

==> v1/ConfigMap
my-cds-elasticsearch 59s
my-cds-postgresql 59s


NOTES:

************************************************************************
*** PLEASE BE PATIENT: CDS may take a few minutes to install ***
************************************************************************

1. Get the CDS URL:

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace default -w my-cds-cds-ui'

export SERVICE_IP=$(kubectl get svc --namespace default my-cds-cds-ui -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
echo http://$SERVICE_IP/

2. Create an account from the ui using your web browser

And check in the log of your api server to get registration URL :

export CDS_API_POD_NAME=$(kubectl get pods --namespace default -l "app=my-cds-cds-api" -o jsonpath="{.items[0].metadata.name}")
kubectl logs -f --namespace default $CDS_API_POD_NAME

```

And putting the URL in your browser will take you to your fresh and new CDS:

As explained in the help answer, in order to get started you have to create the first account on the browser (which will be an administrator).

And just check the logs of your CDS API to get activation URL for your account. In my case:

```console
export CDS_API_POD_NAME=$(kubectl get pods --namespace default -l "app=my-cds-cds-api" -o jsonpath="{.items[0].metadata.name}")
kubectl logs -f --namespace default $CDS_API_POD_NAME
```

After registration on UI, keep the password displayed, we will use it in next step.

In order to have all that you need to run your first job you need to add a first [worker model](https://ovh.github.io/cds/workflows/pipelines/requirements/worker-model/). It's the perfect use case to use the [CDS cli](https://ovh.github.io/cds/cli/cdsctl/) named `cdsctl`. To download this CLI and log in (please note that the version linux/amd64, darwin/amd64 and windows/amd64 use libsecret / keychain to store the CDS Password, if you don't want to use the keychain, you can select the version i386.):

```console
# on a Linux workstation:
$ curl http://$SERVICE_IP/cdsapi/download/cdsctl/linux/amd64 -o cdsctl
# on a osX workstation, it's curl http://$SERVICE_IP/cdsapi/download/cdsctl/darwin/amd64 -o cdsctl
$ chmod +x cdsctl
$ ./cdsctl login --api-url http://$SERVICE_IP/cdsapi -u yourusername
CDS API URL: http://$SERVICE_IP/cdsapi
Username: yourusername
Password:
You didn't specify config file location; /Users/yourhome/.cdsrc will be used.
Login successful
```

After you are logged you just have to add a worker model with this command:

```console
./cdsctl worker model import https://raw.githubusercontent.com/ovh/cds/master/contrib/worker-models/go-official-1.11.4-stretch.yml
```

In this case it's a worker model based on the official golang docker image coming from docker hub.

+ Import a workflow template

```console
$ ./cdsctl template push https://raw.githubusercontent.com/ovh/cds/master/contrib/workflow-templates/demo-workflow-hello-world/demo-workflow-hello-world.yml
Workflow template shared.infra/demo-workflow-hello-world has been created
Template successfully pushed !
```

+ Create a project with reference key DEMO and name FirstProject, then create your first workflow with a template:

```console
$ ./cdsctl project create DEMO FirstProject
$ ./cdsctl workflow applyTemplate
? Found one CDS project DEMO - FirstProject. Is it correct? Yes
? Choose the CDS template to apply: Demo workflow hello world (shared.infra/demo-workflow-hello-world)
? Give a valid name for the new generated workflow MyFirstWorkflow
? Push the generated workflow to the DEMO project Yes
Application MyFirstWorkflow successfully created
Application variables for MyFirstWorkflow are successfully created
Permission applied to group FirstProject to application MyFirstWorkflow
Environment MyFirstWorkflow-prod successfully created
Environment MyFirstWorkflow-dev successfully created
Environment MyFirstWorkflow-preprod successfully created
Pipeline build-1 successfully created
Pipeline deploy-1 successfully created
Pipeline it-1 successfully created
Workflow MyFirstWorkflow has been created
Workflow successfully pushed !
.cds/MyFirstWorkflow.yml
.cds/build-1.pip.yml
.cds/deploy-1.pip.yml
.cds/it-1.pip.yml
.cds/MyFirstWorkflow.app.yml
.cds/MyFirstWorkflow-dev.env.yml
.cds/MyFirstWorkflow-preprod.env.yml
.cds/MyFirstWorkflow-prod.env.yml
```

+ On CDS all actions could be done with UI, CLI or API. So you can go on your CDS UI to check your new workflow and run it.

For any further informations about CDS please check their [official documentation](https://ovh.github.io/cds/).

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
$ helm delete my-release --purge
```

The command removes all the Kubernetes components associated with the chart and deletes the release.
Expand All @@ -65,7 +249,11 @@ Please refer to default values.yaml and source code
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```console
$ helm install --name my-release .
# Inside of cds/contrib/helm/cds
# To let CDS spawn workers on your kubernetes cluster you need to copy your kubeconfig.yaml in the current directory
cp yourPathToKubeconfig.yaml kubeconfig.yaml
helm dependency update
helm install .
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
Expand All @@ -82,7 +270,7 @@ $ helm install --name my-release -f values.yaml .

+ If you use a Kubernetes as GKE, EKS or if your cloud provider provide you an available LoadBalancer you just have to set `ui.serviceType` to `LoadBalancer`.

+ If your `kubeconfig.yaml` is not located in this directory you can set path in `values.yaml` or launch with `--set kubernetesConfigFile=myPathTo/kubeconfig.yaml`.
+ Your `kubeconfig.yaml` must be located in this directory.

## Image

Expand All @@ -91,6 +279,7 @@ The `image` parameter allows specifying which image will be pulled for the chart
## Persistence

By default, cds api artifact directory is created as default PersistentVolumeClaim

### Existing PersistentVolumeClaim

1. Create the PersistentVolume
Expand Down
2 changes: 1 addition & 1 deletion contrib/helm/cds/templates/hatchery-k8s-deployment.yaml
Expand Up @@ -31,7 +31,7 @@ spec:
name: {{ template "cds.fullname" . }}
key: cds-k8s_config_file
- name: CDS_HATCHERY_KUBERNETES_NAMESPACE
value: "{{ .Values.hatchery.k8s_namespace }}"
value: "{{ .Release.Namespace }}"
- name: CDS_HATCHERY_KUBERNETES_KUBERNETESCONFIGFILE
value: kubeconfig.yml
- name: CDS_HATCHERY_KUBERNETES_COMMONCONFIGURATION_NAME
Expand Down
8 changes: 0 additions & 8 deletions contrib/helm/cds/values.yaml
Expand Up @@ -108,9 +108,6 @@ readinessProbe:
port: 8081
initialDelaySeconds: 30


kubernetesConfigFile: kubeconfig.yaml

##
## External database configuration
##
Expand Down Expand Up @@ -160,11 +157,6 @@ ingress:
# - cds.local



# hatchery kubernetes
hatchery:
k8s_namespace: default

# Ui
ui:
image:
Expand Down

0 comments on commit d0fb495

Please sign in to comment.