Skip to content

Commit

Permalink
fixes manifest/api-group foo
Browse files Browse the repository at this point in the history
  • Loading branch information
BugRoger committed Jan 12, 2018
1 parent 57ad5cd commit db36639
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions pkg/controller/ground/bootstrap/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"html/template"

apps "k8s.io/api/apps/v1beta1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand Down Expand Up @@ -135,38 +135,36 @@ func createKubeDNSService(client clientset.Interface, clusterIP string) error {
return nil
}

func getKubeDNSDeployment(options *DeploymentOptions) (*apps.Deployment, error) {
func getKubeDNSDeployment(options *DeploymentOptions) (*extensions.Deployment, error) {
manifest := KubeDNSDeployment_v20171016
deployment := &apps.Deployment{}

template, err := RenderManifest(manifest, options)
if err != nil {
return nil, err
}

_, _, err = serializer.NewCodecFactory(clientsetscheme.Scheme).UniversalDeserializer().Decode(template, nil, deployment)
deployment, _, err := serializer.NewCodecFactory(clientsetscheme.Scheme).UniversalDeserializer().Decode(template, nil, &extensions.Deployment{})
if err != nil {
return nil, err
}

return deployment, nil
return deployment.(*extensions.Deployment), nil
}

func getKubeDNSService(options *ServiceOptions) (*v1.Service, error) {
manifest := KubeDNSService_v20171016
service := &v1.Service{}

template, err := RenderManifest(manifest, options)
if err != nil {
return nil, err
}

_, _, err = serializer.NewCodecFactory(clientsetscheme.Scheme).UniversalDeserializer().Decode(template, nil, service)
service, _, err := serializer.NewCodecFactory(clientsetscheme.Scheme).UniversalDeserializer().Decode(template, nil, &v1.Service{})
if err != nil {
return nil, err
}

return service, nil
return service.(*v1.Service), nil
}

func CreateOrUpdateServiceAccount(client clientset.Interface, sa *v1.ServiceAccount) error {
Expand All @@ -178,13 +176,13 @@ func CreateOrUpdateServiceAccount(client clientset.Interface, sa *v1.ServiceAcco
return nil
}

func CreateOrUpdateDeployment(client clientset.Interface, deploy *apps.Deployment) error {
if _, err := client.AppsV1beta1().Deployments(deploy.ObjectMeta.Namespace).Create(deploy); err != nil {
func CreateOrUpdateDeployment(client clientset.Interface, deploy *extensions.Deployment) error {
if _, err := client.ExtensionsV1beta1().Deployments(deploy.ObjectMeta.Namespace).Create(deploy); err != nil {
if !apierrors.IsAlreadyExists(err) {
return fmt.Errorf("unable to create deployment: %v", err)
}

if _, err := client.AppsV1beta1().Deployments(deploy.ObjectMeta.Namespace).Update(deploy); err != nil {
if _, err := client.ExtensionsV1beta1().Deployments(deploy.ObjectMeta.Namespace).Update(deploy); err != nil {
return fmt.Errorf("unable to update deployment: %v", err)
}
}
Expand Down

0 comments on commit db36639

Please sign in to comment.