mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
commit
48a9ed3147
@ -252,7 +252,7 @@ type TypeMeta struct {
|
|||||||
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
|
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
|
||||||
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
||||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||||
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
|
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||||
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
|
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
|
||||||
|
|
||||||
// Annotations are unstructured key value data stored with a resource that may be set by
|
// Annotations are unstructured key value data stored with a resource that may be set by
|
||||||
|
@ -262,7 +262,7 @@ type TypeMeta struct {
|
|||||||
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
|
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
|
||||||
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
||||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||||
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
|
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||||
|
|
||||||
// Annotations are unstructured key value data stored with a resource that may be set by
|
// Annotations are unstructured key value data stored with a resource that may be set by
|
||||||
// external tooling. They are not queryable and should be preserved when modifying
|
// external tooling. They are not queryable and should be preserved when modifying
|
||||||
|
@ -260,7 +260,7 @@ type TypeMeta struct {
|
|||||||
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
|
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
|
||||||
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
||||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||||
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
|
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||||
|
|
||||||
// Annotations are unstructured key value data stored with a resource that may be set by
|
// Annotations are unstructured key value data stored with a resource that may be set by
|
||||||
// external tooling. They are not queryable and should be preserved when modifying
|
// external tooling. They are not queryable and should be preserved when modifying
|
||||||
|
@ -28,8 +28,8 @@ import (
|
|||||||
|
|
||||||
func expectPrefix(t *testing.T, prefix string, errs errors.ErrorList) {
|
func expectPrefix(t *testing.T, prefix string, errs errors.ErrorList) {
|
||||||
for i := range errs {
|
for i := range errs {
|
||||||
if !strings.HasPrefix(errs[i].(errors.ValidationError).Field, prefix) {
|
if f, p := errs[i].(errors.ValidationError).Field, prefix; !strings.HasPrefix(f, p) {
|
||||||
t.Errorf("expected prefix '%s' for %v", errs[i])
|
t.Errorf("expected prefix '%s' for field '%s' (%v)", p, f, errs[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@ func (kl *Kubelet) runOnce(pods []Pod) (results []RunPodResult, err error) {
|
|||||||
pods = filterHostPortConflicts(pods)
|
pods = filterHostPortConflicts(pods)
|
||||||
|
|
||||||
ch := make(chan RunPodResult)
|
ch := make(chan RunPodResult)
|
||||||
for _, pod := range pods {
|
for i := range pods {
|
||||||
|
pod := pods[i] // Make a copy
|
||||||
go func() {
|
go func() {
|
||||||
info, err := kl.runPod(pod)
|
info, err := kl.runPod(pod)
|
||||||
ch <- RunPodResult{&pod, info, err}
|
ch <- RunPodResult{&pod, info, err}
|
||||||
|
@ -44,12 +44,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// serviceConfig is a deserialized form of the config file format which ConfigSourceFile accepts.
|
// serviceConfig is a deserialized form of the config file format which ConfigSourceFile accepts.
|
||||||
|
// TODO: this is apparently untested; is it used?
|
||||||
type serviceConfig struct {
|
type serviceConfig struct {
|
||||||
Services []struct {
|
Services []struct {
|
||||||
Name string `json: "name"`
|
Name string `json: "name"`
|
||||||
Port int `json: "port"`
|
Port int `json: "port"`
|
||||||
Endpoints []string `json: "endpoints"`
|
Endpoints []string `json: "endpoints"`
|
||||||
} `json: "service"`
|
} `json:"service"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigSourceFile periodically reads service configurations in JSON from a file, and sends the services and endpoints defined in the file to the specified channels.
|
// ConfigSourceFile periodically reads service configurations in JSON from a file, and sends the services and endpoints defined in the file to the specified channels.
|
||||||
|
@ -75,7 +75,7 @@ func (r *HealthyRegistry) ListMinions(ctx api.Context) (currentMinions *api.Mini
|
|||||||
for _, minion := range list.Items {
|
for _, minion := range list.Items {
|
||||||
status, err := health.DoHTTPCheck(r.makeMinionURL(minion.ID), r.client)
|
status, err := health.DoHTTPCheck(r.makeMinionURL(minion.ID), r.client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("%s failed health check with error: %s", minion, err)
|
glog.Errorf("%#v failed health check with error: %s", minion, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if status == health.Healthy {
|
if status == health.Healthy {
|
||||||
|
@ -340,5 +340,4 @@ func (rs *REST) waitForPodRunning(ctx api.Context, pod *api.Pod) (runtime.Object
|
|||||||
time.Sleep(rs.podPollPeriod)
|
time.Sleep(rs.podPollPeriod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pod, nil
|
|
||||||
}
|
}
|
||||||
|
@ -368,6 +368,9 @@ func (s *Scheme) CopyOrDie(obj Object) Object {
|
|||||||
return newObj
|
return newObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ObjectDiff writes the two objects out as JSON and prints out the identical part of
|
||||||
|
// the objects followed by the remaining part of 'a' and finally the remaining part of 'b'.
|
||||||
|
// For debugging tests.
|
||||||
func ObjectDiff(a, b Object) string {
|
func ObjectDiff(a, b Object) string {
|
||||||
ab, err := json.Marshal(a)
|
ab, err := json.Marshal(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -378,10 +381,13 @@ func ObjectDiff(a, b Object) string {
|
|||||||
panic(fmt.Sprintf("b: %v", err))
|
panic(fmt.Sprintf("b: %v", err))
|
||||||
}
|
}
|
||||||
return util.StringDiff(string(ab), string(bb))
|
return util.StringDiff(string(ab), string(bb))
|
||||||
|
}
|
||||||
|
|
||||||
// An alternate diff attempt, in case json isn't showing you
|
// ObjectGoPrintDiff is like ObjectDiff, but uses go's %#v formatter to print the
|
||||||
// the difference. (reflect.DeepEqual makes a distinction between
|
// objects, in case json isn't showing you the difference. (reflect.DeepEqual makes
|
||||||
// nil and empty slices, for example.)
|
// a distinction between nil and empty slices, for example, even though nothing else
|
||||||
|
// really does.)
|
||||||
|
func ObjectGoPrintDiff(a, b Object) string {
|
||||||
return util.StringDiff(
|
return util.StringDiff(
|
||||||
fmt.Sprintf("%#v", a),
|
fmt.Sprintf("%#v", a),
|
||||||
fmt.Sprintf("%#v", b),
|
fmt.Sprintf("%#v", b),
|
||||||
|
Loading…
Reference in New Issue
Block a user