|
2 | 2 | [](https://goreportcard.com/report/github.com/codefresh-io/venona) |
3 | 3 | []( https://g.codefresh.io/public/accounts/codefresh-inc/pipelines/codefresh-io/venona/venona) |
4 | 4 |
|
| 5 | +## Version 1.x.x |
| 6 | +Version 1.0.0 is released now, read more about migration from older version [here](#Migration) |
| 7 | +We highly suggest to use [Codefresh official CLI](https://codefresh-io.github.io/cli/) to install the agent: |
| 8 | +```bash |
| 9 | +kubectl create namespace codefresh |
| 10 | +codefresh install agent --kube-namespace codefresh --install-runtime |
| 11 | +``` |
| 12 | + |
| 13 | +The last command will: |
| 14 | +1. Install the agent on the namespace `codefresh` |
| 15 | +2. Install the runtime on the same namespace |
| 16 | +3. Attach the runtime to the agent |
| 17 | + |
| 18 | +It is still possible, for advanced users to install all manually, for example: |
| 19 | +One process of Venona can manage multiple runtime environments |
| 20 | +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 |
| 21 | +```bash |
| 22 | +# 1. Create namespace for the agent: |
| 23 | +kubectl create namespace codefresh-agent |
| 24 | + |
| 25 | +# 2. Install the agent on the namespace ( give your agent a unique): |
| 26 | +# Print a token that the Venona process will be using. |
| 27 | +codefresh create agent $NAME |
| 28 | +codefresh install agent --token $TOKEN --kube-namespace codefresh-agent |
| 29 | + |
| 30 | +# 3. Create namespace for the first runtime: |
| 31 | +kubectl create namespace codefresh-runtime-1 |
| 32 | + |
| 33 | +# 4. Install the first runtime on the namespace |
| 34 | +# 5. the runtime name is printed |
| 35 | +codefresh install runtime --kube-namespace codefresh-runtime-1 |
| 36 | + |
| 37 | +# 6. Attach the first runtime to agent: |
| 38 | +codefresh attach runtime --agent-name $AGENT_NAME --agent-kube-namespace codefresh-agent --runtime-name $RUNTIME_NAME --kube-namespace codefresh-runtime-1 |
| 39 | + |
| 40 | +# 7. Restart the venona pod in namespace `codefresh-agent` |
| 41 | +kubectl delete pods $VENONA_POD |
| 42 | + |
| 43 | +# 8. Create namespace for the second runtime |
| 44 | +kubectl create namespace codefresh-runtime-2 |
| 45 | + |
| 46 | +# 9. Install the second runtime on the namespace |
| 47 | +codefresh install runtime --kube-namespace codefresh-runtime-2 |
| 48 | + |
| 49 | +# 10. Attach the second runtime to agent and restart the Venoa pod automatically |
| 50 | +codefresh attach runtime --agent-name $AGENT_NAME --agent-kube-namespace codefresh-agent --runtime-name $RUNTIME_NAME --runtime-kube-namespace codefresh-runtime-1 --restart-agent |
| 51 | + |
| 52 | +``` |
| 53 | + |
| 54 | +## Migration |
| 55 | +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. |
| 56 | +```bash |
| 57 | +# This script comes to migrate old versions of Venona installation ( version < 1.x.x ) to new version (version >= 1.0.0 ) |
| 58 | +# Please read carefully what the script does. |
| 59 | +# There will be a "downtime" in terms of your builds targeted to this runtime environment |
| 60 | +# Once the script is finished, all the builds during the downtime will start |
| 61 | +# The script will: |
| 62 | +# 1. Create new agent entity in Codefresh using Codefresh CLI - give it a name $CODEFRESH_AGENT_NAME, default is "codefresh" |
| 63 | +# 2. Install the agent on you cluster pass variables: |
| 64 | +# a. $VENONA_KUBE_NAMESPACE - required |
| 65 | +# b. $VENONA_KUBE_CONTEXT - default is current-context |
| 66 | +# c. $VENONA_KUBECONFIG_PATH - default is $HOME/.kube/config |
| 67 | +# 3. Attach runtime to the new agent (downtime ends) - pass $CODEFRESH_RUNTIME_NAME - required |
| 68 | +``` |
| 69 | + |
| 70 | + |
5 | 71 | ## Installation |
6 | 72 |
|
7 | 73 | ### Prerequisite: |
|
12 | 78 | * [Codefresh](https://codefresh-io.github.io/cli/) - Used to create resource in Codefresh |
13 | 79 | * Authenticated context exist under `$HOME/.cfconfig` or authenticate with [Codefesh CLI](https://codefresh-io.github.io/cli/getting-started/#authenticate) |
14 | 80 |
|
15 | | - |
16 | 81 | ### Install venona |
17 | 82 |
|
18 | 83 | * Download [venona's](https://github.com/codefresh-io/venona/releases) binary |
19 | 84 | * With homebrew: |
20 | 85 | * `brew tap codefresh-io/venona` |
21 | 86 | * `brew install venona` |
22 | | -* Create namespace where venona should run<br /> |
23 | | - > `kubectl create namespace codefresh-runtime` |
24 | | -* Create *new* runtime-environment with Venona's agents installed <br /> |
25 | | - > `venona install --kube-namespace codefresh-runtime` |
26 | | -* Get the status <br /> |
27 | | - > `venona status` |
28 | | - > `kubectl get pods -n codefresh-runtime` |
29 | | -
|
30 | | -#### Install Options |
31 | | - |
32 | | -| Option Argument | Type | Description | |
33 | | -| -------------------- | -------- | --------------------------------------------------- | |
34 | | -| --build-annotations | stringArray | The kubernetes metadata.annotations as "key=value" to be used by venona build resources (default is no node selector) | |
35 | | -| --build-node-selector | string | The kubernetes node selector "key=value" to be used by venona build resources (default is no node selector) | |
36 | | -| --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. | |
37 | | -| --dry-run | boolean | Set to true to simulate installation | |
38 | | -| -h, --help | boolean | help for install | |
39 | | -| --in-cluster | boolean | Set flag if venona is been installed from inside a cluster | |
40 | | -| --kube-context-name | string | Name of the kubernetes context on which venona should be installed (default is current-context) [$KUBE_CONTEXT] | |
41 | | -| --kube-namespace | string |Name of the namespace on which venona should be installed [$KUBE_NAMESPACE] | |
42 | | -| --kube-node-selector | string | The kubernetes node selector "key=value" to be used by venona resources (default is no node selector) | |
43 | | -| --kubernetes-runner-type | boolean | Set the runner type to kubernetes (alpha feature) | |
44 | | -| --only-runtime-environment | boolean | Set to true to onlky configure namespace as runtime-environment for Codefresh | |
45 | | -| --runtime-environment | string | if --skip-runtime-installation set, will try to configure venona on current runtime-environment | |
46 | | -| --set-default | boolean | Mark the install runtime-environment as default one after installation | |
47 | | -| --skip-runtime-installation | boolean | Set flag if you already have a configured runtime-environment, add --runtime-environment flag with name | |
48 | | -| --storage-class | string | Set a name of your custom storage class, note: this will not install volume provisioning components | |
49 | | -| --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 | |
50 | | -| --venona-version | string | Version of venona to install (default is the latest) | |
| 87 | + |
51 | 88 |
|
52 | 89 | #### Install on cluster version < 1.10 |
53 | 90 | * Make sure the `PersistentLocalVolumes` [feature gate](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) is turned on |
@@ -78,27 +115,11 @@ Each one has own RBAC needs and therefore, created roles(and cluster-roles) |
78 | 115 | The resource descriptors are avaliable [here](https://github.com/codefresh-io/venona/tree/master/venonactl/templates/kubernetes) |
79 | 116 | List of the resources that will be created |
80 | 117 | * Agent (grouped by `/.*.venona.yaml/`) |
81 | | - * `service-account.venona.yaml` - The service account that the agent's pod will use at the end |
| 118 | + * `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) |
| 119 | + * `role.re.yaml` - Allow to GET, CREATE and DELETE pods and persistentvolumeclaims |
| 120 | + * `role-binding.re.yaml` - The agent is spinning up pods and pvc, this biniding binds `role.venona.yaml` to `service-account.venona.yaml` |
82 | 121 | * `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 |
83 | | - * `role.venona.yaml` - Allow to GET, CREATE and DELETE pods and persistentvolumeclaims |
84 | | - * `role-binding.venona.yaml` - The agent is spinning up pods and pvc, this biniding binds `role.venona.yaml` to `service-account.venona.yaml` |
85 | 122 | * Runtime-environment (grouped by `/.*.re.yaml/`) Kubernetes controller that spins up all required resources to provide a good caching expirience during pipeline execution |
86 | 123 | * `service-account.dind-volume-provisioner.re.yaml` - The service account that the controller will use |
87 | 124 | * `cluster-role.dind-volume-provisioner.re.yaml` Defines all the permission needed for the controller to operate correctly |
88 | 125 | * `cluster-role-binding.dind-volume-provisioner.yaml` - Binds the ClusterRole to `service-account.dind-volume-provisioner.re.yaml` |
89 | | - |
90 | | -### Access the cluster from executed pipeline |
91 | | -After a successfull installation of Venona, you'll be able to run a Codefresh pipeline on the configured cluster. |
92 | | -However, the pipeline itself dosent have any permission to connect to the hosted cluster. |
93 | | -To make it work you need to add the cluster to Codefresh (make sure the service acount has all the permissions you need) |
94 | | -> codefresh create cluster --kube-context CONTEXT_NAME --namespace NAMESPACE --serviceaccount SERVICE_ACCOUNT --behind-firewall |
95 | | - |
96 | | -#### Upgrade |
97 | | -To upgrade existing runtime-environment, a one that was created without Venona's agent, run: |
98 | | -* Find the name of the cluster was linked to that runtime environment <br /> |
99 | | -Example: `codefresh get cluster` |
100 | | -* Install <br /> |
101 | | -Example: `venona install --cluster-name CLUSTER` |
102 | | -* Get the status <br /> |
103 | | -Example: `venona status RUNTIME-ENVIRONMENT` |
104 | | -Example: `kubectl get pods -n NAMESPACE` |
|
0 commit comments