-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
11 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: Test conformance | ||
name: Test | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
create-cluster: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -24,7 +24,7 @@ jobs: | |
- name: Build Go binary | ||
run: | | ||
cd ./conformance | ||
go build -ldflags "-s -w" -o conformance . | ||
go build -ldflags "-s -w" -o bin/conformance . | ||
env: | ||
GOOS: linux | ||
GOARCH: amd64 | ||
|
@@ -41,12 +41,13 @@ jobs: | |
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./conformance | ||
push: true | ||
tags: ghcr.io/castai/k8s-client-go/conformance:${{ github.sha }} | ||
|
||
- name: Create k8s cluster | ||
uses: helm/[email protected] | ||
|
||
- name: Run conformance | ||
- name: Run tests | ||
run: | | ||
cd ./conformance | ||
./run.sh | ||
IMG=ghcr.io/castai/k8s-client-go/conformance:${{ github.sha }} ./run.sh |
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 |
---|---|---|
@@ -1,3 +1,34 @@ | ||
# k8s-client-go | ||
|
||
Minimal Go Kubernetes client | ||
Minimal Go Kubernetes client based on Generics | ||
|
||
## Usage | ||
|
||
```go | ||
import ( | ||
"context" | ||
"log" | ||
"fmt" | ||
client "github.com/castai/k8s-client-go" | ||
) | ||
|
||
func main() { | ||
kc, err := client.NewInCluster() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
ctx := context.Backgroud() | ||
endpoints, err := client.Get[*client.Endpoints](kc, ctx, "/api/v1/namespaces/kube-system/endpoints/kubelet", client.GetOptions{}) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Printf("%+v", endpoints) | ||
} | ||
``` | ||
|
||
See more in [Examples](https://github.com/castai/k8s-client-go/blob/master/client_test.go#L10) | ||
|
||
## Use cases | ||
|
||
* Embedding in Go applications for minimal binary size overhead. | ||
* Service discovery by listing and watching [endpoints](https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoints-v1/). See [kuberesolver](https://github.com/sercand/kuberesolver) as example for gRPC client side load balancing. |
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
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