Skip to content

Commit 8fe9a36

Browse files
authored
Merge pull request #54995 from dfennessy/THREESCALE-8781
THREESCALE-8781: Updates for 3scale-auth-wasm.
2 parents 11d1199 + f30e61f commit 8fe9a36

12 files changed

+95
-117
lines changed

modules/ossm-configuring-the-threescale-wasm-auth-module.adoc

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77

88
Cluster administrators on {product-title} can configure the `threescale-wasm-auth` module to authorize HTTP requests to 3scale API Management through an application binary interface (ABI). The ABI defines the interaction between host and the module, exposing the hosts services, and allows you to use the module to process proxy requests.
99

10-
[id="the-service-mesh-extension_{context}"]
11-
== The Service Mesh extension
10+
[id="the-wasmplugin-api-extension_{context}"]
11+
== The WasmPlugin API extension
1212

13-
14-
{SMProductShortName} provides a custom resource definition to specify and apply Proxy-WASM extensions to sidecar proxies, known as xref:../../service_mesh/v2x/ossm-extensions.adoc#ossm-extensions[`ServiceMeshExtension`]. {SMProductShortName} applies this custom resource to the set of workloads that require HTTP API management with 3scale.
13+
{SMProductShortName} provides a custom resource definition to specify and apply Proxy-WASM extensions to sidecar proxies, known as xref:../../service_mesh/v2x/ossm-extensions.adoc#ossm-extensions-wasmplugin-format_ossm-extensions[`WasmPlugin`]. {SMProductShortName} applies this custom resource to the set of workloads that require HTTP API management with 3scale.
1514

1615
ifdef::openshift-enterprise[]
1716
See xref:../../operators/understanding/crds/crd-extending-api-with-crds.adoc#crd-extending-api-with-crds[custom resource definition] for more information.
@@ -26,43 +25,38 @@ Configuring the WebAssembly extension is currently a manual process. Support for
2625

2726
* Identify a Kubernetes workload and namespace on your {SMProductShortName} deployment that you will apply this module.
2827
* You must have a 3scale tenant account. See link:https://www.3scale.net/signup[SaaS] or link:https://access.redhat.com/documentation/en-us/red_hat_3scale_api_management/2.11/html-single/installing_3scale/index#install-threescale-on-openshift-guide[3scale 2.11 On-Premises] with a matching service and relevant applications and metrics defined.
29-
* If you apply the module to the `productpage` microservice in the `bookinfo` namespace, see the xref:../../service_mesh/v1x/prepare-to-deploy-applications-ossm.html#ossm-tutorial-bookinfo-overview_deploying-applications-ossm-v1x[Bookinfo sample application].
28+
* If you apply the module to the `<product_page>` microservice in the `bookinfo` namespace, see the xref:../../service_mesh/v1x/prepare-to-deploy-applications-ossm.html#ossm-tutorial-bookinfo-overview_deploying-applications-ossm-v1x[Bookinfo sample application].
3029
** The following example is the YAML format for the custom resource for `threescale-wasm-auth` module.
31-
This example refers to the upstream Maistra version of {SMProductShortName}, ServiceMeshExtension API. You must declare the namespace where the `threescale-wasm-auth` module is deployed, alongside a `WorkloadSelector` to identify the set of applications the module will apply to:
30+
This example refers to the upstream Maistra version of {SMProductShortName}, `WasmPlugin` API. You must declare the namespace where the `threescale-wasm-auth` module is deployed, alongside a `selector` to identify the set of applications the module will apply to:
3231
+
3332
[source,yaml]
3433
----
35-
apiVersion: maistra.io/v1
36-
kind: ServiceMeshExtension
34+
apiVersion: extensions.istio.io/v1alpha1
35+
kind: WasmPlugin
3736
metadata:
38-
name: threescale-wasm-auth
39-
namespace: bookinfo <1>
37+
name: <threescale_wasm_plugin_name>
38+
namespace: <bookinfo> <1>
4039
spec:
41-
workloadSelector: <2>
40+
selector: <2>
4241
labels:
43-
app: productpage
44-
config: <yaml_configuration>
45-
image: registry.redhat.io/openshift-service-mesh/3scale-auth-wasm-rhel8:0.0.1
46-
phase: PostAuthZ
42+
app: <product_page>
43+
pluginConfig: <yaml_configuration>
44+
url: oci://registry.redhat.io/3scale-amp2/3scale-auth-wasm-rhel8:0.0.3
45+
phase: AUTHZ
4746
priority: 100
4847
----
4948
<1> The `namespace`.
50-
<2> The `WorkloadSelector`.
51-
* The `spec.config` field depends on the module configuration and it is not populated in the previous example. Instead, the example uses the `<yaml_configuration>` placeholder value. You can use the format of this custom resource example.
52-
** The `spec.config` field varies depending on the application. All other fields persist across multiple instances of this custom resource. As examples:
49+
<2> The `selector`.
50+
* The `spec.pluginConfig` field depends on the module configuration and it is not populated in the previous example. Instead, the example uses the `<yaml_configuration>` placeholder value. You can use the format of this custom resource example.
51+
** The `spec.pluginConfig` field varies depending on the application. All other fields persist across multiple instances of this custom resource. As examples:
5352
+
5453
--
55-
*** `image`: Only changes when newer versions of the module are deployed.
54+
*** `url`: Only changes when newer versions of the module are deployed.
5655
*** `phase`: Remains the same, since this module needs to be invoked after the proxy has done any local authorization, such as validating OpenID Connect (OIDC) tokens.
5756
--
58-
* After you have the module configuration in `spec.config` and the rest of the custom resource, apply it with the `oc apply` command:
57+
* After you have the module configuration in `spec.pluginConfig` and the rest of the custom resource, apply it with the `oc apply` command:
5958
+
6059
[source,terminal]
6160
----
6261
$ oc apply -f threescale-wasm-auth-bookinfo.yaml
6362
----
64-
65-
[role="_additional-resources"]
66-
.Additional resources
67-
* xref:../../service_mesh/v2x/ossm-extensions.adoc#ossm-smextensions-deploy_ossm-extensions[Deploying `ServiceMeshExtension` resources]
68-
* link:https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources[Custom Resources]

