Commit 16f7aaab authored by Darren Shepherd's avatar Darren Shepherd

Update vendor

parent 03885fc3
package v1
import (
"github.com/rancher/norman/pkg/dynamiclistener"
"github.com/rancher/norman/types"
"github.com/rancher/dynamiclistener"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/intstr"
)
type ListenerConfig struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
......@@ -18,8 +15,6 @@ type ListenerConfig struct {
}
type Addon struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
......@@ -37,8 +32,6 @@ type AddonStatus struct {
}
type HelmChart struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
......
......@@ -162,6 +162,9 @@ import:
version: 89fcab3d43de07060e4fd4c1547430ed57e87f24
- package: github.com/lithammer/dedent
version: v1.1.0
- package: github.com/matryer/moq
version: ee5226d43009
repo: https://github.com/rancher/moq.git
- package: github.com/mattn/go-shellwords
version: v1.0.3-20-gf8471b0a71ded0
- package: github.com/mattn/go-sqlite3
......@@ -216,9 +219,16 @@ import:
version: v0.2.0
- package: github.com/prometheus/procfs
version: 65c1f6f8f0fc1e2185eb9863a3bc751496404259
- package: github.com/rancher/norman
version: 50017efee23caa79542ef685b65a7b783e0a73ca
repo: https://github.com/ibuildthecloud/norman.git
- package: github.com/rancher/dynamiclistener
version: 077eb13a904f2c62496f31b158135d9743526f82
- package: github.com/rancher/helm-controller
version: 4f3b43bfd868bcb74fe847f8df88c482e9b70ff8
- package: github.com/rancher/remotedialer
version: 20ec38853712bb6d348f0db9ac47d34c954c6b00
- package: github.com/rancher/wrangler
version: 4202dbfa88013c19238bb004d82e013f0593493d
- package: github.com/rancher/wrangler-api
version: efe26ac6a9d720e1bfa5a8cc5f8dce5ad598ce26
- package: github.com/robfig/cron
version: v1-53-gdf38d32658d878
- package: github.com/rootless-containers/rootlesskit
......
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type DaemonSetLifecycle interface {
Create(obj *v1.DaemonSet) (runtime.Object, error)
Remove(obj *v1.DaemonSet) (runtime.Object, error)
Updated(obj *v1.DaemonSet) (runtime.Object, error)
}
type daemonSetLifecycleAdapter struct {
lifecycle DaemonSetLifecycle
}
func (w *daemonSetLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *daemonSetLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *daemonSetLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func (w *daemonSetLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func (w *daemonSetLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.DaemonSet))
if o == nil {
return nil, err
}
return o, err
}
func NewDaemonSetLifecycleAdapter(name string, clusterScoped bool, client DaemonSetInterface, l DaemonSetLifecycle) DaemonSetHandlerFunc {
adapter := &daemonSetLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.DaemonSet) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type DeploymentLifecycle interface {
Create(obj *v1.Deployment) (runtime.Object, error)
Remove(obj *v1.Deployment) (runtime.Object, error)
Updated(obj *v1.Deployment) (runtime.Object, error)
}
type deploymentLifecycleAdapter struct {
lifecycle DeploymentLifecycle
}
func (w *deploymentLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *deploymentLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *deploymentLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Deployment))
if o == nil {
return nil, err
}
return o, err
}
func (w *deploymentLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Deployment))
if o == nil {
return nil, err
}
return o, err
}
func (w *deploymentLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Deployment))
if o == nil {
return nil, err
}
return o, err
}
func NewDeploymentLifecycleAdapter(name string, clusterScoped bool, client DeploymentInterface, l DeploymentLifecycle) DeploymentHandlerFunc {
adapter := &deploymentLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Deployment) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
DaemonSetsGetter
DeploymentsGetter
}
type Clients struct {
Interface Interface
DaemonSet DaemonSetClient
Deployment DeploymentClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
daemonSetControllers map[string]DaemonSetController
deploymentControllers map[string]DeploymentController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
DaemonSet: &daemonSetClient2{
iface: iface.DaemonSets(""),
},
Deployment: &deploymentClient2{
iface: iface.Deployments(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
daemonSetControllers: map[string]DaemonSetController{},
deploymentControllers: map[string]DeploymentController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type DaemonSetsGetter interface {
DaemonSets(namespace string) DaemonSetInterface
}
func (c *Client) DaemonSets(namespace string) DaemonSetInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DaemonSetResource, DaemonSetGroupVersionKind, daemonSetFactory{})
return &daemonSetClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type DeploymentsGetter interface {
Deployments(namespace string) DeploymentInterface
}
func (c *Client) Deployments(namespace string) DeploymentInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DeploymentResource, DeploymentGroupVersionKind, deploymentFactory{})
return &deploymentClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "apps"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&DaemonSetList{},
&DeploymentList{},
)
return nil
}
package v1
import (
batchv1 "k8s.io/api/batch/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobList) DeepCopyInto(out *JobList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]batchv1.Job, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobList.
func (in *JobList) DeepCopy() *JobList {
if in == nil {
return nil
}
out := new(JobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *JobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type JobLifecycle interface {
Create(obj *v1.Job) (runtime.Object, error)
Remove(obj *v1.Job) (runtime.Object, error)
Updated(obj *v1.Job) (runtime.Object, error)
}
type jobLifecycleAdapter struct {
lifecycle JobLifecycle
}
func (w *jobLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *jobLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *jobLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Job))
if o == nil {
return nil, err
}
return o, err
}
func (w *jobLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Job))
if o == nil {
return nil, err
}
return o, err
}
func (w *jobLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Job))
if o == nil {
return nil, err
}
return o, err
}
func NewJobLifecycleAdapter(name string, clusterScoped bool, client JobInterface, l JobLifecycle) JobHandlerFunc {
adapter := &jobLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Job) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
JobsGetter
}
type Clients struct {
Interface Interface
Job JobClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
jobControllers map[string]JobController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Job: &jobClient2{
iface: iface.Jobs(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
jobControllers: map[string]JobController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type JobsGetter interface {
Jobs(namespace string) JobInterface
}
func (c *Client) Jobs(namespace string) JobInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &JobResource, JobGroupVersionKind, jobFactory{})
return &jobClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "batch"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&JobList{},
)
return nil
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ConfigMapLifecycle interface {
Create(obj *v1.ConfigMap) (runtime.Object, error)
Remove(obj *v1.ConfigMap) (runtime.Object, error)
Updated(obj *v1.ConfigMap) (runtime.Object, error)
}
type configMapLifecycleAdapter struct {
lifecycle ConfigMapLifecycle
}
func (w *configMapLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *configMapLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *configMapLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.ConfigMap))
if o == nil {
return nil, err
}
return o, err
}
func (w *configMapLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.ConfigMap))
if o == nil {
return nil, err
}
return o, err
}
func (w *configMapLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.ConfigMap))
if o == nil {
return nil, err
}
return o, err
}
func NewConfigMapLifecycleAdapter(name string, clusterScoped bool, client ConfigMapInterface, l ConfigMapLifecycle) ConfigMapHandlerFunc {
adapter := &configMapLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ConfigMap) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
corev1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConfigMapList) DeepCopyInto(out *ConfigMapList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.ConfigMap, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapList.
func (in *ConfigMapList) DeepCopy() *ConfigMapList {
if in == nil {
return nil
}
out := new(ConfigMapList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ConfigMapList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EndpointsList) DeepCopyInto(out *EndpointsList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Endpoints, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointsList.
func (in *EndpointsList) DeepCopy() *EndpointsList {
if in == nil {
return nil
}
out := new(EndpointsList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *EndpointsList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeList) DeepCopyInto(out *NodeList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Node, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList.
func (in *NodeList) DeepCopy() *NodeList {
if in == nil {
return nil
}
out := new(NodeList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NodeList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodList) DeepCopyInto(out *PodList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Pod, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodList.
func (in *PodList) DeepCopy() *PodList {
if in == nil {
return nil
}
out := new(PodList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceAccountList) DeepCopyInto(out *ServiceAccountList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.ServiceAccount, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountList.
func (in *ServiceAccountList) DeepCopy() *ServiceAccountList {
if in == nil {
return nil
}
out := new(ServiceAccountList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ServiceAccountList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceList) DeepCopyInto(out *ServiceList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]corev1.Service, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceList.
func (in *ServiceList) DeepCopy() *ServiceList {
if in == nil {
return nil
}
out := new(ServiceList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ServiceList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type EndpointsLifecycle interface {
Create(obj *v1.Endpoints) (runtime.Object, error)
Remove(obj *v1.Endpoints) (runtime.Object, error)
Updated(obj *v1.Endpoints) (runtime.Object, error)
}
type endpointsLifecycleAdapter struct {
lifecycle EndpointsLifecycle
}
func (w *endpointsLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *endpointsLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *endpointsLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Endpoints))
if o == nil {
return nil, err
}
return o, err
}
func (w *endpointsLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Endpoints))
if o == nil {
return nil, err
}
return o, err
}
func (w *endpointsLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Endpoints))
if o == nil {
return nil, err
}
return o, err
}
func NewEndpointsLifecycleAdapter(name string, clusterScoped bool, client EndpointsInterface, l EndpointsLifecycle) EndpointsHandlerFunc {
adapter := &endpointsLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Endpoints) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
NodesGetter
ServiceAccountsGetter
EndpointsGetter
ServicesGetter
PodsGetter
ConfigMapsGetter
}
type Clients struct {
Interface Interface
Node NodeClient
ServiceAccount ServiceAccountClient
Endpoints EndpointsClient
Service ServiceClient
Pod PodClient
ConfigMap ConfigMapClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
nodeControllers map[string]NodeController
serviceAccountControllers map[string]ServiceAccountController
endpointsControllers map[string]EndpointsController
serviceControllers map[string]ServiceController
podControllers map[string]PodController
configMapControllers map[string]ConfigMapController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Node: &nodeClient2{
iface: iface.Nodes(""),
},
ServiceAccount: &serviceAccountClient2{
iface: iface.ServiceAccounts(""),
},
Endpoints: &endpointsClient2{
iface: iface.Endpoints(""),
},
Service: &serviceClient2{
iface: iface.Services(""),
},
Pod: &podClient2{
iface: iface.Pods(""),
},
ConfigMap: &configMapClient2{
iface: iface.ConfigMaps(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
nodeControllers: map[string]NodeController{},
serviceAccountControllers: map[string]ServiceAccountController{},
endpointsControllers: map[string]EndpointsController{},
serviceControllers: map[string]ServiceController{},
podControllers: map[string]PodController{},
configMapControllers: map[string]ConfigMapController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type NodesGetter interface {
Nodes(namespace string) NodeInterface
}
func (c *Client) Nodes(namespace string) NodeInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &NodeResource, NodeGroupVersionKind, nodeFactory{})
return &nodeClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ServiceAccountsGetter interface {
ServiceAccounts(namespace string) ServiceAccountInterface
}
func (c *Client) ServiceAccounts(namespace string) ServiceAccountInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ServiceAccountResource, ServiceAccountGroupVersionKind, serviceAccountFactory{})
return &serviceAccountClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type EndpointsGetter interface {
Endpoints(namespace string) EndpointsInterface
}
func (c *Client) Endpoints(namespace string) EndpointsInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &EndpointsResource, EndpointsGroupVersionKind, endpointsFactory{})
return &endpointsClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ServicesGetter interface {
Services(namespace string) ServiceInterface
}
func (c *Client) Services(namespace string) ServiceInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ServiceResource, ServiceGroupVersionKind, serviceFactory{})
return &serviceClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type PodsGetter interface {
Pods(namespace string) PodInterface
}
func (c *Client) Pods(namespace string) PodInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &PodResource, PodGroupVersionKind, podFactory{})
return &podClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ConfigMapsGetter interface {
ConfigMaps(namespace string) ConfigMapInterface
}
func (c *Client) ConfigMaps(namespace string) ConfigMapInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ConfigMapResource, ConfigMapGroupVersionKind, configMapFactory{})
return &configMapClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type NodeLifecycle interface {
Create(obj *v1.Node) (runtime.Object, error)
Remove(obj *v1.Node) (runtime.Object, error)
Updated(obj *v1.Node) (runtime.Object, error)
}
type nodeLifecycleAdapter struct {
lifecycle NodeLifecycle
}
func (w *nodeLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *nodeLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *nodeLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Node))
if o == nil {
return nil, err
}
return o, err
}
func (w *nodeLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Node))
if o == nil {
return nil, err
}
return o, err
}
func (w *nodeLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Node))
if o == nil {
return nil, err
}
return o, err
}
func NewNodeLifecycleAdapter(name string, clusterScoped bool, client NodeInterface, l NodeLifecycle) NodeHandlerFunc {
adapter := &nodeLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Node) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type PodLifecycle interface {
Create(obj *v1.Pod) (runtime.Object, error)
Remove(obj *v1.Pod) (runtime.Object, error)
Updated(obj *v1.Pod) (runtime.Object, error)
}
type podLifecycleAdapter struct {
lifecycle PodLifecycle
}
func (w *podLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *podLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *podLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Pod))
if o == nil {
return nil, err
}
return o, err
}
func (w *podLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Pod))
if o == nil {
return nil, err
}
return o, err
}
func (w *podLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Pod))
if o == nil {
return nil, err
}
return o, err
}
func NewPodLifecycleAdapter(name string, clusterScoped bool, client PodInterface, l PodLifecycle) PodHandlerFunc {
adapter := &podLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Pod) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = ""
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&NodeList{},
&ServiceAccountList{},
&EndpointsList{},
&ServiceList{},
&PodList{},
&ConfigMapList{},
)
return nil
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ServiceAccountLifecycle interface {
Create(obj *v1.ServiceAccount) (runtime.Object, error)
Remove(obj *v1.ServiceAccount) (runtime.Object, error)
Updated(obj *v1.ServiceAccount) (runtime.Object, error)
}
type serviceAccountLifecycleAdapter struct {
lifecycle ServiceAccountLifecycle
}
func (w *serviceAccountLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *serviceAccountLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *serviceAccountLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.ServiceAccount))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceAccountLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.ServiceAccount))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceAccountLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.ServiceAccount))
if o == nil {
return nil, err
}
return o, err
}
func NewServiceAccountLifecycleAdapter(name string, clusterScoped bool, client ServiceAccountInterface, l ServiceAccountLifecycle) ServiceAccountHandlerFunc {
adapter := &serviceAccountLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ServiceAccount) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ServiceLifecycle interface {
Create(obj *v1.Service) (runtime.Object, error)
Remove(obj *v1.Service) (runtime.Object, error)
Updated(obj *v1.Service) (runtime.Object, error)
}
type serviceLifecycleAdapter struct {
lifecycle ServiceLifecycle
}
func (w *serviceLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *serviceLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *serviceLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.Service))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.Service))
if o == nil {
return nil, err
}
return o, err
}
func (w *serviceLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.Service))
if o == nil {
return nil, err
}
return o, err
}
func NewServiceLifecycleAdapter(name string, clusterScoped bool, client ServiceInterface, l ServiceLifecycle) ServiceHandlerFunc {
adapter := &serviceLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.Service) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/factory"
)
var (
APIVersion = types.APIVersion{
Version: "v1",
Group: "k3s.cattle.io",
Path: "/v1-k3s",
}
Schemas = factory.Schemas(&APIVersion).
MustImport(&APIVersion, Addon{}).
MustImport(&APIVersion, HelmChart{}).
MustImport(&APIVersion, ListenerConfig{})
)
package v1
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type AddonLifecycle interface {
Create(obj *Addon) (runtime.Object, error)
Remove(obj *Addon) (runtime.Object, error)
Updated(obj *Addon) (runtime.Object, error)
}
type addonLifecycleAdapter struct {
lifecycle AddonLifecycle
}
func (w *addonLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *addonLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *addonLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*Addon))
if o == nil {
return nil, err
}
return o, err
}
func (w *addonLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*Addon))
if o == nil {
return nil, err
}
return o, err
}
func (w *addonLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*Addon))
if o == nil {
return nil, err
}
return o, err
}
func NewAddonLifecycleAdapter(name string, clusterScoped bool, client AddonInterface, l AddonLifecycle) AddonHandlerFunc {
adapter := &addonLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *Addon) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
intstr "k8s.io/apimachinery/pkg/util/intstr"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Addon) DeepCopyInto(out *Addon) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Addon.
func (in *Addon) DeepCopy() *Addon {
if in == nil {
return nil
}
out := new(Addon)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Addon) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddonList) DeepCopyInto(out *AddonList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Addon, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonList.
func (in *AddonList) DeepCopy() *AddonList {
if in == nil {
return nil
}
out := new(AddonList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AddonList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddonSpec) DeepCopyInto(out *AddonSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonSpec.
func (in *AddonSpec) DeepCopy() *AddonSpec {
if in == nil {
return nil
}
out := new(AddonSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddonStatus) DeepCopyInto(out *AddonStatus) {
*out = *in
if in.GVKs != nil {
in, out := &in.GVKs, &out.GVKs
*out = make([]schema.GroupVersionKind, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonStatus.
func (in *AddonStatus) DeepCopy() *AddonStatus {
if in == nil {
return nil
}
out := new(AddonStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChart) DeepCopyInto(out *HelmChart) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChart.
func (in *HelmChart) DeepCopy() *HelmChart {
if in == nil {
return nil
}
out := new(HelmChart)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelmChart) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartList) DeepCopyInto(out *HelmChartList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]HelmChart, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartList.
func (in *HelmChartList) DeepCopy() *HelmChartList {
if in == nil {
return nil
}
out := new(HelmChartList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelmChartList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartSpec) DeepCopyInto(out *HelmChartSpec) {
*out = *in
if in.Set != nil {
in, out := &in.Set, &out.Set
*out = make(map[string]intstr.IntOrString, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartSpec.
func (in *HelmChartSpec) DeepCopy() *HelmChartSpec {
if in == nil {
return nil
}
out := new(HelmChartSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartStatus) DeepCopyInto(out *HelmChartStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartStatus.
func (in *HelmChartStatus) DeepCopy() *HelmChartStatus {
if in == nil {
return nil
}
out := new(HelmChartStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ListenerConfig) DeepCopyInto(out *ListenerConfig) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenerConfig.
func (in *ListenerConfig) DeepCopy() *ListenerConfig {
if in == nil {
return nil
}
out := new(ListenerConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ListenerConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ListenerConfigList) DeepCopyInto(out *ListenerConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ListenerConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenerConfigList.
func (in *ListenerConfigList) DeepCopy() *ListenerConfigList {
if in == nil {
return nil
}
out := new(ListenerConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ListenerConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
package v1
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type HelmChartLifecycle interface {
Create(obj *HelmChart) (runtime.Object, error)
Remove(obj *HelmChart) (runtime.Object, error)
Updated(obj *HelmChart) (runtime.Object, error)
}
type helmChartLifecycleAdapter struct {
lifecycle HelmChartLifecycle
}
func (w *helmChartLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *helmChartLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *helmChartLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*HelmChart))
if o == nil {
return nil, err
}
return o, err
}
func (w *helmChartLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*HelmChart))
if o == nil {
return nil, err
}
return o, err
}
func (w *helmChartLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*HelmChart))
if o == nil {
return nil, err
}
return o, err
}
func NewHelmChartLifecycleAdapter(name string, clusterScoped bool, client HelmChartInterface, l HelmChartLifecycle) HelmChartHandlerFunc {
adapter := &helmChartLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *HelmChart) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
AddonsGetter
HelmChartsGetter
ListenerConfigsGetter
}
type Clients struct {
Interface Interface
Addon AddonClient
HelmChart HelmChartClient
ListenerConfig ListenerConfigClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
addonControllers map[string]AddonController
helmChartControllers map[string]HelmChartController
listenerConfigControllers map[string]ListenerConfigController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
Addon: &addonClient2{
iface: iface.Addons(""),
},
HelmChart: &helmChartClient2{
iface: iface.HelmCharts(""),
},
ListenerConfig: &listenerConfigClient2{
iface: iface.ListenerConfigs(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
addonControllers: map[string]AddonController{},
helmChartControllers: map[string]HelmChartController{},
listenerConfigControllers: map[string]ListenerConfigController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type AddonsGetter interface {
Addons(namespace string) AddonInterface
}
func (c *Client) Addons(namespace string) AddonInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &AddonResource, AddonGroupVersionKind, addonFactory{})
return &addonClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type HelmChartsGetter interface {
HelmCharts(namespace string) HelmChartInterface
}
func (c *Client) HelmCharts(namespace string) HelmChartInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &HelmChartResource, HelmChartGroupVersionKind, helmChartFactory{})
return &helmChartClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ListenerConfigsGetter interface {
ListenerConfigs(namespace string) ListenerConfigInterface
}
func (c *Client) ListenerConfigs(namespace string) ListenerConfigInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ListenerConfigResource, ListenerConfigGroupVersionKind, listenerConfigFactory{})
return &listenerConfigClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
package v1
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ListenerConfigLifecycle interface {
Create(obj *ListenerConfig) (runtime.Object, error)
Remove(obj *ListenerConfig) (runtime.Object, error)
Updated(obj *ListenerConfig) (runtime.Object, error)
}
type listenerConfigLifecycleAdapter struct {
lifecycle ListenerConfigLifecycle
}
func (w *listenerConfigLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *listenerConfigLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *listenerConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*ListenerConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *listenerConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*ListenerConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *listenerConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*ListenerConfig))
if o == nil {
return nil, err
}
return o, err
}
func NewListenerConfigLifecycleAdapter(name string, clusterScoped bool, client ListenerConfigInterface, l ListenerConfigLifecycle) ListenerConfigHandlerFunc {
adapter := &listenerConfigLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ListenerConfig) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
"github.com/rancher/norman/lifecycle"
v1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type ClusterRoleBindingLifecycle interface {
Create(obj *v1.ClusterRoleBinding) (runtime.Object, error)
Remove(obj *v1.ClusterRoleBinding) (runtime.Object, error)
Updated(obj *v1.ClusterRoleBinding) (runtime.Object, error)
}
type clusterRoleBindingLifecycleAdapter struct {
lifecycle ClusterRoleBindingLifecycle
}
func (w *clusterRoleBindingLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *clusterRoleBindingLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *clusterRoleBindingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*v1.ClusterRoleBinding))
if o == nil {
return nil, err
}
return o, err
}
func (w *clusterRoleBindingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*v1.ClusterRoleBinding))
if o == nil {
return nil, err
}
return o, err
}
func (w *clusterRoleBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*v1.ClusterRoleBinding))
if o == nil {
return nil, err
}
return o, err
}
func NewClusterRoleBindingLifecycleAdapter(name string, clusterScoped bool, client ClusterRoleBindingInterface, l ClusterRoleBindingLifecycle) ClusterRoleBindingHandlerFunc {
adapter := &clusterRoleBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1.ClusterRoleBinding) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}
package v1
import (
rbacv1 "k8s.io/api/rbac/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterRoleBindingList) DeepCopyInto(out *ClusterRoleBindingList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]rbacv1.ClusterRoleBinding, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleBindingList.
func (in *ClusterRoleBindingList) DeepCopy() *ClusterRoleBindingList {
if in == nil {
return nil
}
out := new(ClusterRoleBindingList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterRoleBindingList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
package v1
import (
"context"
"sync"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"github.com/rancher/norman/objectclient/dynamic"
"github.com/rancher/norman/restwatch"
"k8s.io/client-go/rest"
)
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
ClusterRoleBindingsGetter
}
type Clients struct {
Interface Interface
ClusterRoleBinding ClusterRoleBindingClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
clusterRoleBindingControllers map[string]ClusterRoleBindingController
}
func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) {
c, err := NewForConfig(config)
if err != nil {
return ctx, nil, err
}
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
Interface: iface,
ClusterRoleBinding: &clusterRoleBindingClient2{
iface: iface.ClusterRoleBindings(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
}
restClient, err := restwatch.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
clusterRoleBindingControllers: map[string]ClusterRoleBindingController{},
}, nil
}
func (c *Client) RESTClient() rest.Interface {
return c.restClient
}
func (c *Client) Sync(ctx context.Context) error {
return controller.Sync(ctx, c.starters...)
}
func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type ClusterRoleBindingsGetter interface {
ClusterRoleBindings(namespace string) ClusterRoleBindingInterface
}
func (c *Client) ClusterRoleBindings(namespace string) ClusterRoleBindingInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterRoleBindingResource, ClusterRoleBindingGroupVersionKind, clusterRoleBindingFactory{})
return &clusterRoleBindingClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
package v1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "rbac.authorization.k8s.io"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&ClusterRoleBindingList{},
)
return nil
}
......@@ -11,7 +11,12 @@ package=github.com/opencontainers/runc/contrib/cmd/recvtty
k8s.io/kubernetes v1.14.1-k3s.4 https://github.com/rancher/k3s.git transitive=true,staging=true
github.com/rancher/norman 50017efee23caa79542ef685b65a7b783e0a73ca https://github.com/ibuildthecloud/norman.git
github.com/rancher/wrangler 4202dbfa88013c19238bb004d82e013f0593493d
github.com/rancher/wrangler-api efe26ac6a9d720e1bfa5a8cc5f8dce5ad598ce26
github.com/rancher/dynamiclistener 077eb13a904f2c62496f31b158135d9743526f82
github.com/rancher/remotedialer 20ec38853712bb6d348f0db9ac47d34c954c6b00
github.com/rancher/helm-controller 4f3b43bfd868bcb74fe847f8df88c482e9b70ff8
github.com/matryer/moq ee5226d43009 https://github.com/rancher/moq.git
github.com/coreos/flannel 823afe66b2266bf71f5bec24e6e28b26d70cfc7c https://github.com/ibuildthecloud/flannel.git
github.com/natefinch/lumberjack aee4629129445bbdfb69aa565537dcfa16544311
github.com/gorilla/mux v1.6.2
......@@ -121,3 +126,4 @@ github.com/rootless-containers/rootlesskit 893c1c3de71f54c301fdb85a7c0dd15c1933
github.com/theckman/go-flock v0.7.1
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
.vscode
language: go
sudo: false
go:
- 1.9.x
- 1.10.x
- 1.11.x
- tip
before_install:
- go get golang.org/x/lint/golint
before_script:
- go vet ./...
- golint ./...
script:
- go test -v ./...
MIT License
Copyright (c) 2016 Mat Ryer and David Hernandez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
![moq logo](moq-logo-small.png) [![Build Status](https://travis-ci.org/matryer/moq.svg?branch=master)](https://travis-ci.org/matryer/moq) [![Go Report Card](https://goreportcard.com/badge/github.com/matryer/moq)](https://goreportcard.com/report/github.com/matryer/moq)
Interface mocking tool for go generate.
By [Mat Ryer](https://twitter.com/matryer) and [David Hernandez](https://github.com/dahernan), with ideas lovingly stolen from [Ernesto Jimenez](https://github.com/ernesto-jimenez).
### What is Moq?
Moq is a tool that generates a struct from any interface. The struct can be used in test code as a mock of the interface.
![Preview](preview.png)
above: Moq generates the code on the right.
You can read more in the [Meet Moq blog post](http://bit.ly/meetmoq).
### Installing
To start using Moq, just run go get:
```
$ go get github.com/matryer/moq
```
### Usage
```
moq [flags] destination interface [interface2 [interface3 [...]]]
-out string
output file (default stdout)
-pkg string
package name (default will infer)
```
In a command line:
```
$ moq -out mocks_test.go . MyInterface
```
In code (for go generate):
```go
package my
//go:generate moq -out myinterface_moq_test.go . MyInterface
type MyInterface interface {
Method1() error
Method2(i int)
}
```
Then run `go generate` for your package.
### How to use it
Mocking interfaces is a nice way to write unit tests where you can easily control the behaviour of the mocked object.
Moq creates a struct that has a function field for each method, which you can declare in your test code.
This this example, Moq generated the `EmailSenderMock` type:
```go
func TestCompleteSignup(t *testing.T) {
var sentTo string
mockedEmailSender = &EmailSenderMock{
SendFunc: func(to, subject, body string) error {
sentTo = to
return nil
},
}
CompleteSignUp("me@email.com", mockedEmailSender)
callsToSend := len(mockedEmailSender.SendCalls())
if callsToSend != 1 {
t.Errorf("Send was called %d times", callsToSend)
}
if sentTo != "me@email.com" {
t.Errorf("unexpected recipient: %s", sentTo)
}
}
func CompleteSignUp(to string, sender EmailSender) {
// TODO: this
}
```
The mocked structure implements the interface, where each method calls the associated function field.
## Tips
* Keep mocked logic inside the test that is using it
* Only mock the fields you need
* It will panic if a nil function gets called
* Name arguments in the interface for a better experience
* Use closured variables inside your test function to capture details about the calls to the methods
* Use `.MethodCalls()` to track the calls
* Use `go:generate` to invoke the `moq` command
## License
The Moq project (and all code) is licensed under the [MIT License](LICENSE).
The Moq logo was created by [Chris Ryer](http://chrisryer.co.uk) and is licensed under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/).
package moq
import (
"bytes"
"errors"
"fmt"
"go/format"
"go/types"
"io"
"os"
"path"
"path/filepath"
"strings"
"text/template"
"golang.org/x/tools/go/packages"
)
// This list comes from the golint codebase. Golint will complain about any of
// these being mixed-case, like "Id" instead of "ID".
var golintInitialisms = []string{
"ACL",
"API",
"ASCII",
"CPU",
"CSS",
"DNS",
"EOF",
"GUID",
"HTML",
"HTTP",
"HTTPS",
"ID",
"IP",
"JSON",
"LHS",
"QPS",
"RAM",
"RHS",
"RPC",
"SLA",
"SMTP",
"SQL",
"SSH",
"TCP",
"TLS",
"TTL",
"UDP",
"UI",
"UID",
"UUID",
"URI",
"URL",
"UTF8",
"VM",
"XML",
"XMPP",
"XSRF",
"XSS",
}
// Mocker can generate mock structs.
type Mocker struct {
srcPkg *packages.Package
tmpl *template.Template
pkgName string
pkgPath string
// importByPath of the format key:path value:alias
importByPath map[string]string
// importByAlias of the format key:alias value:path
importByAlias map[string]string
}
// New makes a new Mocker for the specified package directory.
func New(src, packageName string) (*Mocker, error) {
srcPkg, err := pkgInfoFromPath(src, packages.LoadSyntax)
if err != nil {
return nil, fmt.Errorf("Couldn't load source package: %s", err)
}
pkgPath := srcPkg.PkgPath
if len(packageName) == 0 {
packageName = srcPkg.Name
} else {
mockPkgPath := filepath.Join(src, packageName)
if _, err := os.Stat(mockPkgPath); os.IsNotExist(err) {
os.Mkdir(mockPkgPath, os.ModePerm)
}
mockPkg, err := pkgInfoFromPath(mockPkgPath, packages.LoadFiles)
if err != nil {
return nil, fmt.Errorf("Couldn't load mock package: %s", err)
}
pkgPath = mockPkg.PkgPath
}
tmpl, err := template.New("moq").Funcs(templateFuncs).Parse(moqTemplate)
if err != nil {
return nil, err
}
return &Mocker{
tmpl: tmpl,
srcPkg: srcPkg,
pkgName: packageName,
pkgPath: pkgPath,
importByPath: make(map[string]string),
importByAlias: make(map[string]string),
}, nil
}
// Mock generates a mock for the specified interface name.
func (m *Mocker) Mock(w io.Writer, name ...string) error {
if len(name) == 0 {
return errors.New("must specify one interface")
}
doc := doc{
PackageName: m.pkgName,
Imports: moqImports,
}
// Add sync first to ensure it doesn't get an alias which will break the template
m.addSyncImport()
var syncNeeded bool
tpkg := m.srcPkg.Types
for _, n := range name {
iface := tpkg.Scope().Lookup(n)
if iface == nil {
return fmt.Errorf("cannot find interface %s", n)
}
if !types.IsInterface(iface.Type()) {
return fmt.Errorf("%s (%s) not an interface", n, iface.Type().String())
}
iiface := iface.Type().Underlying().(*types.Interface).Complete()
obj := obj{
InterfaceName: n,
}
for i := 0; i < iiface.NumMethods(); i++ {
syncNeeded = true
meth := iiface.Method(i)
sig := meth.Type().(*types.Signature)
method := &method{
Name: meth.Name(),
}
obj.Methods = append(obj.Methods, method)
method.Params = m.extractArgs(sig, sig.Params(), "in%d")
method.Returns = m.extractArgs(sig, sig.Results(), "out%d")
}
doc.Objects = append(doc.Objects, obj)
}
if !syncNeeded {
delete(m.importByAlias, "sync")
delete(m.importByPath, "sync")
}
if tpkg.Name() != m.pkgName {
if _, ok := m.importByPath[tpkg.Path()]; !ok {
alias := m.getUniqueAlias(tpkg.Name())
m.importByAlias[alias] = tpkg.Path()
m.importByPath[tpkg.Path()] = alias
}
doc.SourcePackagePrefix = m.importByPath[tpkg.Path()] + "."
}
for alias, path := range m.importByAlias {
aliasImport := fmt.Sprintf(`%s "%s"`, alias, stripVendorPath(path))
doc.Imports = append(doc.Imports, aliasImport)
}
var buf bytes.Buffer
err := m.tmpl.Execute(&buf, doc)
if err != nil {
return err
}
formatted, err := format.Source(buf.Bytes())
if err != nil {
return fmt.Errorf("go/format: %s", err)
}
if _, err := w.Write(formatted); err != nil {
return err
}
return nil
}
func (m *Mocker) addSyncImport() {
if _, ok := m.importByPath["sync"]; !ok {
m.importByAlias["sync"] = "sync"
m.importByPath["sync"] = "sync"
}
}
func (m *Mocker) packageQualifier(pkg *types.Package) string {
if m.pkgPath == pkg.Path() {
return ""
}
path := pkg.Path()
if pkg.Path() == "." {
wd, err := os.Getwd()
if err == nil {
path = stripGopath(wd)
}
}
if alias, ok := m.importByPath[path]; ok {
return alias
}
alias := pkg.Name()
if _, ok := m.importByAlias[alias]; ok {
alias = m.getUniqueAlias(alias)
}
m.importByAlias[alias] = path
m.importByPath[path] = alias
return alias
}
func (m *Mocker) getUniqueAlias(alias string) string {
for i := 0; ; i++ {
newAlias := alias + string('a'+byte(i))
if _, exists := m.importByAlias[newAlias]; !exists {
return newAlias
}
}
}
func (m *Mocker) extractArgs(sig *types.Signature, list *types.Tuple, nameFormat string) []*param {
var params []*param
listLen := list.Len()
for ii := 0; ii < listLen; ii++ {
p := list.At(ii)
name := p.Name()
if name == "" {
name = fmt.Sprintf(nameFormat, ii+1)
}
typename := types.TypeString(p.Type(), m.packageQualifier)
// check for final variadic argument
variadic := sig.Variadic() && ii == listLen-1 && typename[0:2] == "[]"
param := &param{
Name: name,
Type: typename,
Variadic: variadic,
}
params = append(params, param)
}
return params
}
func pkgInfoFromPath(src string, mode packages.LoadMode) (*packages.Package, error) {
conf := packages.Config{
Mode: mode,
Dir: src,
}
pkgs, err := packages.Load(&conf)
if err != nil {
return nil, err
}
if len(pkgs) == 0 {
return nil, errors.New("No packages found")
}
if len(pkgs) > 1 {
return nil, errors.New("More than one package was found")
}
return pkgs[0], nil
}
type doc struct {
PackageName string
SourcePackagePrefix string
Objects []obj
Imports []string
}
type obj struct {
InterfaceName string
Methods []*method
}
type method struct {
Name string
Params []*param
Returns []*param
}
func (m *method) Arglist() string {
params := make([]string, len(m.Params))
for i, p := range m.Params {
params[i] = p.String()
}
return strings.Join(params, ", ")
}
func (m *method) ArgCallList() string {
params := make([]string, len(m.Params))
for i, p := range m.Params {
params[i] = p.CallName()
}
return strings.Join(params, ", ")
}
func (m *method) ReturnArglist() string {
params := make([]string, len(m.Returns))
for i, p := range m.Returns {
params[i] = p.TypeString()
}
if len(m.Returns) > 1 {
return fmt.Sprintf("(%s)", strings.Join(params, ", "))
}
return strings.Join(params, ", ")
}
type param struct {
Name string
Type string
Variadic bool
}
func (p param) String() string {
return fmt.Sprintf("%s %s", p.Name, p.TypeString())
}
func (p param) CallName() string {
if p.Variadic {
return p.Name + "..."
}
return p.Name
}
func (p param) TypeString() string {
if p.Variadic {
return "..." + p.Type[2:]
}
return p.Type
}
var templateFuncs = template.FuncMap{
"Exported": func(s string) string {
if s == "" {
return ""
}
for _, initialism := range golintInitialisms {
if strings.ToUpper(s) == initialism {
return initialism
}
}
return strings.ToUpper(s[0:1]) + s[1:]
},
}
// stripVendorPath strips the vendor dir prefix from a package path.
// For example we might encounter an absolute path like
// github.com/foo/bar/vendor/github.com/pkg/errors which is resolved
// to github.com/pkg/errors.
func stripVendorPath(p string) string {
parts := strings.Split(p, "/vendor/")
if len(parts) == 1 {
return p
}
return strings.TrimLeft(path.Join(parts[1:]...), "/")
}
// stripGopath takes the directory to a package and remove the gopath to get the
// canonical package name.
//
// taken from https://github.com/ernesto-jimenez/gogen
// Copyright (c) 2015 Ernesto Jiménez
func stripGopath(p string) string {
for _, gopath := range gopaths() {
p = strings.TrimPrefix(p, path.Join(gopath, "src")+"/")
}
return p
}
func gopaths() []string {
return strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator))
}
package moq
// moqImports are the imports all moq files get.
var moqImports = []string{}
// moqTemplate is the template for mocked code.
var moqTemplate = `// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package {{.PackageName}}
{{- $sourcePackagePrefix := .SourcePackagePrefix}}
import (
{{- range .Imports }}
{{.}}
{{- end }}
)
{{ range $i, $obj := .Objects -}}
var (
{{- range .Methods }}
lock{{$obj.InterfaceName}}Mock{{.Name}} sync.RWMutex
{{- end }}
)
// Ensure, that {{.InterfaceName}}Mock does implement {{.InterfaceName}}.
// If this is not the case, regenerate this file with moq.
var _ {{$sourcePackagePrefix}}{{.InterfaceName}} = &{{.InterfaceName}}Mock{}
// {{.InterfaceName}}Mock is a mock implementation of {{.InterfaceName}}.
//
// func TestSomethingThatUses{{.InterfaceName}}(t *testing.T) {
//
// // make and configure a mocked {{.InterfaceName}}
// mocked{{.InterfaceName}} := &{{.InterfaceName}}Mock{ {{ range .Methods }}
// {{.Name}}Func: func({{ .Arglist }}) {{.ReturnArglist}} {
// panic("mock out the {{.Name}} method")
// },{{- end }}
// }
//
// // use mocked{{.InterfaceName}} in code that requires {{.InterfaceName}}
// // and then make assertions.
//
// }
type {{.InterfaceName}}Mock struct {
{{- range .Methods }}
// {{.Name}}Func mocks the {{.Name}} method.
{{.Name}}Func func({{ .Arglist }}) {{.ReturnArglist}}
{{ end }}
// calls tracks calls to the methods.
calls struct {
{{- range .Methods }}
// {{ .Name }} holds details about calls to the {{.Name}} method.
{{ .Name }} []struct {
{{- range .Params }}
// {{ .Name | Exported }} is the {{ .Name }} argument value.
{{ .Name | Exported }} {{ .Type }}
{{- end }}
}
{{- end }}
}
}
{{ range .Methods }}
// {{.Name}} calls {{.Name}}Func.
func (mock *{{$obj.InterfaceName}}Mock) {{.Name}}({{.Arglist}}) {{.ReturnArglist}} {
if mock.{{.Name}}Func == nil {
panic("{{$obj.InterfaceName}}Mock.{{.Name}}Func: method is nil but {{$obj.InterfaceName}}.{{.Name}} was just called")
}
callInfo := struct {
{{- range .Params }}
{{ .Name | Exported }} {{ .Type }}
{{- end }}
}{
{{- range .Params }}
{{ .Name | Exported }}: {{ .Name }},
{{- end }}
}
lock{{$obj.InterfaceName}}Mock{{.Name}}.Lock()
mock.calls.{{.Name}} = append(mock.calls.{{.Name}}, callInfo)
lock{{$obj.InterfaceName}}Mock{{.Name}}.Unlock()
{{- if .ReturnArglist }}
return mock.{{.Name}}Func({{.ArgCallList}})
{{- else }}
mock.{{.Name}}Func({{.ArgCallList}})
{{- end }}
}
// {{.Name}}Calls gets all the calls that were made to {{.Name}}.
// Check the length with:
// len(mocked{{$obj.InterfaceName}}.{{.Name}}Calls())
func (mock *{{$obj.InterfaceName}}Mock) {{.Name}}Calls() []struct {
{{- range .Params }}
{{ .Name | Exported }} {{ .Type }}
{{- end }}
} {
var calls []struct {
{{- range .Params }}
{{ .Name | Exported }} {{ .Type }}
{{- end }}
}
lock{{$obj.InterfaceName}}Mock{{.Name}}.RLock()
calls = mock.calls.{{.Name}}
lock{{$obj.InterfaceName}}Mock{{.Name}}.RUnlock()
return calls
}
{{ end -}}
{{ end -}}`
......@@ -175,3 +175,4 @@
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
module github.com/rancher/dynamiclistener
go 1.12
require (
github.com/hashicorp/golang-lru v0.5.1
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 // indirect
golang.org/x/text v0.3.2 // indirect
)
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 h1:rlLehGeYg6jfoyz/eDqDU1iRXLKfR42nnNh57ytKEWo=
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
......@@ -22,10 +22,9 @@ import (
"time"
lru "github.com/hashicorp/golang-lru"
cert "github.com/rancher/norman/pkg/cert"
cert "github.com/rancher/dynamiclistener/cert"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/acme/autocert"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
const (
......@@ -66,9 +65,7 @@ func NewServer(listenConfigStorage ListenerConfigStorage, config UserConfig) (Se
}
lc, err := listenConfigStorage.Get()
if apierrors.IsNotFound(err) {
lc = &ListenerStatus{}
} else if err != nil {
if err != nil {
return nil, err
}
......@@ -104,9 +101,7 @@ func (s *server) save() {
changed := false
cfg, err := s.listenConfigStorage.Get()
if apierrors.IsNotFound(err) {
cfg = &ListenerStatus{}
} else if err != nil {
if err != nil {
return
}
......
......@@ -2,8 +2,6 @@ package dynamiclistener
import (
"net/http"
"k8s.io/kubernetes/pkg/util/maps"
)
type ListenerConfigStorage interface {
......@@ -48,9 +46,17 @@ func (l *ListenerStatus) DeepCopyInto(t *ListenerStatus) {
t.Revision = l.Revision
t.CACert = l.CACert
t.CAKey = l.CAKey
t.GeneratedCerts = maps.CopySS(t.GeneratedCerts)
t.GeneratedCerts = copyMap(t.GeneratedCerts)
t.KnownIPs = map[string]bool{}
for k, v := range l.KnownIPs {
t.KnownIPs[k] = v
}
}
func copyMap(m map[string]string) map[string]string {
ret := map[string]string{}
for k, v := range m {
ret[k] = v
}
return ret
}
---
kind: pipeline
name: amd64
platform:
os: linux
arch: amd64
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-amd64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/helm-controller"
tag: "${DRONE_TAG}-amd64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: arm64
platform:
os: linux
arch: arm64
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/helm-controller"
tag: "${DRONE_TAG}-arm64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: arm
platform:
os: linux
arch: arm
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/helm-controller"
tag: "${DRONE_TAG}-arm"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: manifest
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest:1.0.2
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
platforms:
- linux/amd64
- linux/arm64
- linux/arm
target: "rancher/helm-controller:${DRONE_TAG}"
template: "rancher/helm-controller:${DRONE_TAG}-ARCH"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
depends_on:
- amd64
- arm64
- arm
/.idea
.DS_Store
/.dapper
/.idea
/bin
/dist
*.swp
/.trash-cache
/trash.lock
helm-controller
FROM golang:1.11-alpine
FROM golang:1.12.1-alpine3.9
RUN apk -U add bash git gcc musl-dev docker
RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates
RUN go get -d golang.org/x/lint/golint && \
git -C /go/src/golang.org/x/lint/golint checkout -b current 06c8688daad7faa9da5a0c2f163a3d14aac986ca && \
go install golang.org/x/lint/golint && \
rm -rf /go/src /go/pkg
RUN mkdir -p /go/src/golang.org/x && \
cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \
git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \
go install golang.org/x/tools/cmd/goimports
RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0; \
fi
ENV DAPPER_SOURCE /go/src/github.com/rancher/norman/
ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_SOURCE /go/src/github.com/rancher/helm-controller/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
......
FROM golang:1.12.1-alpine3.9
RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates
RUN go get -d golang.org/x/lint/golint && \
git -C /go/src/golang.org/x/lint/golint checkout -b current 06c8688daad7faa9da5a0c2f163a3d14aac986ca && \
go install golang.org/x/lint/golint && \
rm -rf /go/src /go/pkg
RUN mkdir -p /go/src/golang.org/x && \
cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \
git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \
go install golang.org/x/tools/cmd/goimports
RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0; \
fi
ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_SOURCE /go/src/github.com/rancher/helm-controller/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]
TARGETS := $(shell ls scripts)
.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper
$(TARGETS): .dapper
./.dapper $@
trash: .dapper
./.dapper -m bind trash
trash-keep: .dapper
./.dapper -m bind trash -k
deps: trash
.DEFAULT_GOAL := ci
.PHONY: $(TARGETS)
helm-controller
========
A simple way to manage helm charts with a Custom Resource Definitions in k8s.
## Manifests and Deploying
The `./manifests` folder contains useful YAML manifests to use for deploying and developing the Helm Controller. This simply YAML deployment creates a HelmChart CRD + a Deployment using the `rancher/helm-controller` container. The YAML might need some modifications for your environment so read below for Namespaced vs Cluster deployments and how to use them properly.
#### Namespaced Deploys
Use the `deploy-namespaced.yaml` to create a namespace and add the Helm Controller and CRD to that namespace locking down the Helm Controller to only see changes to CRDs within that namespace. This is defaulted to `helm-controller` so update the YAML to your needs before running `kubectl create`
#### Cluster Scoped Deploys
If you'd like your helm controller to watch the entire cluster for HelmChart CRD changes use the `deploy-cluster-scoped.yaml` deploy manifest. By default it will add the helm-controller to the `kube-system` so update `metadata.namespace` for your needs.
## Uninstalling
To remove the Helm Controller run `kubectl delete` and pass the deployment YAML used using to create the Deployment `-f` parameter.
## Developing and Building
The Helm Controller is easy to get running locally, follow the instructions for your needs and requires a running k8s server + CRDs etc. When you have a working k8s cluster you can use can use `./manifest/crd.yaml` to create the CRD and `./manifest/example-helmchart.yaml` which runs the `stable/traefik` helm chart.
#### Locally
Building and running natively will start a daemon which will watch a local k8s API. See Manifests section above about how to to create the CRD and Objects using the provided manifests.
```
go build -o ./bin/helm-controller
./bin/helm-controller --kubeconfig $HOME/.kube/config
```
#### docker/k8s
An easy way to get started with docker/k8s is to install docker for windows/mac and use the included k8s cluster. Once functioning you can easily build locally and get a docker container to pull the Helm Controller container and run it in k8s. Use `make` to launch a linux container and build to create a container. Use the `./manifests/deploy-*.yaml` definitions to get it into your cluster and update `containers.image` to point to your locally image e.g. `image: rancher/helm-controller:dev`
#### Options and Usage
Use `./bin/helm-controller help` to get full usage details. The outside of a k8s Pod the most important options are `--kubeconfig` or `--masterurl` or it will not run. All options have corresponding ENV variables you could use.
## Testing
`go test ./...`
## License
Copyright (c) 2019 [Rancher Labs, Inc.](http://rancher.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\ No newline at end of file
module github.com/rancher/helm-controller
go 1.12
require (
github.com/rancher/wrangler v0.1.3
github.com/rancher/wrangler-api v0.1.3
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0
github.com/urfave/cli v1.20.0
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/klog v0.3.0
)
replace github.com/matryer/moq => github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=helm.cattle.io
package v1
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type HelmChart struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec HelmChartSpec `json:"spec,omitempty"`
Status HelmChartStatus `json:"status,omitempty"`
}
type HelmChartSpec struct {
TargetNamespace string `json:"targetNamespace,omitempty"`
Chart string `json:"chart,omitempty"`
Version string `json:"version,omitempty"`
Repo string `json:"repo,omitempty"`
Set map[string]intstr.IntOrString `json:"set,omitempty"`
ValuesContent string `json:"valuesContent,omitempty"`
}
type HelmChartStatus struct {
JobName string `json:"jobName,omitempty"`
}
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
appsv1 "k8s.io/api/apps/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DaemonSetList) DeepCopyInto(out *DaemonSetList) {
func (in *HelmChart) DeepCopyInto(out *HelmChart) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]appsv1.DaemonSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonSetList.
func (in *DaemonSetList) DeepCopy() *DaemonSetList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChart.
func (in *HelmChart) DeepCopy() *HelmChart {
if in == nil {
return nil
}
out := new(DaemonSetList)
out := new(HelmChart)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DaemonSetList) DeepCopyObject() runtime.Object {
func (in *HelmChart) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
......@@ -39,13 +54,13 @@ func (in *DaemonSetList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeploymentList) DeepCopyInto(out *DeploymentList) {
func (in *HelmChartList) DeepCopyInto(out *HelmChartList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]appsv1.Deployment, len(*in))
*out = make([]HelmChart, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
......@@ -53,20 +68,59 @@ func (in *DeploymentList) DeepCopyInto(out *DeploymentList) {
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentList.
func (in *DeploymentList) DeepCopy() *DeploymentList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartList.
func (in *HelmChartList) DeepCopy() *HelmChartList {
if in == nil {
return nil
}
out := new(DeploymentList)
out := new(HelmChartList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DeploymentList) DeepCopyObject() runtime.Object {
func (in *HelmChartList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartSpec) DeepCopyInto(out *HelmChartSpec) {
*out = *in
if in.Set != nil {
in, out := &in.Set, &out.Set
*out = make(map[string]intstr.IntOrString, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartSpec.
func (in *HelmChartSpec) DeepCopy() *HelmChartSpec {
if in == nil {
return nil
}
out := new(HelmChartSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmChartStatus) DeepCopyInto(out *HelmChartStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartStatus.
func (in *HelmChartStatus) DeepCopy() *HelmChartStatus {
if in == nil {
return nil
}
out := new(HelmChartStatus)
in.DeepCopyInto(out)
return out
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=helm.cattle.io
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// HelmChartList is a list of HelmChart resources
type HelmChartList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []HelmChart `json:"items"`
}
func NewHelmChart(namespace, name string, obj HelmChart) *HelmChart {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("HelmChart").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=helm.cattle.io
package v1
import (
helm "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
GroupName = "k3s.cattle.io"
Version = "v1"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
var SchemeGroupVersion = schema.GroupVersion{Group: helm.GroupName, Version: "v1"}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
......@@ -28,17 +45,12 @@ var (
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&Addon{},
&AddonList{},
&HelmChart{},
&HelmChartList{},
&ListenerConfig{},
&ListenerConfigList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package helm
const (
// Package-wide consts from generator "zz_generated_register".
GroupName = "helm.cattle.io"
)
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package versioned
import (
helmv1 "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
HelmV1() helmv1.HelmV1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
helmV1 *helmv1.HelmV1Client
}
// HelmV1 retrieves the HelmV1Client
func (c *Clientset) HelmV1() helmv1.HelmV1Interface {
return c.helmV1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
return nil
}
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.helmV1, err = helmv1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
return &cs, nil
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.helmV1 = helmv1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.helmV1 = helmv1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// This package has the automatically generated clientset.
package versioned
/*
Copyright 2016 The Kubernetes Authors.
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -14,16 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package maps
// Code generated by main. DO NOT EDIT.
// CopySS makes a shallow copy of a map.
func CopySS(m map[string]string) map[string]string {
if m == nil {
return nil
}
copy := make(map[string]string, len(m))
for k, v := range m {
copy[k] = v
}
return copy
}
// This package contains the scheme of the automatically generated clientset.
package scheme
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package scheme
import (
helmv1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
helmv1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
type HelmChartExpansion interface{}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
"github.com/rancher/helm-controller/pkg/generated/clientset/versioned/scheme"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
)
type HelmV1Interface interface {
RESTClient() rest.Interface
HelmChartsGetter
}
// HelmV1Client is used to interact with features provided by the helm.cattle.io group.
type HelmV1Client struct {
restClient rest.Interface
}
func (c *HelmV1Client) HelmCharts(namespace string) HelmChartInterface {
return newHelmCharts(c, namespace)
}
// NewForConfig creates a new HelmV1Client for the given config.
func NewForConfig(c *rest.Config) (*HelmV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &HelmV1Client{client}, nil
}
// NewForConfigOrDie creates a new HelmV1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *HelmV1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new HelmV1Client for the given RESTClient.
func New(c rest.Interface) *HelmV1Client {
return &HelmV1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *HelmV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
"time"
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
scheme "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/scheme"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// HelmChartsGetter has a method to return a HelmChartInterface.
// A group's client should implement this interface.
type HelmChartsGetter interface {
HelmCharts(namespace string) HelmChartInterface
}
// HelmChartInterface has methods to work with HelmChart resources.
type HelmChartInterface interface {
Create(*v1.HelmChart) (*v1.HelmChart, error)
Update(*v1.HelmChart) (*v1.HelmChart, error)
UpdateStatus(*v1.HelmChart) (*v1.HelmChart, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.HelmChart, error)
List(opts metav1.ListOptions) (*v1.HelmChartList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error)
HelmChartExpansion
}
// helmCharts implements HelmChartInterface
type helmCharts struct {
client rest.Interface
ns string
}
// newHelmCharts returns a HelmCharts
func newHelmCharts(c *HelmV1Client, namespace string) *helmCharts {
return &helmCharts{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the helmChart, and returns the corresponding helmChart object, and an error if there is any.
func (c *helmCharts) Get(name string, options metav1.GetOptions) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Get().
Namespace(c.ns).
Resource("helmcharts").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of HelmCharts that match those selectors.
func (c *helmCharts) List(opts metav1.ListOptions) (result *v1.HelmChartList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.HelmChartList{}
err = c.client.Get().
Namespace(c.ns).
Resource("helmcharts").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested helmCharts.
func (c *helmCharts) Watch(opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("helmcharts").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a helmChart and creates it. Returns the server's representation of the helmChart, and an error, if there is any.
func (c *helmCharts) Create(helmChart *v1.HelmChart) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Post().
Namespace(c.ns).
Resource("helmcharts").
Body(helmChart).
Do().
Into(result)
return
}
// Update takes the representation of a helmChart and updates it. Returns the server's representation of the helmChart, and an error, if there is any.
func (c *helmCharts) Update(helmChart *v1.HelmChart) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Put().
Namespace(c.ns).
Resource("helmcharts").
Name(helmChart.Name).
Body(helmChart).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *helmCharts) UpdateStatus(helmChart *v1.HelmChart) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Put().
Namespace(c.ns).
Resource("helmcharts").
Name(helmChart.Name).
SubResource("status").
Body(helmChart).
Do().
Into(result)
return
}
// Delete takes name of the helmChart and deletes it. Returns an error if one occurs.
func (c *helmCharts) Delete(name string, options *metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("helmcharts").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *helmCharts) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("helmcharts").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched helmChart.
func (c *helmCharts) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error) {
result = &v1.HelmChart{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("helmcharts").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package helm
import (
"context"
"time"
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions"
"github.com/rancher/wrangler/pkg/generic"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
)
type Factory struct {
synced bool
informerFactory informers.SharedInformerFactory
clientset clientset.Interface
controllerManager *generic.ControllerManager
threadiness map[schema.GroupVersionKind]int
}
func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
f, err := NewFactoryFromConfig(config)
if err != nil {
panic(err)
}
return f
}
func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
cs, err := clientset.NewForConfig(config)
if err != nil {
return nil, err
}
informerFactory := informers.NewSharedInformerFactory(cs, 2*time.Hour)
return NewFactory(cs, informerFactory), nil
}
func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace string) (*Factory, error) {
if namespace == "" {
return NewFactoryFromConfig(config)
}
cs, err := clientset.NewForConfig(config)
if err != nil {
return nil, err
}
informerFactory := informers.NewSharedInformerFactoryWithOptions(cs, 2*time.Hour, informers.WithNamespace(namespace))
return NewFactory(cs, informerFactory), nil
}
func NewFactory(clientset clientset.Interface, informerFactory informers.SharedInformerFactory) *Factory {
return &Factory{
threadiness: map[schema.GroupVersionKind]int{},
controllerManager: &generic.ControllerManager{},
clientset: clientset,
informerFactory: informerFactory,
}
}
func (c *Factory) SetThreadiness(gvk schema.GroupVersionKind, threadiness int) {
c.threadiness[gvk] = threadiness
}
func (c *Factory) Sync(ctx context.Context) error {
c.informerFactory.Start(ctx.Done())
c.informerFactory.WaitForCacheSync(ctx.Done())
return nil
}
func (c *Factory) Start(ctx context.Context, defaultThreadiness int) error {
if err := c.Sync(ctx); err != nil {
return err
}
return c.controllerManager.Start(ctx, defaultThreadiness, c.threadiness)
}
func (c *Factory) Helm() Interface {
return New(c.controllerManager, c.informerFactory.Helm(), c.clientset)
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package helm
import (
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned"
v1 "github.com/rancher/helm-controller/pkg/generated/controllers/helm.cattle.io/v1"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io"
"github.com/rancher/wrangler/pkg/generic"
)
type Interface interface {
V1() v1.Interface
}
type group struct {
controllerManager *generic.ControllerManager
informers informers.Interface
client clientset.Interface
}
// New returns a new Interface.
func New(controllerManager *generic.ControllerManager, informers informers.Interface,
client clientset.Interface) Interface {
return &group{
controllerManager: controllerManager,
informers: informers,
client: client,
}
}
func (g *group) V1() v1.Interface {
return v1.New(g.controllerManager, g.client.HelmV1(), g.informers.V1())
}
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package v1
import (
"context"
v1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1"
clientset "github.com/rancher/helm-controller/pkg/generated/clientset/versioned/typed/helm.cattle.io/v1"
informers "github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm.cattle.io/v1"
listers "github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1"
"github.com/rancher/wrangler/pkg/generic"
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
type HelmChartHandler func(string, *v1.HelmChart) (*v1.HelmChart, error)
type HelmChartController interface {
HelmChartClient
OnChange(ctx context.Context, name string, sync HelmChartHandler)
OnRemove(ctx context.Context, name string, sync HelmChartHandler)
Enqueue(namespace, name string)
Cache() HelmChartCache
Informer() cache.SharedIndexInformer
GroupVersionKind() schema.GroupVersionKind
AddGenericHandler(ctx context.Context, name string, handler generic.Handler)
AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler)
Updater() generic.Updater
}
type HelmChartClient interface {
Create(*v1.HelmChart) (*v1.HelmChart, error)
Update(*v1.HelmChart) (*v1.HelmChart, error)
UpdateStatus(*v1.HelmChart) (*v1.HelmChart, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
Get(namespace, name string, options metav1.GetOptions) (*v1.HelmChart, error)
List(namespace string, opts metav1.ListOptions) (*v1.HelmChartList, error)
Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error)
Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error)
}
type HelmChartCache interface {
Get(namespace, name string) (*v1.HelmChart, error)
List(namespace string, selector labels.Selector) ([]*v1.HelmChart, error)
AddIndexer(indexName string, indexer HelmChartIndexer)
GetByIndex(indexName, key string) ([]*v1.HelmChart, error)
}
type HelmChartIndexer func(obj *v1.HelmChart) ([]string, error)
type helmChartController struct {
controllerManager *generic.ControllerManager
clientGetter clientset.HelmChartsGetter
informer informers.HelmChartInformer
gvk schema.GroupVersionKind
}
func NewHelmChartController(gvk schema.GroupVersionKind, controllerManager *generic.ControllerManager, clientGetter clientset.HelmChartsGetter, informer informers.HelmChartInformer) HelmChartController {
return &helmChartController{
controllerManager: controllerManager,
clientGetter: clientGetter,
informer: informer,
gvk: gvk,
}
}
func FromHelmChartHandlerToHandler(sync HelmChartHandler) generic.Handler {
return func(key string, obj runtime.Object) (ret runtime.Object, err error) {
var v *v1.HelmChart
if obj == nil {
v, err = sync(key, nil)
} else {
v, err = sync(key, obj.(*v1.HelmChart))
}
if v == nil {
return nil, err
}
return v, err
}
}
func (c *helmChartController) Updater() generic.Updater {
return func(obj runtime.Object) (runtime.Object, error) {
newObj, err := c.Update(obj.(*v1.HelmChart))
if newObj == nil {
return nil, err
}
return newObj, err
}
}
func UpdateHelmChartOnChange(updater generic.Updater, handler HelmChartHandler) HelmChartHandler {
return func(key string, obj *v1.HelmChart) (*v1.HelmChart, error) {
if obj == nil {
return handler(key, nil)
}
copyObj := obj.DeepCopy()
newObj, err := handler(key, copyObj)
if newObj != nil {
copyObj = newObj
}
if obj.ResourceVersion == copyObj.ResourceVersion && !equality.Semantic.DeepEqual(obj, copyObj) {
newObj, err := updater(copyObj)
if newObj != nil && err == nil {
copyObj = newObj.(*v1.HelmChart)
}
}
return copyObj, err
}
}
func (c *helmChartController) AddGenericHandler(ctx context.Context, name string, handler generic.Handler) {
c.controllerManager.AddHandler(ctx, c.gvk, c.informer.Informer(), name, handler)
}
func (c *helmChartController) AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler) {
removeHandler := generic.NewRemoveHandler(name, c.Updater(), handler)
c.controllerManager.AddHandler(ctx, c.gvk, c.informer.Informer(), name, removeHandler)
}
func (c *helmChartController) OnChange(ctx context.Context, name string, sync HelmChartHandler) {
c.AddGenericHandler(ctx, name, FromHelmChartHandlerToHandler(sync))
}
func (c *helmChartController) OnRemove(ctx context.Context, name string, sync HelmChartHandler) {
removeHandler := generic.NewRemoveHandler(name, c.Updater(), FromHelmChartHandlerToHandler(sync))
c.AddGenericHandler(ctx, name, removeHandler)
}
func (c *helmChartController) Enqueue(namespace, name string) {
c.controllerManager.Enqueue(c.gvk, c.informer.Informer(), namespace, name)
}
func (c *helmChartController) Informer() cache.SharedIndexInformer {
return c.informer.Informer()
}
func (c *helmChartController) GroupVersionKind() schema.GroupVersionKind {
return c.gvk
}
func (c *helmChartController) Cache() HelmChartCache {
return &helmChartCache{
lister: c.informer.Lister(),
indexer: c.informer.Informer().GetIndexer(),
}
}
func (c *helmChartController) Create(obj *v1.HelmChart) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(obj.Namespace).Create(obj)
}
func (c *helmChartController) Update(obj *v1.HelmChart) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(obj.Namespace).Update(obj)
}
func (c *helmChartController) UpdateStatus(obj *v1.HelmChart) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(obj.Namespace).UpdateStatus(obj)
}
func (c *helmChartController) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return c.clientGetter.HelmCharts(namespace).Delete(name, options)
}
func (c *helmChartController) Get(namespace, name string, options metav1.GetOptions) (*v1.HelmChart, error) {
return c.clientGetter.HelmCharts(namespace).Get(name, options)
}
func (c *helmChartController) List(namespace string, opts metav1.ListOptions) (*v1.HelmChartList, error) {
return c.clientGetter.HelmCharts(namespace).List(opts)
}
func (c *helmChartController) Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
return c.clientGetter.HelmCharts(namespace).Watch(opts)
}
func (c *helmChartController) Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HelmChart, err error) {
return c.clientGetter.HelmCharts(namespace).Patch(name, pt, data, subresources...)
}
type helmChartCache struct {
lister listers.HelmChartLister
indexer cache.Indexer
}
func (c *helmChartCache) Get(namespace, name string) (*v1.HelmChart, error) {
return c.lister.HelmCharts(namespace).Get(name)
}
func (c *helmChartCache) List(namespace string, selector labels.Selector) ([]*v1.HelmChart, error) {
return c.lister.HelmCharts(namespace).List(selector)
}
func (c *helmChartCache) AddIndexer(indexName string, indexer HelmChartIndexer) {
utilruntime.Must(c.indexer.AddIndexers(map[string]cache.IndexFunc{
indexName: func(obj interface{}) (strings []string, e error) {
return indexer(obj.(*v1.HelmChart))
},
}))
}
func (c *helmChartCache) GetByIndex(indexName, key string) (result []*v1.HelmChart, err error) {
objs, err := c.indexer.ByIndex(indexName, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
result = append(result, obj.(*v1.HelmChart))
}
return result, nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment