You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/customresourceinterpreter/README.md
+100-16
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,45 @@
1
-
# Examples
1
+
# Resource Interpreter Webhook
2
2
3
-
## Resource Interpreter
3
+
This document uses an example of a resource interpreter webhook to show users its usage. In the example, we process a CustomResourceDefinition(CRD) resource named `Workload`. Users can implement their own resource interpreter webhook component based on their own business, taking `karmada-interpreter-webhook-example` as an example.
4
4
5
-
This example installs a CustomResourceDefinition(CRD), `Workload` in the `karmada-apiserver`, and deploys a deployment `karmada-interpreter-webhook-example` in the Karmada host.
5
+
## Document introduction
6
6
7
-
### Install
7
+
```
8
+
examples/customresourceinterpreter/
9
+
│
10
+
├── apis/ # API Definition
11
+
│ ├── workload/ # `Workload` API Definition
12
+
│ │ ├── v1alpha1 # `Workload` v1alpha1 version API Definition
13
+
│ │ | ├── doc.go # API Package Introduction
14
+
│ │ | ├── workload_types.go # example `Workload` API Definition
15
+
│ │ | ├── zz_generated.deepcopy.go # generated by `deepcopy-gen`
16
+
| | | └── zz_generated.register.go # generated by `register-gen`
└── workload-propagationpolicy.yaml # `PropagationPolicy` resource example to propagate `Workload` resource
26
+
```
8
27
9
-
### Prerequisites
28
+
##Install
10
29
11
-
For Karmada deploy using `hack/local-up-karmada.sh`, there are `karmada-host`, `karmada-apiserver` and three member clusters named `member1`, `member2` and `member3`.
30
+
For a Karmada instance, the cluster where the Karmada component is deployed is called `karmada-host` cluster.
31
+
32
+
This document uses the Karmada instance installed in `hack/local-up-karmada.sh` mode as an example, there are `karmada-host`, `karmada-apiserver` and three member clusters named `member1`, `member2` and `member3`.
12
33
13
34
> Note: If you use other installation methods, please adapt your installation method proactively.
14
35
15
-
In the current example, we will deploy `karmada-interpreter-webhook-example` in the Karmada control plane. Since it involves a cluster with Pull mode, the initiator of resource interpreter requests is in `karmada-agent`. Therefore, we create a Service of type `LoadBalancer` for `karmada-interpreter-webhook-example`.
36
+
### Prerequisites
37
+
38
+
Considering that there is a `Pull` type cluster in the cluster, it is necessary to set up a LoadBalancer type Service for `karmada-interpreter-webhook-example` so that all clusters can access the resource interpreter webhook service. In this document, we deploy `MetalLB` to expose the webhook service.
16
39
17
-
So we need to deploy MetalLB as a Load Balancer to expose the webhook. Please run the following script to deploy MetalLB.
40
+
If all your clusters are `Push` type clusters, you can access the webhook service in the `karmada-host` cluster through `Service` without configuring additional `MetalLB`.
41
+
42
+
Please run the following script to deploy `MetalLB`.
#### Step2: Deploy webhook configuration in karmada-apiserver
116
+
#### Step2: Deploy webhook configuration in `karmada-apiserver`
117
+
118
+
We can tell Karmada how to access the resource interpreter webhook service by configuring `ResourceInterpreterWebhookConfiguration`. The configuration template is as follows:
If you only need to access the resource interpreter webhook service in the `Karmada-host` cluster, you can directly configure `clientConfig` with the Service domain name in the cluster:
> Note: karmada-interpreter-webhook-example is just a demo for testing and reference. If you plan to use the interpreter webhook, please implement specific components based on your business needs.
209
+
> Note: `karmada-interpreter-webhook-example` is just a demo for testing and reference. If you plan to use the interpreter webhook, please implement specific components based on your business needs.
128
210
129
211
In the current example, the interpreter webhook is deployed under the namespace `karmada-system`. If you are trying to deploy the interpreter webhook in a namespace other than the default karmada-system namespace, and use the domain address of Service in the URL. Such as (take the `test` namespace as an example):
130
212
@@ -157,6 +239,8 @@ We recommend that you deploy the interpreter webhook component and Karmada contr
157
239
158
240
The relevant problem description has been recorded in [#4478](https://github.com/karmada-io/karmada/issues/4478), please refer to it.
159
241
242
+
At this point, you have successfully installed the `karmada-interpreter-webhook-example` service and can start using it.
243
+
160
244
### Usage
161
245
162
246
Create a `Workload` resource and propagate it to the member clusters:
0 commit comments