Skip to content

Commit

Permalink
Remove AssignTypeKind and GetGroupVersionKind util methods (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed May 9, 2018
1 parent e18f3fe commit 941c9a4
Show file tree
Hide file tree
Showing 47 changed files with 5,754 additions and 1,026 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package util

import (
"encoding/json"

"github.com/appscode/kutil"
api "github.com/appscode/voyager/apis/voyager/v1beta1"
cs "github.com/appscode/voyager/client/clientset/versioned/typed/voyager/v1beta1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package util

import (
"encoding/json"

"github.com/appscode/kutil"
api "github.com/appscode/voyager/apis/voyager/v1beta1"
cs "github.com/appscode/voyager/client/clientset/versioned/typed/voyager/v1beta1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
package util

import (
"github.com/appscode/kutil/meta"
api "github.com/appscode/voyager/apis/voyager/v1beta1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/json-iterator/go"
)

func GetGroupVersionKind(v interface{}) schema.GroupVersionKind {
return api.SchemeGroupVersion.WithKind(meta.GetKind(v))
}

func AssignTypeKind(v interface{}) error {
_, err := conversion.EnforcePtr(v)
if err != nil {
return err
}

switch u := v.(type) {
case *api.Ingress:
u.APIVersion = api.SchemeGroupVersion.String()
u.Kind = api.ResourceKindIngress
return nil
case *api.Certificate:
u.APIVersion = api.SchemeGroupVersion.String()
u.Kind = api.ResourceKindCertificate
return nil
}
return errors.New("unknown api object type")
}
var json = jsoniter.ConfigFastest
21 changes: 16 additions & 5 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/e2e/tcp-sni.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var _ = Describe("Ingress TCP SNI", func() {
IngressRuleValue: api.IngressRuleValue{
TCP: &api.TCPIngressRuleValue{
NoTLS: true,
Port: intstr.FromInt(8443),
Port: intstr.FromInt(8443),
Backend: api.IngressBackend{
ServiceName: f.Ingress.TestServerHTTPSName(),
ServicePort: intstr.FromInt(443),
Expand Down
46 changes: 46 additions & 0 deletions vendor/github.com/appscode/kutil/core/v1/pod.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 941c9a4

Please sign in to comment.