Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update development instructions #4471

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 14 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![Develop on Okteto](https://okteto.com/develop-okteto.svg)](https://replicated.okteto.dev/deploy?repository=https://github.com/replicatedhq/kots)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/replicatedhq/kots)

# Kubernetes Off-The-Shelf (KOTS) Software
Expand Down Expand Up @@ -62,93 +61,17 @@ cosign verify-blob --key sbom/key.pub --signature sbom/kots-sbom.tgz.sig sbom/ko

# Development

## Okteto

### Known issues

1. Kots cannot be installed through the CLI.
2. When a manifest yaml file changes, the only supported way to apply it right now is to redeploy the whole pipeline.

### Unsupported workflows

1. Deploying a vendor application for debugging. While this could work, it's unsupported, and a different cluster should be used.

### How To

#### Deploying an application to a different namespace from Kots Admin

If you need to test deploying an application to a different namespace, you'll need to first create the additional namespace in Okteto.
Your permissions will be the same between both namespaces, and you will be able to create deploy/resources there.

##### Use the Kots CLI while Kots Admin is running

1. `okteto up` - Put the the kots pod into dev mode
2. `make build run` - Runs Kots Admin
3. In a new terminal, navigate to the kots project.
4. `okteto exec bash` - Runs bash interactively in the kots pod.
5. `./bin/kots {{COMMAND}}` - Run the kots commands you need.

#### Running KOTS in Helm managed mode in Okteto
Steps to run in Helm managed mode:
1. `okteto pipeline deploy`
1. Ensure your local context is set to your okteto environment
1. Set the `IS_HELM_MANAGED` environment variable for the kots deployment `kubectl set env deployment/kotsadm IS_HELM_MANAGED=true`
1. Remove S3 endpoint: `kubectl set env deployment/kotsadm S3_ENDPOINT=""`
1. Optional:
- if you wish to use Admin Console with production: `kubectl set env deployment/kotsadm REPLICATED_API_ENDPOINT=""`
- if you wish to use Admin Console with staging: `kubectl set env deployment/kotsadm REPLICATED_API_ENDPOINT="https://staging.replicated.app"`

### Build V2 (EXPERIMENTAL)

#### Description

This new iteration of our Okteto workspace has significant changes and requires a new workflow by developers.

#### Why

We've been trying to optimize our build times and make developing on Okteto as frictionless as possible. However, we've realized that there are some fundamental issues with our current strategy, such as:

1. Builds take place in two places (buildkit, in dev containers). This causes issues with cache sharing, image size, etc.
2. Spike in resources for development containers. Some of our apps put a heavy strain on resources when built, this require us to either give them a lot of resources while in development mode (which can be long-lasting) or starve them of resources and bottleneck builds.
3. Unable to quickly/easily deploy kubernetes manifest changes.

#### Solution

This V2 work flow attempts to solve these issues by:

1. Build application only on the buildkit servers so that the cache lives in one place and image sizes stay lean. This excluded applications that have live reloading (web).
2. Only use development containers where needed. (web apps, schema hero, etc)
3. Update the Okteto manifest to the new schema which allows for separating build and deploy specs, allowing us to run `okteto deploy` and only deploy the manifest.

#### Reference

| Action | Syntax | Description |
|----------------------| ------ |------------------------------------------------------------------------------------------------------------|
| Build and Deploy | `okteto pipeline deploy -f okteto-v2.yml` | Runs both build and deploy sections of the Okteto manifest. Perfect for updating or creating a namespace. |
| Build single service | `okteto build -f okteto-v2.yml {{SERVICE_NAME}}` | Builds the named service (kotsadm, kotsadm-web, kotsadm-migrations) and pushes it to the Okteto registry. |
| Deploy | `okteto deploy -f okteto-v2.yml` | Deploys the kubernetes manifests. If there were builds before this command, the new images will be used in the deployment. |
| Development mode | `okteto up -f okteto-v2.yml` | Prompts the use for what container to put into development mode. kotsadm(api), web and migrations will appear for debugging. |

#### Warning

Because this new workflow is experimental, we still have the old workflow in the project. If you are using the new workflow, and fail to provide the `-f` flag with the v2 manifest, you will be invoking the old workflow.

#### Example workflow: kotsadm change

1. `okteto pipeline deploy -f okteto-v2.yml`
2. Make code changes to kots.
3. `okteto build -f okteto-v2.yml kotsadm`
4. `okteto deploy -f okteto-v2.yml`

#### Example workflow: kubernetes manifest change

1. `okteto pipeline deploy -f okteto-v2.yml`
2. Make manifest changes.
3. `okteto deploy -f okteto-v2.yml`

#### Example workflow: kotsadm web changes

1. `okteto pipeline deploy -f okteto-v2.yml`
2. `okteto up -f okteto-v2.yml`
3. Select kotsadm-web.
4. Make code changes to kotsadm web.
## Github Codespaces

1. Create your own [codespace](https://github.com/replicatedhq/codespace).
1. Clone the KOTS repo:
```bash
git clone [email protected]:replicatedhq/kots.git
```
1. From the root directory, run:
```bash
make cache
skaffold dev
```
1. Visit the Admin Console URL. For VS Code:
![Image 2024-02-23 at 2 55 11 PM](https://github.com/replicatedhq/kots/assets/39952863/aa86019f-0111-4d04-a142-3dfc539858a2)
Loading