Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

Commit fc8e341

Browse files
authored
Merge pull request #80 from ericchiang/docs-fix
*: fix docs
2 parents 5912993 + 8d7776e commit fc8e341

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![GoDoc](https://godoc.org/github.com/ericchiang/k8s?status.svg)](https://godoc.org/github.com/ericchiang/k8s)
44

5-
A slimmed down Go client generated using Kubernetes' new [protocol buffer][protobuf] support. This package behaves similarly to [official Kubernetes' Go client][client-go], but only imports two external dependencies.
5+
A slimmed down Go client generated using Kubernetes' [protocol buffer][protobuf] support. This package behaves similarly to [official Kubernetes' Go client][client-go], but only imports two external dependencies.
66

77
```go
88
package main
@@ -32,14 +32,6 @@ func main() {
3232
}
3333
```
3434

35-
## Should I use this or client-go?
36-
37-
client-go is a framework for building production ready controllers, components that regularly watch API resources and push the system towards a desired state. If you're writing a program that watches several resources in a loop for long durations, client-go's informers framework is a battle tested solution which will scale with the size of the cluster.
38-
39-
This client should be used by programs that just need to talk to the Kubernetes API without prescriptive solutions for caching, reconciliation on failures, or work queues. This often includes components are relatively Kubernetes agnostic, but use the Kubernetes API for small tasks when running in Kubernetes. For example, performing leader election or persisting small amounts of state in annotations or configmaps.
40-
41-
TL;DR - Use client-go if you're writing a controller.
42-
4335
## Requirements
4436

4537
* Go 1.7+ (this package uses "context" features added in 1.7)
@@ -177,7 +169,7 @@ func init() {
177169

178170
Once registered, the library can use the custom resources like any other.
179171

180-
```
172+
```go
181173
func do(ctx context.Context, client *k8s.Client, namespace string) error {
182174
r := &MyResource{
183175
Metadata: &metav1.ObjectMeta{

client.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
Package k8s implements a Kubernetes client.
33
44
import (
5+
"context"
6+
57
"github.com/ericchiang/k8s"
68
appsv1 "github.com/ericchiang/k8s/apis/apps/v1"
7-
metav1 "github.com/ericchiang/k8s/apis/meta/v1"
89
)
910
10-
func listDeployments() (*apssv1.DeploymentList, error) {
11+
func listDeployments(ctx context.Context) (*appsv1.DeploymentList, error) {
1112
c, err := k8s.NewInClusterClient()
1213
if err != nil {
1314
return nil, err

0 commit comments

Comments
 (0)