func (d ExistingDaemonSet) Create() error {
	return createExistingResource(d)
}
Create looks for existing DaemonSet and returns error if there is no such DaemonSet
package resources
import (
	"log"
	"github.com/Mirantis/k8s-AppController/pkg/client"
	"github.com/Mirantis/k8s-AppController/pkg/interfaces"
	"github.com/Mirantis/k8s-AppController/pkg/report"
	"k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
	"k8s.io/client-go/pkg/api/v1"
	extbeta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
)
var daemonSetParamFields = []string{
	"Spec.Template.Spec.Containers.Name",
	"Spec.Template.Spec.Containers.Env",
	"Spec.Template.Spec.InitContainers.Name",
	"Spec.Template.Spec.InitContainers.Env",
	"Spec.Template.ObjectMeta",
}
type DaemonSet struct {
	Base
	DaemonSet *extbeta1.DaemonSet
	Client    v1beta1.DaemonSetInterface
}
type daemonSetTemplateFactory struct{}
func (daemonSetTemplateFactory) ShortName(definition client.ResourceDefinition) string {
	if definition.DaemonSet == nil {
		return ""
	}
	return definition.DaemonSet.Name
}
func (daemonSetTemplateFactory) Kind() string {
	return "daemonset"
}
func (d daemonSetTemplateFactory) New(def client.ResourceDefinition, c client.Interface, gc interfaces.GraphContext) interfaces.Resource {
	newDaemonSet := parametrizeResource(def.DaemonSet, gc, daemonSetParamFields).(*extbeta1.DaemonSet)
	return report.SimpleReporter{BaseResource: DaemonSet{Base: Base{def.Meta}, DaemonSet: newDaemonSet, Client: c.DaemonSets()}}
}
func (d daemonSetTemplateFactory) NewExisting(name string, c client.Interface, gc interfaces.GraphContext) interfaces.Resource {
	return NewExistingDaemonSet(name, c.DaemonSets())
}
func daemonSetKey(name string) string {
	return "daemonset/" + name
}
func daemonSetStatus(d v1beta1.DaemonSetInterface, name string) (interfaces.ResourceStatus, error) {
	daemonSet, err := d.Get(name)
	if err != nil {
		return interfaces.ResourceError, err
	}
	if daemonSet.Status.CurrentNumberScheduled == daemonSet.Status.DesiredNumberScheduled {
		return interfaces.ResourceReady, nil
	}
	return interfaces.ResourceNotReady, nil
}
func (d DaemonSet) Key() string {
	return daemonSetKey(d.DaemonSet.Name)
}
func (d DaemonSet) Status(meta map[string]string) (interfaces.ResourceStatus, error) {
	return daemonSetStatus(d.Client, d.DaemonSet.Name)
}
func (d DaemonSet) Create() error {
	if err := checkExistence(d); err != nil {
		log.Println("Creating", d.Key())
		d.DaemonSet, err = d.Client.Create(d.DaemonSet)
		return err
	}
	return nil
}
func (d DaemonSet) Delete() error {
	return d.Client.Delete(d.DaemonSet.Name, &v1.DeleteOptions{})
}
type ExistingDaemonSet struct {
	Base
	Name   string
	Client v1beta1.DaemonSetInterface
}
func (d ExistingDaemonSet) Key() string {
	return daemonSetKey(d.Name)
}
func (d ExistingDaemonSet) Status(meta map[string]string) (interfaces.ResourceStatus, error) {
	return daemonSetStatus(d.Client, d.Name)
}