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

Some Dev Spaces guide tweaks #68

Merged
merged 2 commits into from
May 2, 2024
Merged
Changes from 1 commit
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
29 changes: 22 additions & 7 deletions doc/openapi-openshift-dev-spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For this tutorial, we'll:
To install `kuadrantctl` in your Dev Spaces workspace, execute the following command:

```bash
curl -sL "https://github.com/kuadrant/kuadrantctl/releases/download/v0.2.0/kuadrantctl-v0.2.0-linux-amd64.tar.gz" | tar xz -C /home/user/.local/bin
curl -sL "https://github.com/kuadrant/kuadrantctl/releases/download/v0.2.2/kuadrantctl-v0.2.2-linux-amd64.tar.gz" | tar xz -C /home/user/.local/bin
Copy link
Contributor

@azgabur azgabur May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be kept in mind that in case of new release the version needs to be always updated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, will need to keep this up to date for the time being. might look at renaming the archives so they have a consistent name, so that, for instance, something like this would always work and be current:

https://github.com/kuadrant/kuadrantctl/releases/download/latest/kuadrantctl-linux-amd64.tar.gz

```

This will place `kuadrantctl` in `/home/user/.local/bin`, which is included in the container's `$PATH` by default.
Expand Down Expand Up @@ -199,10 +199,10 @@ With our extensions in place, let's use `kuadrantctl` to generate some Kubernete
- An `AuthPolicy` with a simple, static API key from a secret for the `/user/login` endpoint
- A `RateLimitPolicy` with a rate limit of 10 requests every 10 seconds for the `/store/inventory` endpoint

Open a new terminal in Dev Spaces, and run the following.
Open a new terminal in Dev Spaces (`☰` > `Terminal` > `New Terminal`), and run the following:

```bash
kuadrantctl generate gatewayapi httproute --oas openapi.yaml | yq -y
kuadrantctl generate gatewayapi httproute --oas openapi.yaml
```

Outputs:
Expand Down Expand Up @@ -256,13 +256,14 @@ status:


```bash
kuadrantctl generate kuadrant authpolicy --oas openapi.yaml | yq -y
kuadrantctl generate kuadrant authpolicy --oas openapi.yaml
```

Outputs:

```yaml
apiVersion: kuadrant.io/v1beta2
kind: AuthPolicy
metadata:
name: petstore
namespace: petstore
Expand Down Expand Up @@ -302,13 +303,14 @@ status: {}


```bash
kuadrantctl generate kuadrant ratelimitpolicy --oas openapi.yaml | yq -y
kuadrantctl generate kuadrant ratelimitpolicy --oas openapi.yaml
```

Outputs:

```yaml
apiVersion: kuadrant.io/v1beta2
kind: RateLimitPolicy
metadata:
name: petstore
namespace: petstore
Expand Down Expand Up @@ -336,7 +338,20 @@ spec:
status: {}
```

You can now apply these policies to a running app via `kubectl` or `oc`.
## Applying resources

> **Note:** by default, `oc` and `kubectl` in Dev Spaces will target the cluster running Dev Spaces. If you want to apply resources to another cluster, you will need to login with `oc` or `kubectl` to another cluster, and pass a different `--context` to these to apply resources to another cluster.

You can now apply these policies to a running app via `kubectl` or `oc`. If Dev Spaces is running on a cluster where Kuadrant is also installed, you can apply these resources:


```bash
kuadrantctl generate gateway httproute --oas openapi.yaml | kubectl apply -f -
jasonmadigan marked this conversation as resolved.
Show resolved Hide resolved
kuadrantctl generate kuadrant authpolicy --oas openapi.yaml | kubectl apply -f -
kuadrantctl generate kuadrant ratelimitpolicy --oas openapi.yaml | kubectl apply -f -
```

Alternatively, `kuadrantctl` can be used as part of a CI/CD pipeline. See the [kuadrantctl CI/CD guide](./kuadrantctl-ci-cd.md) for more details.

If you've completed the optional `git` configuration step above, you can now `git commit` the changes above and push these to your fork.

Expand All @@ -348,4 +363,4 @@ Here are some extra documentation on using `x-kuadrant` OAS extensions with `kua
- [Generating Gateway API HTTPRoutes with `kuadrantctl`](./generate-gateway-api-httproute.md)
- [Generating Kuadrant AuthPolicy with `kuadrantctl`](./generate-kuadrant-auth-policy.md)
- [Generate Kuadrant RateLimitPolicy with `kuadrantctl`](./generate-kuadrant-rate-limit-policy.md)

- [`kuadrantctl` CI/CD guide](./kuadrantctl-ci-cd.md)
Loading