Skip to content

Commit

Permalink
Revert 1.x.x
Browse files Browse the repository at this point in the history
* Revert "fix agent uninstall (#90)"

This reverts commit ef3b241.

Revert "replace @ char in context name (#89)"

This reverts commit 5b3684a.

Revert "fix title of steps"

This reverts commit 53a6651.

Revert "set branch name on codefresh run cmd"

This reverts commit 01bdbea.

Revert "fix agent references in test agent yaml"

This reverts commit 397cf1a.

Revert "fix agent test yaml"

This reverts commit d44a327.

Revert "Saas 5009 (#88)"

This reverts commit 70510f3.

* update version
  • Loading branch information
Oleg Sucharevich authored Feb 25, 2020
1 parent ef3b241 commit cc0331d
Show file tree
Hide file tree
Showing 59 changed files with 855 additions and 1,950 deletions.
1 change: 1 addition & 0 deletions .codefresh/codefresh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ steps:
commands:
- export VERSION=$(jq -r ".version" package.json)
- cf_export VERSION
# - export FILE_VERSION= $(cat ./venonactl/VERSION)
- cf_export FILE_VERSION=$(cat ./venonactl/VERSION)
when:
steps:
Expand Down
82 changes: 0 additions & 82 deletions .codefresh/test-agent.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rules:
semi:
- error
- always
"jest/no-disabled-tests": "error"
"jest/no-disabled-tests": "warn"
"jest/no-focused-tests": "error"
"jest/no-identical-title": "error"
"jest/prefer-to-have-length": "warn"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ telepresence.log
venonactl/dist/*
venonactl-linux
venonalog.json
.venonaconf
119 changes: 49 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,6 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/codefresh-io/venona)](https://goreportcard.com/report/github.com/codefresh-io/venona)
[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/codefresh-inc/codefresh-io%2Fvenona%2Fvenona?type=cf-1)]( https://g.codefresh.io/public/accounts/codefresh-inc/pipelines/codefresh-io/venona/venona)

## Version 1.x.x
Version 1.0.0 is released now, read more about migration from older version [here](#Migration)
We highly suggest to use [Codefresh official CLI](https://codefresh-io.github.io/cli/) to install the agent:
```bash
kubectl create namespace codefresh
codefresh install agent --kube-namespace codefresh --install-runtime
```

The last command will:
1. Install the agent on the namespace `codefresh`
2. Install the runtime on the same namespace
3. Attach the runtime to the agent

It is still possible, for advanced users to install all manually, for example:
One process of Venona can manage multiple runtime environments
NOTE: Please make sure that the process where Venona is installed there is a network connection to the clusters where the runtimes will be installed
```bash
# 1. Create namespace for the agent:
kubectl create namespace codefresh-agent

# 2. Install the agent on the namespace ( give your agent a unique):
# Print a token that the Venona process will be using.
codefresh create agent $NAME
codefresh install agent --token $TOKEN --kube-namespace codefresh-agent

# 3. Create namespace for the first runtime:
kubectl create namespace codefresh-runtime-1

# 4. Install the first runtime on the namespace
# 5. the runtime name is printed
codefresh install runtime --kube-namespace codefresh-runtime-1

# 6. Attach the first runtime to agent:
codefresh attach runtime --agent-name $AGENT_NAME --agent-kube-namespace codefresh-agent --runtime-name $RUNTIME_NAME --kube-namespace codefresh-runtime-1

# 7. Restart the venona pod in namespace `codefresh-agent`
kubectl delete pods $VENONA_POD

# 8. Create namespace for the second runtime
kubectl create namespace codefresh-runtime-2

# 9. Install the second runtime on the namespace
codefresh install runtime --kube-namespace codefresh-runtime-2

# 10. Attach the second runtime to agent and restart the Venoa pod automatically
codefresh attach runtime --agent-name $AGENT_NAME --agent-kube-namespace codefresh-agent --runtime-name $RUNTIME_NAME --runtime-kube-namespace codefresh-runtime-1 --restart-agent

```

## Migration
Migrating from Venona `< 1.x.x` to `> 1.x.x` is not done automatically, please use the [migration script](https://github.com/codefresh-io/venona/blob/master/scripts/migration.sh) to do that, check out which environment variables are required to run it.
```bash
# This script comes to migrate old versions of Venona installation ( version < 1.x.x ) to new version (version >= 1.0.0 )
# Please read carefully what the script does.
# There will be a "downtime" in terms of your builds targeted to this runtime environment
# Once the script is finished, all the builds during the downtime will start
# The script will:
# 1. Create new agent entity in Codefresh using Codefresh CLI - give it a name $CODEFRESH_AGENT_NAME, default is "codefresh"
# 2. Install the agent on you cluster pass variables:
# a. $VENONA_KUBE_NAMESPACE - required
# b. $VENONA_KUBE_CONTEXT - default is current-context
# c. $VENONA_KUBECONFIG_PATH - default is $HOME/.kube/config
# 3. Attach runtime to the new agent (downtime ends) - pass $CODEFRESH_RUNTIME_NAME - required
```


## Installation

### Prerequisite:
Expand All @@ -78,13 +12,42 @@ Migrating from Venona `< 1.x.x` to `> 1.x.x` is not done automatically, please u
* [Codefresh](https://codefresh-io.github.io/cli/) - Used to create resource in Codefresh
* Authenticated context exist under `$HOME/.cfconfig` or authenticate with [Codefesh CLI](https://codefresh-io.github.io/cli/getting-started/#authenticate)


### Install venona

* Download [venona's](https://github.com/codefresh-io/venona/releases) binary
* With homebrew:
* `brew tap codefresh-io/venona`
* `brew install venona`

* Create namespace where venona should run<br />
> `kubectl create namespace codefresh-runtime`
* Create *new* runtime-environment with Venona's agents installed <br />
> `venona install --kube-namespace codefresh-runtime`
* Get the status <br />
> `venona status`
> `kubectl get pods -n codefresh-runtime`
#### Install Options

| Option Argument | Type | Description |
| -------------------- | -------- | --------------------------------------------------- |
| --build-annotations | stringArray | The kubernetes metadata.annotations as "key=value" to be used by venona build resources (default is no node selector) |
| --build-node-selector | string | The kubernetes node selector "key=value" to be used by venona build resources (default is no node selector) |
| --cluster-name | string | cluster name (if not passed runtime-environment will be created cluster-less); this is a friendly name used for metadata does not need to match the literal cluster name. Limited to 20 Characters. |
| --dry-run | boolean | Set to true to simulate installation |
| -h, --help | boolean | help for install |
| --in-cluster | boolean | Set flag if venona is been installed from inside a cluster |
| --kube-context-name | string | Name of the kubernetes context on which venona should be installed (default is current-context) [$KUBE_CONTEXT] |
| --kube-namespace | string |Name of the namespace on which venona should be installed [$KUBE_NAMESPACE] |
| --kube-node-selector | string | The kubernetes node selector "key=value" to be used by venona resources (default is no node selector) |
| --kubernetes-runner-type | boolean | Set the runner type to kubernetes (alpha feature) |
| --only-runtime-environment | boolean | Set to true to onlky configure namespace as runtime-environment for Codefresh |
| --runtime-environment | string | if --skip-runtime-installation set, will try to configure venona on current runtime-environment |
| --set-default | boolean | Mark the install runtime-environment as default one after installation |
| --skip-runtime-installation | boolean | Set flag if you already have a configured runtime-environment, add --runtime-environment flag with name |
| --storage-class | string | Set a name of your custom storage class, note: this will not install volume provisioning components |
| --tolerations | string | The kubernetes tolerations as JSON string to be used by venona resources (default is no tolerations). If prefixed with "@", loads from a file: @/tmp/tolerations.json |
| --venona-version | string | Version of venona to install (default is the latest) |

#### Install on cluster version < 1.10
* Make sure the `PersistentLocalVolumes` [feature gate](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) is turned on
Expand Down Expand Up @@ -115,11 +78,27 @@ Each one has own RBAC needs and therefore, created roles(and cluster-roles)
The resource descriptors are avaliable [here](https://github.com/codefresh-io/venona/tree/master/venonactl/templates/kubernetes)
List of the resources that will be created
* Agent (grouped by `/.*.venona.yaml/`)
* `service-account.re.yaml` - The service account that the Venona pod will use to create the resource on the runtime namespace(the resoucre installed on the runtime namespace)
* `role.re.yaml` - Allow to GET, CREATE and DELETE pods and persistentvolumeclaims
* `role-binding.re.yaml` - The agent is spinning up pods and pvc, this biniding binds `role.venona.yaml` to `service-account.venona.yaml`
* `service-account.venona.yaml` - The service account that the agent's pod will use at the end
* `cluster-role-binding.venona.yaml` - The agent discovering K8S apis by calling to `openapi/v2`, this ClusterRoleBinding binds bootstraped ClusterRole by Kubernetes `system:discovery` to `service-account.venona.yaml`. This role has only permissions to make a GET calls to non resources urls
* `role.venona.yaml` - Allow to GET, CREATE and DELETE pods and persistentvolumeclaims
* `role-binding.venona.yaml` - The agent is spinning up pods and pvc, this biniding binds `role.venona.yaml` to `service-account.venona.yaml`
* Runtime-environment (grouped by `/.*.re.yaml/`) Kubernetes controller that spins up all required resources to provide a good caching expirience during pipeline execution
* `service-account.dind-volume-provisioner.re.yaml` - The service account that the controller will use
* `cluster-role.dind-volume-provisioner.re.yaml` Defines all the permission needed for the controller to operate correctly
* `cluster-role-binding.dind-volume-provisioner.yaml` - Binds the ClusterRole to `service-account.dind-volume-provisioner.re.yaml`

### Access the cluster from executed pipeline
After a successfull installation of Venona, you'll be able to run a Codefresh pipeline on the configured cluster.
However, the pipeline itself dosent have any permission to connect to the hosted cluster.
To make it work you need to add the cluster to Codefresh (make sure the service acount has all the permissions you need)
> codefresh create cluster --kube-context CONTEXT_NAME --namespace NAMESPACE --serviceaccount SERVICE_ACCOUNT --behind-firewall

#### Upgrade
To upgrade existing runtime-environment, a one that was created without Venona's agent, run:
* Find the name of the cluster was linked to that runtime environment <br />
Example: `codefresh get cluster`
* Install <br />
Example: `venona install --cluster-name CLUSTER`
* Get the status <br />
Example: `venona status RUNTIME-ENVIRONMENT`
Example: `kubectl get pods -n NAMESPACE`
15 changes: 0 additions & 15 deletions __mocks__/recursive-readdir.js

This file was deleted.

Loading

0 comments on commit cc0331d

Please sign in to comment.