Skip to content

Commit 63332a9

Browse files
committed
docs: document go sdk with examples
Signed-off-by: Alan Clucas <[email protected]>
1 parent 6199d8f commit 63332a9

File tree

31 files changed

+5138
-15
lines changed

31 files changed

+5138
-15
lines changed

.github/workflows/ci-build.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ jobs:
224224
# contention on the runner, which we have no control over.
225225
timeout-minutes: 60
226226
env:
227-
KUBECONFIG: /home/runner/.kubeconfig
227+
KUBECONFIG: /home/runner/.kube/config
228228
E2E_ENV_FACTOR: 2
229229
strategy:
230230
fail-fast: false
@@ -268,6 +268,10 @@ jobs:
268268
- test: test-plugins
269269
profile: plugins
270270
use-api: false
271+
- test: test-go-sdk
272+
profile: minimal
273+
use-api: true
274+
secure: true
271275
- test: test-java-sdk
272276
profile: minimal
273277
use-api: true
@@ -344,7 +348,8 @@ jobs:
344348
K3S_KUBECONFIG_MODE=644 \
345349
sh -
346350
until kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml cluster-info ; do sleep 10s ; done
347-
cp /etc/rancher/k3s/k3s.yaml /home/runner/.kubeconfig
351+
mkdir -p .kube
352+
cp /etc/rancher/k3s/k3s.yaml /home/runner/.kube/config
348353
echo "- name: fake_token_user" >> $KUBECONFIG
349354
echo " user:" >> $KUBECONFIG
350355
echo " token: xxxxxx" >> $KUBECONFIG
@@ -387,7 +392,7 @@ jobs:
387392
API=${{matrix.use-api}} \
388393
UI=false \
389394
POD_STATUS_CAPTURE_FINALIZER=true 2>&1 | tee /tmp/argo.log &
390-
make wait PROFILE=${{matrix.profile}} API=${{matrix.use-api}}
395+
make wait PROFILE=${{matrix.profile}} API=${{matrix.use-api}} SECURE=${{ matrix.secure || 'false' }}
391396
timeout-minutes: 5
392397
- name: Validate release manifests
393398
run: make manifests-validate

.spelling

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ errored
175175
expr
176176
fibonacci
177177
finalizer
178+
gRPC
178179
gitops
179180
goroutine
180181
goroutines
@@ -192,6 +193,7 @@ k8s-jobs
192193
kube
193194
kube-apiserver
194195
kube-scheduler
196+
kubeconfig
195197
kubectl
196198
kubelet
197199
kubernetes

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ TOOL_SWAGGER := $(GOPATH)/bin/swagger
161161
TOOL_GOIMPORTS := $(GOPATH)/bin/goimports
162162
TOOL_GOLANGCI_LINT := $(GOPATH)/bin/golangci-lint
163163
TOOL_GOTESTSUM := $(GOPATH)/bin/gotestsum
164+
TOOL_SNIPDOC := $(HOME)/.local/bin/snipdoc
164165

165166
# npm bin -g will do this on later npms than we have
166167
NVM_BIN ?= $(shell npm config get prefix)/bin
@@ -225,7 +226,7 @@ SWAGGER_FILES := pkg/apiclient/_.primary.swagger.json \
225226
pkg/apiclient/workflowtemplate/workflow-template.swagger.json \
226227
pkg/apiclient/sync/sync.swagger.json
227228
PROTO_BINARIES := $(TOOL_PROTOC_GEN_GOGO) $(TOOL_PROTOC_GEN_GOGOFAST) $(TOOL_GOIMPORTS) $(TOOL_PROTOC_GEN_GRPC_GATEWAY) $(TOOL_PROTOC_GEN_SWAGGER) $(TOOL_CLANG_FORMAT)
228-
GENERATED_DOCS := docs/fields.md docs/cli/argo.md docs/workflow-controller-configmap.md docs/metrics.md
229+
GENERATED_DOCS := docs/fields.md docs/cli/argo.md docs/workflow-controller-configmap.md docs/metrics.md docs/go-sdk-guide.md
229230

230231
# protoc,my.proto
231232
define protoc
@@ -449,6 +450,12 @@ ifneq ($(USE_NIX), true)
449450
go install gotest.tools/[email protected]
450451
endif
451452

