Merge branch 'master' into image-pull-secret-fix
This commit is contained in:
		| @@ -393,7 +393,8 @@ func (k *kubernetes) Create(s *runtime.Service, opts ...runtime.CreateOption) er | ||||
| 	defer k.Unlock() | ||||
|  | ||||
| 	options := runtime.CreateOptions{ | ||||
| 		Type: k.options.Type, | ||||
| 		Type:      k.options.Type, | ||||
| 		Namespace: client.DefaultNamespace, | ||||
| 	} | ||||
| 	for _, o := range opts { | ||||
| 		o(&options) | ||||
| @@ -439,7 +440,10 @@ func (k *kubernetes) Read(opts ...runtime.ReadOption) ([]*runtime.Service, error | ||||
| 		"micro": k.options.Type, | ||||
| 	} | ||||
|  | ||||
| 	var options runtime.ReadOptions | ||||
| 	options := runtime.ReadOptions{ | ||||
| 		Namespace: client.DefaultNamespace, | ||||
| 	} | ||||
|  | ||||
| 	for _, o := range opts { | ||||
| 		o(&options) | ||||
| 	} | ||||
| @@ -457,7 +461,7 @@ func (k *kubernetes) Read(opts ...runtime.ReadOption) ([]*runtime.Service, error | ||||
| 		labels["micro"] = options.Type | ||||
| 	} | ||||
|  | ||||
| 	srvs, err := k.getService(labels) | ||||
| 	srvs, err := k.getService(labels, client.GetNamespace(options.Namespace)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| @@ -472,7 +476,10 @@ func (k *kubernetes) Read(opts ...runtime.ReadOption) ([]*runtime.Service, error | ||||
|  | ||||
| // Update the service in place | ||||
| func (k *kubernetes) Update(s *runtime.Service, opts ...runtime.UpdateOption) error { | ||||
| 	var options runtime.UpdateOptions | ||||
| 	options := runtime.UpdateOptions{ | ||||
| 		Namespace: client.DefaultNamespace, | ||||
| 	} | ||||
|  | ||||
| 	for _, o := range opts { | ||||
| 		o(&options) | ||||
| 	} | ||||
| @@ -521,7 +528,10 @@ func (k *kubernetes) Update(s *runtime.Service, opts ...runtime.UpdateOption) er | ||||
|  | ||||
| // Delete removes a service | ||||
| func (k *kubernetes) Delete(s *runtime.Service, opts ...runtime.DeleteOption) error { | ||||
| 	var options runtime.DeleteOptions | ||||
| 	options := runtime.DeleteOptions{ | ||||
| 		Namespace: client.DefaultNamespace, | ||||
| 	} | ||||
|  | ||||
| 	for _, o := range opts { | ||||
| 		o(&options) | ||||
| 	} | ||||
|   | ||||
| @@ -24,11 +24,16 @@ func (k *klog) podLogStream(podName string, stream *kubeStream) error { | ||||
| 	p := make(map[string]string) | ||||
| 	p["follow"] = "true" | ||||
| 
 | ||||
| 	opts := []client.LogOption{ | ||||
| 		client.LogParams(p), | ||||
| 		client.LogNamespace(k.options.Namespace), | ||||
| 	} | ||||
| 
 | ||||
| 	// get the logs for the pod | ||||
| 	body, err := k.client.Log(&client.Resource{ | ||||
| 		Name: podName, | ||||
| 		Kind: "pod", | ||||
| 	}, client.LogParams(p)) | ||||
| 	}, opts...) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		stream.err = err | ||||
| @@ -70,7 +75,12 @@ func (k *klog) getMatchingPods() ([]string, error) { | ||||
| 	// TODO: specify micro:service | ||||
| 	// l["micro"] = "service" | ||||
| 
 | ||||
| 	if err := k.client.Get(r, client.GetLabels(l)); err != nil { | ||||
| 	opts := []client.GetOption{ | ||||
| 		client.GetLabels(l), | ||||
| 		client.GetNamespace(k.options.Namespace), | ||||
| 	} | ||||
| 
 | ||||
| 	if err := k.client.Get(r, opts...); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| @@ -109,10 +119,15 @@ func (k *klog) Read() ([]runtime.LogRecord, error) { | ||||
| 			logParams["follow"] = "true" | ||||
| 		} | ||||
| 
 | ||||
| 		opts := []client.LogOption{ | ||||
| 			client.LogParams(logParams), | ||||
| 			client.LogNamespace(k.options.Namespace), | ||||
| 		} | ||||
| 
 | ||||
| 		logs, err := k.client.Log(&client.Resource{ | ||||
| 			Name: pod, | ||||
| 			Kind: "pod", | ||||
| 		}, client.LogParams(logParams)) | ||||
| 		}, opts...) | ||||
| 
 | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| @@ -162,13 +177,18 @@ func (k *klog) Stream() (runtime.LogStream, error) { | ||||
| } | ||||
| 
 | ||||
| // NewLog returns a configured Kubernetes logger | ||||
| func newLog(client client.Client, serviceName string, opts ...runtime.LogsOption) *klog { | ||||
| 	klog := &klog{ | ||||
| 		serviceName: serviceName, | ||||
| 		client:      client, | ||||
| func newLog(c client.Client, serviceName string, opts ...runtime.LogsOption) *klog { | ||||
| 	options := runtime.LogsOptions{ | ||||
| 		Namespace: client.DefaultNamespace, | ||||
| 	} | ||||
| 	for _, o := range opts { | ||||
| 		o(&klog.options) | ||||
| 		o(&options) | ||||
| 	} | ||||
| 
 | ||||
| 	klog := &klog{ | ||||
| 		serviceName: serviceName, | ||||
| 		client:      c, | ||||
| 		options:     options, | ||||
| 	} | ||||
| 
 | ||||
| 	return klog | ||||
		Reference in New Issue
	
	Block a user