1.19. 확장
1.19.1.
지원되는 언어
WebAssembly 바이트 코드에 컴파일된 모든 언어를 사용하여 Red Hat OpenShift Service Mesh 확장을 작성할 수 있지만, 다음 언어에는 proxy-wasm API를 공개하는 기존 SDK가 있어 직접 사용할 수 있습니다.
표 1.13. 지원되는 언어
| 언어 | 유지 관리자 | 리포지터리 |
|---|---|---|
| AssemblyScript | solo.io | |
| C++ | proxy-wasm 팀(Istio 커뮤니티) | |
| Go | tetrate.io | |
| Rust | proxy-wasm 팀(Istio 커뮤니티) |
1.19.2.
1.19.3.
apiVersion: extensions.istio.io/v1alpha1
kind: WasmPlugin
metadata:
name: openid-connect
namespace: istio-ingress
spec:
selector:
matchLabels:
istio: ingressgateway
url: file:///opt/filters/openid.wasm
sha256: 1ef0c9a92b0420cf25f7fe5d481b231464bc88f486ca3b9c83ed5cc21d2f6210
phase: AUTHN
pluginConfig:
openid_server: authn
openid_realm: ingress
apiVersion: extensions.istio.io/v1alpha1
kind: WasmPlugin
metadata:
name: openid-connect
namespace: istio-system
spec:
selector:
matchLabels:
istio: ingressgateway
url: oci://private-registry:5000/openid-connect/openid:latest
imagePullPolicy: IfNotPresent
imagePullSecret: private-registry-pull-secret
phase: AUTHN
pluginConfig:
openid_server: authn
openid_realm: ingress표 1.14.
| 필드 | 유형 | 설명 | 필수 항목 |
|---|---|---|---|
| spec.selector | WorkloadSelector |
| 없음 |
| spec.url | string |
| 없음 |
| spec.sha256 | string |
| 없음 |
| spec.imagePullPolicy | PullPolicy |
| 없음 |
| spec.imagePullSecret | string |
| 없음 |
| spec.phase | PluginPhase |
| 없음 |
| spec.priority |
|
| 없음 |
| spec.pluginName | string |
| 없음 |
| spec.pluginConfig |
|
| 없음 |
| spec.pluginConfig.verificationKey | string |
| 없음 |
표 1.15. WorkloadSelector
| 필드 | 유형 | 설명 | 필수 항목 |
|---|---|---|---|
| matchLabels |
|
| 제공됨 |
표 1.16. PullPolicy
| 현재의 | 설명 |
|---|---|
| <empty> |
|
| IfNotPresent |
|
| Always |
|
표 1.17.
| 필드 | 유형 | 설명 |
|---|---|---|
|
| map<string, Value> |
|
표 1.18. PluginPhase
| 필드 | 설명 |
|---|---|
| <empty> |
|
| AUTHN |
|
| AUTHZ |
|
| STATS |
|
1.19.3.1.
절차
다음 예제 리소스를 만듭니다.
apiVersion: extensions.istio.io/v1alpha1 kind: WasmPlugin metadata: name: openid-connect namespace: istio-system spec: selector: matchLabels: istio: ingressgateway url: oci://private-registry:5000/openid-connect/openid:latest imagePullPolicy: IfNotPresent imagePullSecret: private-registry-pull-secret phase: AUTHN pluginConfig: openid_server: authn openid_realm: ingress$ oc apply -f plugin.yaml
1.19.4.
컨테이너 이미지를 유효한 확장 이미지로 만들려면 컨테이너 파일 시스템의 루트에 WebAssembly 모듈의 바이트 코드가 포함된 .wasm 파일과 manifest.yaml 파일이 있어야 합니다.
manifest.yaml
schemaVersion: 1 name: <your-extension> description: <description> version: 1.0.0 phase: PreAuthZ priority: 100 module: extension.wasm
표 1.19. manifest.yml에 대한 필드 참조
| 필드 | 설명 | 필수 항목 |
|---|---|---|
| schemaVersion |
매니페스트 스키마 버전 지정에 사용됩니다. 현재 가능한 값은 | 이 필드는 필수 항목입니다. |
| name | 해당 확장의 이름입니다. | 이 필드는 메타데이터일 뿐이며 현재 사용되지 않습니다. |
| description | 해당 확장의 설명입니다. | 이 필드는 메타데이터일 뿐이며 현재 사용되지 않습니다. |
| version | 해당 확장의 버전입니다. | 이 필드는 메타데이터일 뿐이며 현재 사용되지 않습니다. |
| phase | 해당 확장의 기본 실행 단계입니다. | 이 필드는 필수 항목입니다. |
| priority | 해당 확장의 기본 우선순위입니다. | 이 필드는 필수 항목입니다. |
| module | 컨테이너 파일 시스템의 루트에서 WebAssembly 모듈에 대한 상대적 경로입니다. | 이 필드는 필수 항목입니다. |
1.19.5.
표 1.20. ServiceMeshExtension 필드 참조
| 필드 | 설명 |
|---|---|
| metadata.namespace | 다른 메시 네임스페이스에 배포하면 동일한 네임스페이스의 워크로드에만 적용됩니다. |
| spec.workloadSelector |
|
| spec.config |
|
| spec.image | 확장자가 있는 이미지를 가리키는 컨테이너 이미지 URI입니다. |
| spec.phase | 단계는 인증, 권한 부여, 지표 생성과 같은 기존 Istio 기능과 관련하여 필터 체인에서 확장이 삽입되는 위치를 결정합니다. 유효한 값: PreAuthN, PostAuthN, PreAuthZ, PostAuthZ, PreStats, PostStats. |
| spec.priority | 우선순위가 높은 확장이 먼저 실행됩니다. 이를 통해 상호 의존적인 확장을 허용합니다. |
1.19.5.1.
Rust SDK를 사용하여 빌드된 전체 예제는 header-append-filter를 참조하십시오.
절차
다음 예제 리소스를 만듭니다.
ServiceMeshExtension 리소스 extensions.yaml의 예
apiVersion: maistra.io/v1 kind: ServiceMeshExtension metadata: name: header-append namespace: istio-system spec: workloadSelector: labels: app: httpbin config: first-header: some-value another-header: another-value image: quay.io/maistra-dev/header-append-filter:2.1 phase: PostAuthZ priority: 100$ oc apply -f <extension>.yaml
1.19.6.
1.19.6.1.
표 1.21.
| ServiceMeshExtension | WasmPlugin |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
apiVersion: maistra.io/v1
kind: ServiceMeshExtension
metadata:
name: header-append
namespace: istio-system
spec:
workloadSelector:
labels:
app: httpbin
config:
first-header: some-value
another-header: another-value
image: quay.io/maistra-dev/header-append-filter:2.2
phase: PostAuthZ
priority: 100
apiVersion: extensions.istio.io/v1alpha1
kind: WasmPlugin
metadata:
name: header-append
namespace: istio-system
spec:
selector:
matchLabels:
app: httpbin
url: oci://quay.io/maistra-dev/header-append-filter:2.2
phase: STATS
pluginConfig:
first-header: some-value
another-header: another-value
1.19.6.2.
1.19.6.3.
사전 요구 사항
절차