Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/apis/application/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ const (
type HookStatus struct {
// Name is the resource name
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Name is the resource name
// Kind is the resource kind
Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"`
// Name is the resource name
// APIVersion is the resource API version
APIVersion string `json:"apiVersion" protobuf:"bytes,3,opt,name=apiVersion"`
// Type is the type of hook (e.g. PreSync, Sync, PostSync, Skip)
Type HookType `json:"type" protobuf:"bytes,4,opt,name=type"`
Expand Down
6 changes: 3 additions & 3 deletions util/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"k8s.io/api/apps/v1"
appsv1 "k8s.io/api/apps/v1"
coreV1 "k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
extv1beta1 "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"

Expand Down Expand Up @@ -59,11 +59,11 @@ func IsWorse(current, new appv1.HealthStatusCode) bool {
}

func getIngressHealth(obj *unstructured.Unstructured) (*appv1.HealthStatus, error) {
obj, err := kube.ConvertToVersion(obj, "", "v1")
obj, err := kube.ConvertToVersion(obj, "extensions", "v1beta1")
if err != nil {
return nil, err
}
var ingress v1beta1.Ingress
var ingress extv1beta1.Ingress
err = runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, &ingress)
if err != nil {
return nil, err
Expand Down
6 changes: 5 additions & 1 deletion util/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ func ConvertToVersion(obj *unstructured.Unstructured, group, version string) (*u
cmd.Stdin = bytes.NewReader(manifestBytes)
out, err := cmd.Output()
if err != nil {
return nil, err
if exErr, ok := err.(*exec.ExitError); ok {
errMsg := cleanKubectlOutput(string(exErr.Stderr))
return nil, errors.New(errMsg)
}
return nil, fmt.Errorf("failed to convert %s/%s to %s/%s", obj.GetKind(), obj.GetName(), group, version)
}
// NOTE: when kubectl convert runs against stdin (i.e. kubectl convert -f -), the output is
// a unstructured list instead of an unstructured object
Expand Down