453+
$(TOOL_SNIPDOC): Makefile
454+
# update this in Nix when upgrading it here
455+
ifneq ($(USE_NIX), true)
456+
./hack/install-snipdoc.sh $(TOOL_SNIPDOC) v0.1.12
457+
endif
458+
452459
$(TOOL_CLANG_FORMAT):
453460
ifeq (, $(shell which clang-format))
454461
ifeq ($(shell uname),Darwin)
@@ -821,6 +828,9 @@ docs/workflow-controller-configmap.md: config/*.go hack/docs/workflow-controller
821828
docs/cli/argo.md: $(CLI_PKG_FILES) go.sum ui/dist/app/index.html hack/docs/cli.go
822829
go run ./hack/docs cli
823830

831+
docs/go-sdk-guide.md: $(TOOL_SNIPDOC)
832+
$(TOOL_SNIPDOC) run
833+
824834
$(TOOL_MDSPELL): Makefile
825835
# update this in Nix when upgrading it here
826836
ifneq ($(USE_NIX), true)
@@ -854,7 +864,7 @@ endif
854864
.PHONY: docs-lint
855865
docs-lint: $(TOOL_MARKDOWNLINT) docs/metrics.md
856866
# lint docs
857-
$(TOOL_MARKDOWNLINT) docs --fix --ignore docs/fields.md --ignore docs/executor_swagger.md --ignore docs/cli --ignore docs/walk-through/the-structure-of-workflow-specs.md --ignore docs/tested-kubernetes-versions.md
867+
$(TOOL_MARKDOWNLINT) docs --fix --ignore docs/fields.md --ignore docs/executor_swagger.md --ignore docs/cli --ignore docs/walk-through/the-structure-of-workflow-specs.md --ignore docs/tested-kubernetes-versions.md --ignore docs/go-sdk-guide.md
858868

859869
$(TOOL_MKDOCS): docs/requirements.txt
860870
# update this in Nix when upgrading it here
@@ -968,3 +978,7 @@ pkg/apiclient/artifact/artifact.swagger.json: $(PROTO_BINARIES) $(TYPES) pkg/api
968978

969979
# Add artifact-proto to swagger dependencies
970980
swagger: pkg/apiclient/artifact/artifact.swagger.json
981+
982+
.PHONY: test-go-sdk
983+
test-go-sdk: ## Run all Go SDK examples
984+
./hack/test-go-sdk.sh

docs/client-libraries.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,35 @@ yourself. You can use a client library for the programming language you are usin
77

88
Client libraries often handle common tasks such as authentication for you.
99

10-
## Auto-generated client libraries
10+
## Client Libraries
1111

12-
The following client libraries are auto-generated using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator-cli).
13-
Please expect very minimal support from the Argo team.
12+
We have libraries for the following languages:
1413

15-
| Language | Client Library | Examples/Docs |
16-
|----------|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
17-
| Golang | [`apiclient.go`](https://github.com/argoproj/argo-workflows/blob/main/pkg/apiclient/apiclient.go) | [Example](https://github.com/argoproj/argo-workflows/blob/main/cmd/argo/commands/submit.go) |
18-
| Java | [Java](https://github.com/argoproj/argo-workflows/blob/main/sdks/java) | |
19-
| Python | ⚠️ deprecated [Python](https://github.com/argoproj/argo-workflows/blob/main/sdks/python) | Use [Hera](#hera-python-sdk) instead. Will be removed in version 3.7 |
14+
* [Go](#go-sdk)
15+
* [Java](#java-sdk)
16+
* [Python](#hera-python-sdk)
2017

21-
## Hera Python SDK
18+
Please feel free to contribute more language libraries to help improve the Argo Workflows ecosystem.
19+
20+
### Go SDK
21+
22+
The [Go SDK](./go-sdk-guide.md) is a fully-featured client for Argo Workflows. It provides two client approaches:
23+
24+
* **Kubernetes Client** - Direct CRD access for in-cluster applications
25+
* **Argo Server Client** - gRPC/HTTP access for remote applications
26+
27+
**Documentation:**
28+
29+
* [Go SDK Guide](./go-sdk-guide.md) - Comprehensive documentation
30+
* [Examples](https://github.com/argoproj/argo-workflows/blob/main/sdks/go/) - Working code examples
31+
* [API Reference](https://pkg.go.dev/github.com/argoproj/argo-workflows/v3)
32+
33+
### Java SDK
34+
35+
The [Java](https://github.com/argoproj/argo-workflows/blob/main/sdks/java) library is auto-generated using OpenAPI Generator.
36+
It is community supported.
37+
38+
### Hera Python SDK
2239

2340
Hera is the go-to Python SDK to make Argo Workflows simple and intuitive. It goes beyond a basic REST interface,
2441
allowing you to easily turn Python functions into script templates, and write whole Workflows in Python:

0 commit comments

Comments
 (0)