-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: morvencao <[email protected]>
- Loading branch information
Showing
13 changed files
with
541 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# CURD Resource/Bundle with gRPC Client | ||
|
||
## Preparation | ||
|
||
1. Enable gRPC server by passing `--enable-grpc-server=true` to the maestro server start command, for example: | ||
|
||
```shell | ||
$ oc -n maestro patch deploy/maestro --type=json -p='[{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--enable-grpc-server=true"}]' | ||
``` | ||
|
||
2. Port-forward the gRPC service to your local machine, for example: | ||
|
||
```shell | ||
$ oc -n maestro port-forward svc/maestro-grpc 8090 & | ||
``` | ||
|
||
## Operate Resource with gRPC client | ||
|
||
```shell | ||
# create | ||
go run ./grpcclient.go -grpc_server localhost:8090 -cloudevents_json_file ./cloudevent.json | ||
|
||
# update | ||
go run ./grpcclient.go -grpc_server localhost:8090 -cloudevents_json_file ./cloudevent-update.json | ||
|
||
# delete | ||
go run ./grpcclient.go -grpc_server localhost:8090 -cloudevents_json_file ./cloudevent-delete.json | ||
``` | ||
|
||
## Operate Resource Bundle with gRPC client | ||
|
||
```shell | ||
# create | ||
go run ./grpcclient.go -grpc_server localhost:8090 -cloudevents_json_file ./cloudevent-bundle.json | ||
|
||
# update | ||
go run ./grpcclient.go -grpc_server localhost:8090 -cloudevents_json_file ./cloudevent-bundle-update.json | ||
|
||
# delete | ||
go run ./grpcclient.go -grpc_server localhost:8090 -cloudevents_json_file ./cloudevent-bundle-delete.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "aa27051a-5578-4e03-b737-5d6416d09694", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifestbundles.spec.delete_request", | ||
"source": "grpc", | ||
"clustername": "cluster1", | ||
"resourceid": "68ebf474-6709-48bb-b760-386181268064", | ||
"resourceversion": 1, | ||
"deletiontimestamp": "2024-10-15T09:54:06.582625606Z", | ||
"datacontenttype": "application/json", | ||
"data": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "ff8b8e9b-d433-4707-bedd-66d52bbfb9f1", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifestbundles.status.resync_request", | ||
"source": "grpc", | ||
"time": "2024-10-15T17:31:05Z", | ||
"clustername": "", | ||
"originalsource": "", | ||
"datacontenttype": "application/json", | ||
"data": { | ||
"statusHashes": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "9dbcc8ec-c92e-4686-8ea3-0a0def70fa06", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifestbundles.spec.update_request", | ||
"source": "grpc", | ||
"clustername": "cluster1", | ||
"resourceid": "68ebf474-6709-48bb-b760-386181268064", | ||
"resourceversion": 1, | ||
"datacontenttype": "application/json", | ||
"data": { | ||
"manifests": [ | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "ConfigMap", | ||
"metadata": { | ||
"name": "web", | ||
"namespace": "default" | ||
} | ||
}, | ||
{ | ||
"apiVersion": "apps/v1", | ||
"kind": "Deployment", | ||
"metadata": { | ||
"name": "web", | ||
"namespace": "default" | ||
}, | ||
"spec": { | ||
"replicas": 2, | ||
"selector": { | ||
"matchLabels": { | ||
"app": "web" | ||
} | ||
}, | ||
"template": { | ||
"metadata": { | ||
"labels": { | ||
"app": "web" | ||
} | ||
}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "nginxinc/nginx-unprivileged", | ||
"name": "nginx" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"deleteOption": { | ||
"propagationPolicy": "Foreground" | ||
}, | ||
"manifestConfigs": [ | ||
{ | ||
"resourceIdentifier": { | ||
"group": "apps", | ||
"resource": "deployments", | ||
"namespace": "default", | ||
"name": "web" | ||
}, | ||
"feedbackRules": [ | ||
{ | ||
"type": "JSONPaths", | ||
"jsonPaths": [ | ||
{ | ||
"name": "status", | ||
"path": ".status" | ||
} | ||
] | ||
} | ||
], | ||
"updateStrategy": { | ||
"type": "ServerSideApply" | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "e718bb21-e8c8-436f-b6a4-16a5afd17caf", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifests.spec.delete_request", | ||
"source": "grpc", | ||
"clustername": "cluster1", | ||
"resourceid": "eec95cda-03d6-4514-a9bd-29da9cf7ede2", | ||
"deletiontimestamp": "2024-10-15T09:46:06.582625606Z", | ||
"resourceversion": 1, | ||
"datacontenttype": "application/json", | ||
"data": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "ff8b8e9b-d433-4707-bedd-66d52bbfb9f1", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifests.status.resync_request", | ||
"source": "grpc", | ||
"time": "2024-02-05T17:31:05Z", | ||
"clustername": "", | ||
"originalsource": "", | ||
"datacontenttype": "application/json", | ||
"data": { | ||
"statusHashes": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "ec41ece3-84f5-42b7-92fd-ad478c6e0be6", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifests.spec.update_request", | ||
"source": "grpc", | ||
"clustername": "cluster1", | ||
"resourceid": "eec95cda-03d6-4514-a9bd-29da9cf7ede2", | ||
"resourceversion": 1, | ||
"datacontenttype": "application/json", | ||
"data": { | ||
"manifest": { | ||
"apiVersion": "apps/v1", | ||
"kind": "Deployment", | ||
"metadata": { | ||
"name": "nginx", | ||
"namespace": "default" | ||
}, | ||
"spec": { | ||
"replicas": 2, | ||
"selector": { | ||
"matchLabels": { | ||
"app": "nginx" | ||
} | ||
}, | ||
"template": { | ||
"metadata": { | ||
"labels": { | ||
"app": "nginx" | ||
} | ||
}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "nginxinc/nginx-unprivileged", | ||
"name": "nginx" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"deleteOption": { | ||
"propagationPolicy": "Foreground" | ||
}, | ||
"configOption": { | ||
"feedbackRules": [ | ||
{ | ||
"type": "JSONPaths", | ||
"jsonPaths": [ | ||
{ | ||
"name": "status", | ||
"path": ".status" | ||
} | ||
] | ||
} | ||
], | ||
"updateStrategy": { | ||
"type": "ServerSideApply" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"specversion": "1.0", | ||
"id": "8beb9296-f423-4bd2-932c-01015e7034dc", | ||
"type": "io.open-cluster-management.works.v1alpha1.manifests.spec.create_request", | ||
"source": "grpc", | ||
"clustername": "cluster1", | ||
"resourceid": "eec95cda-03d6-4514-a9bd-29da9cf7ede2", | ||
"resourceversion": 1, | ||
"datacontenttype": "application/json", | ||
"data": { | ||
"manifest": { | ||
"apiVersion": "apps/v1", | ||
"kind": "Deployment", | ||
"metadata": { | ||
"name": "nginx", | ||
"namespace": "default" | ||
}, | ||
"spec": { | ||
"replicas": 1, | ||
"selector": { | ||
"matchLabels": { | ||
"app": "nginx" | ||
} | ||
}, | ||
"template": { | ||
"metadata": { | ||
"labels": { | ||
"app": "nginx" | ||
} | ||
}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "nginxinc/nginx-unprivileged", | ||
"name": "nginx" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"deleteOption": { | ||
"propagationPolicy": "Foreground" | ||
}, | ||
"configOption": { | ||
"feedbackRules": [ | ||
{ | ||
"type": "JSONPaths", | ||
"jsonPaths": [ | ||
{ | ||
"name": "status", | ||
"path": ".status" | ||
} | ||
] | ||
} | ||
], | ||
"updateStrategy": { | ||
"type": "ServerSideApply" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.