forked from dongjinleekr/schema-registry-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit: implement schema, subject methods.
- Loading branch information
0 parents
commit 433796a
Showing
4 changed files
with
403 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM alpine:3.12 | ||
|
||
ARG schema_registry_cli_version=0.1 | ||
|
||
LABEL org.label-schema.name="schema-registry-cli" \ | ||
org.label-schema.description="Schema Registry command-line client" \ | ||
org.label-schema.build-date="${build_date}" \ | ||
org.label-schema.vcs-url="https://github.com/dongjinleekr/schema-registry-cli" \ | ||
org.label-schema.vcs-ref="${vcs_ref}" \ | ||
org.label-schema.version="${schema_registry_cli_version}" \ | ||
org.label-schema.schema-version="1.0" \ | ||
maintainer="[email protected]" | ||
|
||
COPY schema-registry-cli /tmp/ | ||
|
||
RUN apk add --no-cache bash dumb-init curl jq \ | ||
&& chmod a+x /tmp/schema-registry-cli \ | ||
&& mv /tmp/schema-registry-cli /usr/bin \ | ||
&& sync | ||
|
||
ENTRYPOINT [ "/usr/bin/dumb-init" ] | ||
|
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Lee Dongjin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,54 @@ | ||
schema-registry-cli | ||
===== | ||
|
||
A Command-line Schema Registry client based on curl, written in bash. | ||
|
||
# How to use | ||
|
||
```sh | ||
# list the subjects, available with localhost:8083 endpoint. | ||
schema-registry-cli subject list | ||
|
||
# Can change the Schema Registry endpoint. | ||
SCHEMA_REGISTRY_URL={schema-registry-url}:8081 schema-registry-cli subject list | ||
|
||
# Dry run: shows appropriate curl command only. | ||
SCHEMA_REGISTRY_URL={schema-registry-url}:8081 DRY_RUN=1 schema-registry-cli subject list | ||
|
||
# Result with JQ: show installed connectors | ||
SCHEMA_REGISTRY_URL={schema-registry-url}:8081 schema-registry-cli subject list | jq | ||
|
||
# Input from stdin: Create a new subject | ||
cat avro-schema.json | SCHEMA_REGISTRY_URL={schema-registry-url}:8081 schema-registry-cli subject create {subject-name} | ||
|
||
# In Kubernetes: use 'env'. | ||
kubectl -n default exec -it schema-registry-client -- env SCHEMA_REGISTRY_URL={schema-registry-url}:8081 schema-registry-cli subject list | ||
``` | ||
|
||
# Docker Support | ||
|
||
You can run this tool with provided docker image, `dongjinleekr/schema-registry-cli`. Below is the kubernetes pod configuration of this tool. | ||
|
||
``` | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: schema-registry-client | ||
namespace: default | ||
spec: | ||
containers: | ||
- name: schema-registry-client | ||
image: dongjinleekr/schema-registry-cli:0.1 | ||
command: | ||
- sh | ||
- -c | ||
- "exec tail -f /dev/null" | ||
``` | ||
|
||
To build your own Docker image, run the following: | ||
|
||
```sh | ||
# Build 0.1 | ||
export SCHEMA_REGISTRY_CLI_VERSION=0.1 && docker build --build-arg schema_registry_cli_version=${SCHEMA_REGISTRY_CLI_VERSION} -t dongjinleekr/schema-registry-cli:${SCHEMA_REGISTRY_CLI_VERSION} . | ||
``` | ||
|
Oops, something went wrong.