modules/ossm-threescale-configuring-the-threescale-webassembly-module.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ The prerequisites are a set of minimum mandatory fields in all cases:
1414
* For the 3scale account and authorization service: the `backend-listener` URL.
1515
* For the list of services to handle: the service IDs and at least one credential look up method and where to find it.
1616
* You will find examples for dealing with `userkey`, `appid` with `appkey`, and OpenID Connect (OIDC) patterns.
17-
* The WebAssembly module uses the settings you specified in the static configuration. For example, if you add a mapping rule configuration to the module, it will always apply, even when the 3scale Admin Portal has no such mapping rule. The rest of the `ServiceMeshExtension` resource exists around the `spec.config` YAML entry.
17+
* The WebAssembly module uses the settings you specified in the static configuration. For example, if you add a mapping rule configuration to the module, it will always apply, even when the 3scale Admin Portal has no such mapping rule. The rest of the `WasmPlugin` resource exists around the `spec.pluginConfig` YAML entry.

modules/ossm-threescale-webassembly-module-api-object.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ A non-existent or unsupported version of the `api` object renders the 3scale Web
1515
.The `api` top-level string example
1616
[source,yaml]
1717
----
18-
apiVersion: maistra.io/v1
19-
kind: ServiceMeshExtension
18+
apiVersion: extensions.istio.io/v1alpha1
19+
kind: WasmPlugin
2020
metadata:
21-
name: threescale-wasm-auth
22-
namespace: bookinfo
21+
name: <threescale_wasm_plugin_name>
22+
namespace: <bookinfo>
2323
spec:
24-
config:
24+
pluginConfig:
2525
api: v1
2626
...
2727
----

modules/ossm-threescale-webassembly-module-backend-object.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ The `backend` top-level object specifies how to access the 3scale Service Manage
99

1010
[source,yaml]
1111
----
12-
apiVersion: maistra.io/v1
13-
kind: ServiceMeshExtension
12+
apiVersion: extensions.istio.io/v1alpha1
13+
kind: WasmPlugin
1414
metadata:
15-
name: threescale-wasm-auth
15+
name: <threescale_wasm_plugin_name>
1616
spec:
17-
config:
17+
pluginConfig:
1818
...
1919
backend:
2020
name: backend

modules/ossm-threescale-webassembly-module-configuration.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
[id="ossm-threescale-webassembly-module-configuration_{context}"]
66
= The 3scale WebAssembly module configuration
77

