fix:rename kube to kubernetes (#1393)

* fix:update config and registry readme

* rename kute to kubernetes

* fix

* fix
pull/1396/head
yuemoxi 3 years ago committed by GitHub
parent 112ca9c78a
commit a1f35ecc05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      config/README.md
  2. 0
      config/kubernetes/README.md
  3. 22
      config/kubernetes/config.go
  4. 2
      config/kubernetes/config_test.go
  5. 2
      config/kubernetes/example.go
  6. 2
      config/kubernetes/go.mod
  7. 0
      config/kubernetes/go.sum
  8. 6
      config/kubernetes/watcher.go
  9. 2
      config/kubernetes/watcher_test.go
  10. 5
      registry/README.md
  11. 2
      registry/kubernetes/go.mod
  12. 0
      registry/kubernetes/go.sum
  13. 2
      registry/kubernetes/registry.go

@ -1,5 +1,27 @@
# Config # Config
* [Consul](https://github.com/go-kratos/consul)
* [Etcd](https://github.com/go-kratos/etcd)
* [Kube](https://github.com/go-kratos/kube)
## Consul
```shell
go get -u github.com/go-kratos/kratos/registry/consul/v2
```
## Etcd
```shell
go get -u github.com/go-kratos/kratos/registry/etcd/v2
```
## zookeeper
```shell
go get -u github.com/go-kratos/kratos/registry/zookeeper/v2
```
## Nacos
```shell
go get -u github.com/go-kratos/kratos/registry/nacos/v2
```
## kube
```shell
go get -u github.com/go-kratos/kratos/config/kubernetes/v2
```

@ -1,4 +1,4 @@
package main package kubernetes
import ( import (
"context" "context"
@ -13,15 +13,15 @@ import (
"k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd"
) )
// Option is kube option. // Option is kubernetes option.
type Option func(*options) type Option func(*options)
type options struct { type options struct {
// kube namespace // kubernetes namespace
Namespace string Namespace string
// kube labelSelector example `app=test` // kubernetes labelSelector example `app=test`
LabelSelector string LabelSelector string
// kube fieldSelector example `app=test` // kubernetes fieldSelector example `app=test`
FieldSelector string FieldSelector string
// set KubeConfig out-of-cluster Use outside cluster // set KubeConfig out-of-cluster Use outside cluster
KubeConfig string KubeConfig string
@ -29,35 +29,35 @@ type options struct {
Master string Master string
} }
// Namespace with kube namespace. // Namespace with kubernetes namespace.
func Namespace(ns string) Option { func Namespace(ns string) Option {
return func(o *options) { return func(o *options) {
o.Namespace = ns o.Namespace = ns
} }
} }
// LabelSelector with kube label selector. // LabelSelector with kubernetes label selector.
func LabelSelector(label string) Option { func LabelSelector(label string) Option {
return func(o *options) { return func(o *options) {
o.LabelSelector = label o.LabelSelector = label
} }
} }
// FieldSelector with kube field selector. // FieldSelector with kubernetes field selector.
func FieldSelector(field string) Option { func FieldSelector(field string) Option {
return func(o *options) { return func(o *options) {
o.FieldSelector = field o.FieldSelector = field
} }
} }
// KubeConfig with kube config. // KubeConfig with kubernetes config.
func KubeConfig(config string) Option { func KubeConfig(config string) Option {
return func(o *options) { return func(o *options) {
o.KubeConfig = config o.KubeConfig = config
} }
} }
// Master with kube master. // Master with kubernetes master.
func Master(master string) Option { func Master(master string) Option {
return func(o *options) { return func(o *options) {
o.Master = master o.Master = master
@ -69,7 +69,7 @@ type kube struct {
client *kubernetes.Clientset client *kubernetes.Clientset
} }
// NewSource new a kube config source. // NewSource new a kubernetes config source.
func NewSource(opts ...Option) config.Source { func NewSource(opts ...Option) config.Source {
options := options{} options := options{}
for _, o := range opts { for _, o := range opts {

@ -1,4 +1,4 @@
package main package kubernetes
import ( import (
"path/filepath" "path/filepath"

@ -1,4 +1,4 @@
package main package kubernetes
import ( import (
"log" "log"

@ -1,4 +1,4 @@
module github.com/go-kratos/kratos/config/kube/v2 module github.com/go-kratos/kratos/config/kubernetes/v2
go 1.15 go 1.15

@ -1,4 +1,4 @@
package main package kubernetes
import ( import (
"context" "context"
@ -46,10 +46,10 @@ ResultChan:
} }
cm, ok := ch.Object.(*v1.ConfigMap) cm, ok := ch.Object.(*v1.ConfigMap)
if !ok { if !ok {
return nil, fmt.Errorf("kube Object not ConfigMap") return nil, fmt.Errorf("kubernetes Object not ConfigMap")
} }
if ch.Type == "DELETED" { if ch.Type == "DELETED" {
return nil, fmt.Errorf("kube configmap delete %s", cm.Name) return nil, fmt.Errorf("kubernetes configmap delete %s", cm.Name)
} }
return w.k.configMap(*cm), nil return w.k.configMap(*cm), nil
} }

@ -1,4 +1,4 @@
package main package kubernetes
import ( import (
"context" "context"

@ -19,3 +19,8 @@ go get -u github.com/go-kratos/kratos/registry/zookeeper/v2
```shell ```shell
go get -u github.com/go-kratos/kratos/registry/nacos/v2 go get -u github.com/go-kratos/kratos/registry/nacos/v2
``` ```
## kubernetes
```shell
go get -u github.com/go-kratos/kratos/registry/kubernetes/v2
```

@ -1,4 +1,4 @@
module github.com/go-kratos/kratos/registry/kube/v2 module github.com/go-kratos/kratos/registry/kubernetes/v2
go 1.17 go 1.17

@ -1,5 +1,5 @@
// The package registry simply implements the Kubernetes-based Registry // The package registry simply implements the Kubernetes-based Registry
package kute package kubernetes
import ( import (
"context" "context"
Loading…
Cancel
Save