Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
Add FromK8sClient (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
thcyron authored May 22, 2020
1 parent 2d8e8f5 commit 09aca18
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

## master

- Add FromK8sClient() to get an implementation of the Client interface backed
by a *k8s.Client

## v1.0.0

- Initial release
6 changes: 6 additions & 0 deletions skop/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ type Watcher interface {
Close() error
}

// FromK8sClient provides an implementation of the Client interface
// backed by the provided *k8s.Client.
func FromK8sClient(c *k8s.Client) Client {
return &k8sClientAdapter{c}
}

type k8sClientAdapter struct {
c *k8s.Client
}
Expand Down
2 changes: 1 addition & 1 deletion skop/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func WithClient(client interface{}) Option {
return func(op *Operator) {
switch c := client.(type) {
case *k8s.Client:
op.client = &k8sClientAdapter{c}
op.client = FromK8sClient(c)
case Client:
op.client = c
default:
Expand Down

0 comments on commit 09aca18

Please sign in to comment.