8-
The `ServiceMeshExtension` custom resource spec provides the configuration that the `Proxy-WASM` module reads from.
8+
The `WasmPlugin` custom resource spec provides the configuration that the `Proxy-WASM` module reads from.
99

10-
The spec is embedded in the host and read by the `Proxy-WASM` module. Typically, the configurations are in the JSON file format for the modules to parse, however the `ServiceMeshExtension` resource can interpret the spec value as YAML and convert it to JSON for consumption by the module.
10+
The spec is embedded in the host and read by the `Proxy-WASM` module. Typically, the configurations are in the JSON file format for the modules to parse, however the `WasmPlugin` resource can interpret the spec value as YAML and convert it to JSON for consumption by the module.
1111

12-
If you use the `Proxy-WASM` module in stand-alone mode, you must write the configuration using the JSON format. Using the JSON format means using escaping and quoting where needed within the `host` configuration files, for example `Envoy`. When you use the WebAssembly module with the `ServiceMeshExtension` resource, the configuration is in the YAML format. In this case, an invalid configuration forces the module to show diagnostics based on its JSON representation to a sidecar's logging stream.
12+
If you use the `Proxy-WASM` module in stand-alone mode, you must write the configuration using the JSON format. Using the JSON format means using escaping and quoting where needed within the `host` configuration files, for example `Envoy`. When you use the WebAssembly module with the `WasmPlugin` resource, the configuration is in the YAML format. In this case, an invalid configuration forces the module to show diagnostics based on its JSON representation to a sidecar's logging stream.
1313

1414
[IMPORTANT]
1515
====
16-
The `EnvoyFilter` custom resource is not a supported API, although it can be used in some 3scale Istio adapter or {SMProductShortName} releases. Using the `EnvoyFilter` custom resource is not recommended. Use the `ServiceMeshExtension` API instead of the `EnvoyFilter` custom resource.
16+
The `EnvoyFilter` custom resource is not a supported API, although it can be used in some 3scale Istio adapter or {SMProductShortName} releases. Using the `EnvoyFilter` custom resource is not recommended. Use the `WasmPlugin` API instead of the `EnvoyFilter` custom resource.
1717
If you must use the `EnvoyFilter` custom resource, you must specify the spec in JSON format.
1818
====

