Skip to content

Commit d23888f

Browse files
committed
Update docs
1 parent 942886f commit d23888f

File tree

3 files changed

+59
-59
lines changed

3 files changed

+59
-59
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
![alt gopher network](https://raw.githubusercontent.com/kubevirt-ui/kube-gateway-operator/main/docs/network-side.png)
77

8-
kube-gateway-operator installs and operate [kube-gateway](https://github.com/kubevirt-ui/kube-gateway), kube-gateway allow access k8s API using time limited access tokens, kube-gateway allow usage of one time access tokens to k8s resources.
8+
The kube-gateway-operator installs and operates the [kube-gateway](https://github.com/kubevirt-ui/kube-gateway) service, which allows access to the k8s API using time-limited access tokens and usage of one-time access tokens to access k8s resources.
99

10-
The operator manges service accounts, permisions, secrets needed for operatin of [kube-gateway](https://github.com/kubevirt-ui/kube-gateway) and JWT token generation for one time k8s API access.
10+
The operator manages service accounts, permissions, and secrets needed for the operation of the [kube-gateway](https://github.com/kubevirt-ui/kube-gateway) service and JWT token generation used for one-time k8s API access.
1111

1212
## Build and push images
1313

@@ -22,18 +22,17 @@ IMG=quay.io/$USERNAME/kube-gateway-operator:v0.0.1 make podman-push
2222
For more information about deployment options see the [deploy](/docs/deploy.md) doc.
2323

2424
```bash
25-
# Deploy the operator, RBAC roles and CRDs
25+
# Deploy the operator, RBAC roles, and CRDs
2626
export USERNAME=yaacov
2727
IMG=quay.io/$USERNAME/kube-gateway-operator:v0.0.1 make deploy
2828

29-
# Deploy from an example deployment yaml
30-
# Will use pre-defined images and permistions, users can also copy this file to local
31-
# directory and edit the container image used.
29+
# Deploy from an example deployment yaml. Will use pre-defined images and permissions.
30+
# Users can also copy this file to a local directory and edit the container image used.
3231
oc create -f https://raw.githubusercontent.com/kubevirt-ui/kube-gateway-operator/main/deploy/kube-gateway-operator.yaml
3332
```
3433

3534
```bash
36-
# Remove deployment of the operator, RBAC roles and CRDs
35+
# Remove deployment of the operator, RBAC roles, and CRDs
3736
export USERNAME=yaacov
3837
IMG=quay.io/$USERNAME/kube-gateway-operator:v0.0.1 make undeploy
3938
```
@@ -48,13 +47,13 @@ For more information about running the gateway proxy and generating a token see
4847
# Use the kube-gateway namespace
4948
oc create namespace kube-gateway
5049

51-
# create a sample gateway server
50+
# Create a sample gateway server
5251
oc create -f config/samples/kubegateway_v1beta1_gateserver.yaml
5352

54-
# create a sample token request
53+
# Create a sample token request
5554
oc create -f config/samples/kubegateway_v1beta1_gatetoken.yaml
5655

57-
# check the token
56+
# Check the token
5857
oc get gatetoken gatetoken-sample -o yaml
5958
```
6059
Example files:
@@ -66,10 +65,10 @@ Example files:
6665
## Building for local development
6766

6867
```bash
69-
# Compile operator
68+
# Compile the operator
7069
make
7170

72-
# Install CRD on cluser for running loaclly
71+
# Install CRDs on the cluster for running locally
7372
make install
7473
# make uninstall
7574

docs/deploy.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
# Deploy
22

3-
## Deploy using the example deployment
3+
## Deploy using the example deployment file
44

5-
The example deployment, use images from `quay.io/kubevirt-ui` and `gcr.io/kubebuilder`
5+
The example deployment file use images from `quay.io/kubevirt-ui` and `gcr.io/kubebuilder`.
66
If your installation is connected to the internet and you do not intend to customize the images,
7-
Deployment using the example deployment file can be a good option.
7+
deployment using the example deployment file can be a good option.
88

99
```bash
1010
oc create -f https://raw.githubusercontent.com/kubevirt-ui/kube-gateway-operator/main/deploy/kube-gateway-operator.yaml
1111
```
1212

13-
## Deploy using customized / local images
13+
## Deploy using customized/local images
1414

15-
The gateway operator deployment use 3 container images that need customization.
15+
The gateway operator deployment uses three container images that require customization.
1616
A user may use the default images or customized ones.
1717

1818
| Image | Description
1919
|---|---
20-
| gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0 | rbac proxy used by the operator manager
21-
| quay.io/kubevirt-ui/kube-gateway:latest | the kube gateway proxy server
22-
| quay.io/kubevirt-ui/kube-gateway-operator:v0.0.1 | the kube gateway operator image
20+
| gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0 | RBAC proxy used by the operator manager
21+
| quay.io/kubevirt-ui/kube-gateway:latest | The kube-gateway proxy server
22+
| quay.io/kubevirt-ui/kube-gateway-operator:v0.0.1 | The kube-gateway operator image
2323

24-
To cusomize the deployment replace this images in the example file:
24+
To customize the deployment, replace these images in the example file:
2525

2626
```bash
2727
curl https://raw.githubusercontent.com/kubevirt-ui/kube-gateway-operator/main/deploy/kube-gateway-operator.yaml > operator.yaml
2828

29-
# Check the current images for rbac-proxy, kube-gateway and kube-gateway-operator
30-
# and replacy them with you customize / local images.
29+
# Check the current images for the rbac-proxy, kube-gateway, and kube-gateway-operator
30+
# files and replace them with your customized/local images.
3131

3232
# Here is an example script for replacing the images:
33-
RBAC_IMAG=gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
34-
GATEWAY_IMAG=quay.io/kubevirt-ui/kube-gateway:latest
35-
GATEWAY_OPERATOR_IMAG=quay.io/kubevirt-ui/kube-gateway-operator:v0.0.1
33+
RBAC_IMAGE=gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
34+
GATEWAY_IMAGE=quay.io/kubevirt-ui/kube-gateway:latest
35+
GATEWAY_OPERATOR_IMAGE=quay.io/kubevirt-ui/kube-gateway-operator:v0.0.1
3636

37-
RBAC_IMAG_CI=ci.org/gateway/kube-rbac-proxy@sha256~1234
38-
sed -i "s|${RBAC_IMAG}|${RBAC_IMAG_CI}|g;" operator.yaml
37+
RBAC_IMAGE_CI=ci.org/gateway/kube-rbac-proxy@sha256~1234
38+
sed -i "s|${RBAC_IMAGE}|${RBAC_IMAGE_CI}|g;" operator.yaml
3939

4040
GATEWAY_IMAG_CI=ci.org/gateway/kube-gateway@sha256~1234
41-
sed -i "s|${GATEWAY_IMAG}|${GATEWAY_IMAG_CI}|g;" operator.yaml
41+
sed -i "s|${GATEWAY_IMAGE}|${GATEWAY_IMAGE_CI}|g;" operator.yaml
4242

43-
GATEWAY_OPERATOR_IMAG_CI=ci.org/gateway/kube-gateway-operator@sha256~1234
44-
sed -i "s|${GATEWAY_OPERATOR_IMAG}|${GATEWAY_OPERATOR_IMAG_CI}|g;" operator.yaml
43+
GATEWAY_OPERATOR_IMAGE_CI=ci.org/gateway/kube-gateway-operator@sha256~1234
44+
sed -i "s|${GATEWAY_OPERATOR_IMAGE}|${GATEWAY_OPERATOR_IMAGE_CI}|g;" operator.yaml
4545
```
4646

4747
```bash
@@ -51,17 +51,17 @@ oc create -f operator.yaml
5151

5252
## Starting a gateway
5353

54-
Now that the operator it installed, we can start running a kube gateway server.
55-
Create the proxy in the namespace that contain the k8s resources you with to expose.
54+
Now that the operator is installed, we can start running a kube-gateway server.
55+
Create the proxy in the namespace that contains the k8s resources you wish to expose.
5656

57-
For this example, we will create a namespace called "gateway-example" and spin up a gateway server:
57+
For this example, we will create a namespace called "gateway-example" and spin up a gateway server.
5858

5959
```bash
6060
oc new-project gateway-example
6161
```
6262

63-
Set the `namespace`, `route` and `image`
64-
`namespace` - the namespace to expose k8s resources
63+
Set the `namespace`, `route` and `image`.
64+
`namespace` - the namespace containing the k8s resources to be exposed
6565
`route` - the host of the proxy server
6666
`image` - the `kube-gateway` container image
6767

@@ -80,9 +80,9 @@ EOF
8080

8181
The gateway manager pod should start running in the namespace.
8282

83-
### Note: the secret holding the private key for signing the token
83+
### Important note
8484

85-
When creating signed tokens for this gateway proxy, a user must know the secret name:
85+
When creating signed tokens for this gateway proxy, a user must know the name of the secret holding the private key for signing the token.
8686

8787
```bash
8888
oc get secrets -n gateway-example | grep jwt-secret

docs/token.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Generating a signed token requires access to the secret holding the private key.
44

55
## Getting the name of the secret
66

7-
When spinning up a gateway server it creates a secret containing the private
7+
When a gateway server spins up it creates a secret containing the private
88
and public keys used to sign and authenticate the JWT tokens.
99

10-
The secret will end with `jwt-secret`:
10+
The name of the secret will end with `jwt-secret`:
1111

1212
```bash
1313
oc get secrets -n <namespace running the gateway proxy> | grep jwt-secret
@@ -43,40 +43,40 @@ EOF
4343

4444
## Generating a token
4545

46-
The folowing example describe how to create a token resource using a curl commend to access kubevirt vnc server.
46+
The following example describes how to create a token resource using a curl command to access the kubevirt VNC server.
4747

4848
```bash
49-
# Set the vm name
49+
# Set the VM name
5050
vm=testvm
51-
# Set the vm namespace (the virtual machine must be in the same namespace as the proxy)
51+
# Set the VM namespace (the virtual machine must be in the same namespace as the proxy)
5252
ns=gateway-example
5353

54-
# Generate the vnc subresource path
54+
# Generate the VNC subresource path
5555
path=/apis/subresources.kubevirt.io/v1/namespaces/$ns/virtualmachineinstances/$vm/vnc
5656

57-
# Get the admin user k8s bearer token, and the k8s API path,
58-
# We will use the k8s API and credentials to create the gatetoken resource
59-
# NOTE: users should know the admin token and k8s api host, the scripts here
60-
# gets this value using oc command only for this example.
57+
# Get the admin user's k8s bearer token and the k8s API path.
58+
# We will use the k8s API and credentials to create the gatetoken resource.
59+
# NOTE: Users should know the admin token and k8s API host. The script here
60+
# gets this value using only the oc command for this example.
6161
token=$(oc whoami -t)
6262
apipath=$(oc whoami --show-server)/apis/kubegateway.kubevirt.io/v1beta1/namespaces/$ns/gatetokens
6363

6464
# Get the name of the secret holding the private key for signing the gatetoken
65-
# NOTE: users should know the secret name, the script here
66-
# gets this value using oc command only for this example.
65+
# NOTE: Users should know the secret name. The script here
66+
# gets this value using only the oc command for this example.
6767
secret_name=$(oc get secrets -n $ns -o name | grep jwt-secret | cut -d "/" -f2)
6868

69-
# Generate a uniqe gatetoken name
69+
# Generate a unique gatetoken name
7070
date=$(date "+%y%m%d%H%M")
7171
name=$vm-$date
7272

7373
# Create the gatetoken resource
7474
data="{\"apiVersion\":\"kubegateway.kubevirt.io/v1beta1\",\"kind\":\"GateToken\",\"metadata\":{\"name\":\"$name\",\"namespace\":\"$ns\"},\"spec\":{\"secret-name\":\"$secret_name\",\"urls\":[\"$path\"]}}"
7575

76-
# Call k8s API using admin credentials to create a new gatetoken
76+
# Call the k8s API using admin credentials to create a new gatetoken
7777
curl -k -H 'Accept: application/json' -H "Authorization: Bearer $token" -H "Content-Type: application/json" --request POST --data $data $apipath
7878

79-
# Another way to create the gatetoken is using the oc command
79+
# You can also create the gatetoken using the oc command
8080
# cat <<EOF | oc create -f -
8181
# apiVersion: kubegateway.kubevirt.io/v1beta1
8282
# kind: GateToken\
@@ -90,15 +90,16 @@ curl -k -H 'Accept: application/json' -H "Authorization: Bearer $token" -H "Cont
9090
# EOF
9191
```
9292

93-
## Get the JWT singed token from the token resource
93+
## Get the JWT signed token from the token resource
9494

95-
Once a token resource is registered it will try to sign the token, get the sign token:
95+
Once a token resource is registered it will try to sign the token. Get the signed token:
9696

9797
```bash
9898
# Get the token resource
9999
curl -k -H 'Accept: application/json' -H "Authorization: Bearer $token" $apipath/$name
100100

101-
# Another way to get the gatetoke is using the oc command: oc get gatetoken $name -o json
101+
# You can also get the gatetoken using the oc command
102+
# oc get gatetoken $name -o json
102103
```
103104

104105
## Use the token to access the resource
@@ -107,16 +108,16 @@ curl -k -H 'Accept: application/json' -H "Authorization: Bearer $token" $apipath
107108
# Get the JWT from the gatetoken resource using admin credentials
108109
jwt=$(curl -k -H 'Accept: application/json' -H "Authorization: Bearer $token" $apipath/$name | jq .status.token)
109110

110-
# Another way to get the gatetoken is using the oc command
111+
# You can also get the gatetoken using the oc command
111112
# oc get gatetoken $name -o json | jq .status.token
112113

113-
# The proxy URL is set in the gateserver spec
114+
# The proxy URL is set in the gateserver spec.
114115
proxyurl=https://$(oc get gateserver -o json | jq -r .items[0].spec.route)
115116

116117
# The link is signed using ${jwt} and will access the k8s API at ${path}.
117118
signed_link="${proxyurl}/auth/jwt/set?token=${jwt}&then=/noVNC/vnc_lite.html?path=k8s${path}"
118119

119-
# Users holding the signed link will be able to use it for 1h:
120+
# Users holding the signed link will be able to use it for 1 hour.
120121

121122
# Open the link in a browser
122123
google-chrome "${signed_link}"

0 commit comments

Comments
 (0)