modules/ossm-threescale-webassembly-module-credentials-object.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ All fields are optional, but you must specify at least one, `user_key` or `app_i
1111

1212
[source,yaml]
1313
----
14-
apiVersion: maistra.io/v1
15-
kind: ServiceMeshExtension
14+
apiVersion: extensions.istio.io/v1alpha1
15+
kind: WasmPlugin
1616
metadata:
17-
name: threescale-wasm-auth
17+
name: <threescale_wasm_plugin_name>
1818
spec:
19-
config:
19+
pluginConfig:
2020
...
2121
services:
2222
- credentials:

modules/ossm-threescale-webassembly-module-lookup-queries.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ A `lookup query` is made up of a single field, a source object, which can be one
1313

1414
[source,yaml]
1515
----
16-
apiVersion: maistra.io/v1
17-
kind: ServiceMeshExtension
16+
apiVersion: extensions.istio.io/v1alpha1
17+
kind: WasmPlugin
1818
metadata:
19-
name: threescale-wasm-auth
19+
name: <threescale_wasm_plugin_name>
2020
spec:
21-
config:
21+
pluginConfig:
2222
...
2323
services:
2424
- credentials:

modules/ossm-threescale-webassembly-module-mapping-rule-object.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ The example below uses a `GET` request to a path, `/products/1/sold`, that match
4747
.`mapping_rules` `GET` request example
4848
[source,yaml]
4949
----
50-
apiVersion: maistra.io/v1
51-
kind: ServiceMeshExtension
50+
apiVersion: extensions.istio.io/v1alpha1
51+
kind: WasmPlugin
5252
metadata:
53-
name: threescale-wasm-auth
53+
name: <threescale_wasm_plugin_name>
5454
spec:
55-
config:
55+
pluginConfig:
5656
...
5757
mapping_rules:
5858
- method: GET

modules/ossm-threescale-webassembly-module-minimal-working-configuration.adoc

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,29 @@ The following is an example of a 3scale WebAssembly module minimal working confi
99

1010
[source,yaml]
1111
----
12-
apiVersion: maistra.io/v1
13-
kind: ServiceMeshExtension
12+
apiVersion: extensions.istio.io/v1alpha1
13+
kind: WasmPlugin
1414
metadata:
15-
name: threescale-auth
15+
name: <threescale_wasm_plugin_name>
1616
spec:
17-
image: registry.redhat.io/openshift-service-mesh/3scale-auth-wasm-rhel8:0.0.1
18-
phase: PostAuthZ
17+
url: oci://registry.redhat.io/3scale-amp2/3scale-auth-wasm-rhel8:0.0.3
18+
imagePullSecret: <optional_pull_secret_resource>
19+
phase: AUTHZ
1920
priority: 100
20-
workloadSelector:
21+
selector:
2122
labels:
22-
app: productpage
23-
config:
23+
app: <product_page>
24+
pluginConfig:
2425
api: v1
2526
system:
26-
name: system-name
27+
name: <system_name>
2728
upstream:
2829
name: outbound|443||multitenant.3scale.net
2930
url: https://istiodevel-admin.3scale.net/
3031
timeout: 5000
31-
token: atoken
32+
token: <token>
3233
backend:
33-
name: backend-name
34+
name: <backend_name>
3435
upstream:
3536
name: outbound|443||su1.3scale.net
3637
url: https://su1.3scale.net/
@@ -39,49 +40,28 @@ spec:
3940
- no_body
4041
services:
4142
- id: '2555417834780'
42-
token: service_token
4343
authorities:
4444
- "*"
4545
credentials:
46+
user_key:
47+
- query_string:
48+
keys:
49+
- <user_key>
50+
- header:
51+
keys:
52+
- <user_key>
4653
app_id:
47-
- header:
48-
keys:
49-
- app_id
50-
- query_string:
51-
keys:
52-
- app_id
53-
- application_id
54+
- query_string:
55+
keys:
56+
- <app_id>
57+
- header:
58+
keys:
59+
- <app_id>
5460
app_key:
55-
- header:
56-
keys:
57-
- app_key
58-
- query_string:
59-
keys:
60-
- app_key
61-
- application_key
62-
user_key:
63-
- query_string:
64-
keys:
65-
- user_key
66-
- header:
67-
keys:
68-
- user_key
69-
mapping_rules:
70-
- method: GET
71-
pattern: "/"
72-
usages:
73-
- name: Hits
74-
delta: 1
75-
- method: GET
76-
pattern: "/o{*}c"
77-
usages:
78-
- name: oidc
79-
delta: 1
80-
- name: Hits
81-
delta: 1
82-
- method: any
83-
pattern: "/{anything}?bigsale={*}"
84-
usages:
85-
- name: sale
86-
delta: 5
87-
----
61+
- query_string:
62+
keys:
63+
- <app_key>
64+
- header:
65+
keys:
66+
- <app_key>
67+
----

modules/ossm-threescale-webassembly-module-services-object.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ The `services` field is required. It is an array that must contain at least one
1313

1414
[source,yaml]
1515
----
16-
apiVersion: maistra.io/v1
17-
kind: ServiceMeshExtension
16+
apiVersion: extensions.istio.io/v1alpha1
17+
kind: WasmPlugin
1818
metadata:
19-
name: threescale-wasm-auth
19+
name: <threescale_wasm_plugin_name>
2020
spec:
21-
config:
21+
pluginConfig:
2222
...
2323
services:
2424
- id: "2555417834789"
@@ -46,7 +46,7 @@ a|`token`
4646
a|This `token` can be found in the proxy configuration for your service in System or you can retrieve the it from System with following `curl` command:
4747

4848
`curl \https://<system_host>/admin/api/services/<service_id>/proxy/configs/production/latest.json?access_token=<access_token>" \| jq '.proxy_config.content.backend_authentication_value`
49-
|Yes
49+
|Optional
5050

5151
a|`authorities`
5252
|An array of strings, each one representing the _Authority_ of a _URL_ to match. These strings accept glob patterns supporting the asterisk (_*_), plus sign (_+_), and question mark (_?_) matchers.
@@ -58,5 +58,5 @@ a|`credentials`
5858

5959
a|`mapping_rules`
6060
|An array of objects representing mapping rules and 3scale methods to hit.
61-
|Yes
61+
|Optional
6262
|===

0 commit comments

Comments
 (0)