1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-03 07:54:14 +00:00

Update types/norman

This commit is contained in:
Darren Shepherd
2017-12-05 10:16:35 -07:00
parent df7e40188e
commit 40c0f98b44
36 changed files with 2749 additions and 817 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -47,6 +48,15 @@ func (p *ObjectClient) Create(o runtime.Object) (runtime.Object, error) {
if obj, ok := o.(metav1.Object); ok && obj.GetNamespace() != "" {
ns = obj.GetNamespace()
}
if t, err := meta.TypeAccessor(o); err == nil {
if t.GetKind() == "" {
t.SetKind(p.gvk.Kind)
}
if t.GetAPIVersion() == "" {
apiVersion, _ := p.gvk.ToAPIVersionAndKind()
t.SetAPIVersion(apiVersion)
}
}
result := p.Factory.Object()
err := p.restClient.Post().
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).

119
vendor/github.com/rancher/norman/lifecycle/object.go generated vendored Normal file
View File

@@ -0,0 +1,119 @@
package lifecycle
import (
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/types/slice"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
var (
initialized = "io.cattle.lifecycle.initialized"
)
type ObjectLifecycle interface {
Initialize(obj runtime.Object) error
Finalize(obj runtime.Object) error
Updated(obj runtime.Object) error
}
type objectLifecycleAdapter struct {
name string
lifecycle ObjectLifecycle
objectClient *clientbase.ObjectClient
}
func NewObjectLifecycleAdapter(name string, lifecycle ObjectLifecycle, objectClient *clientbase.ObjectClient) func(key string, obj runtime.Object) error {
o := objectLifecycleAdapter{
name: name,
lifecycle: lifecycle,
objectClient: objectClient,
}
return o.sync
}
func (o *objectLifecycleAdapter) sync(key string, obj runtime.Object) error {
if obj == nil {
return nil
}
metadata, err := meta.Accessor(obj)
if err != nil {
return err
}
if cont, err := o.finalize(metadata, obj); err != nil || !cont {
return err
}
if cont, err := o.initialize(metadata, obj); err != nil || !cont {
return err
}
return o.lifecycle.Updated(obj.DeepCopyObject())
}
func (o *objectLifecycleAdapter) finalize(metadata metav1.Object, obj runtime.Object) (bool, error) {
// Check finalize
if metadata.GetDeletionTimestamp() == nil {
return true, nil
}
if !slice.ContainsString(metadata.GetFinalizers(), o.name) {
return false, nil
}
obj = obj.DeepCopyObject()
metadata, err := meta.Accessor(obj)
if err != nil {
return false, err
}
var finalizers []string
for _, finalizer := range metadata.GetFinalizers() {
if finalizer == o.name {
continue
}
finalizers = append(finalizers, finalizer)
}
metadata.SetFinalizers(finalizers)
if err := o.lifecycle.Finalize(obj); err != nil {
return false, err
}
_, err = o.objectClient.Update(metadata.GetName(), obj)
return false, err
}
func (o *objectLifecycleAdapter) initializeKey() string {
return initialized + "." + o.name
}
func (o *objectLifecycleAdapter) initialize(metadata metav1.Object, obj runtime.Object) (bool, error) {
initialized := o.initializeKey()
if metadata.GetLabels()[initialized] == "true" {
return true, nil
}
obj = obj.DeepCopyObject()
metadata, err := meta.Accessor(obj)
if err != nil {
return false, err
}
if metadata.GetLabels() == nil {
metadata.SetLabels(map[string]string{})
}
metadata.SetFinalizers(append(metadata.GetFinalizers(), o.name))
metadata.GetLabels()[initialized] = "true"
if err := o.lifecycle.Initialize(obj); err != nil {
return false, err
}
_, err = o.objectClient.Update(metadata.GetName(), obj)
return false, err
}

View File

@@ -24,3 +24,11 @@ func (v *APIVersion) Equals(other *APIVersion) bool {
func (s *Schema) CanList() bool {
return slice.ContainsString(s.CollectionMethods, http.MethodGet)
}
func (s *Schema) CanUpdate() bool {
return slice.ContainsString(s.ResourceMethods, http.MethodPut)
}
func (s *Schema) CanDelete() bool {
return slice.ContainsString(s.ResourceMethods, http.MethodDelete)
}

View File

@@ -60,7 +60,7 @@ func (s *Schemas) AddSchemas(schema *Schemas) *Schemas {
}
func (s *Schemas) AddSchema(schema *Schema) *Schemas {
schema.Type = "/v1-meta/schemas/schema"
schema.Type = "/meta/schemas/schema"
if schema.ID == "" {
s.errors = append(s.errors, fmt.Errorf("ID is not set on schema: %v", schema))
return s

View File

@@ -83,7 +83,7 @@ type APIContext struct {
URLBuilder URLBuilder
AccessControl AccessControl
SubContext map[string]string
Attributes map[string]interface{}
//Attributes map[string]interface{}
Request *http.Request
Response http.ResponseWriter
@@ -140,6 +140,7 @@ type URLBuilder interface {
SubContextCollection(subContext *Schema, contextName string, schema *Schema) string
SchemaLink(schema *Schema) string
ResourceLink(resource *RawResource) string
Link(linkName string, resource *RawResource) string
RelativeToRoot(path string) string
Version(version APIVersion) string
Marker(marker string) string

View File

@@ -1,393 +0,0 @@
package v1
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ClusterConditionType string
const (
// ClusterConditionReady Cluster ready to serve API (healthy when true, unehalthy when false)
ClusterConditionReady = "Ready"
// ClusterConditionProvisioned Cluster is provisioned
ClusterConditionProvisioned = "Provisioned"
// ClusterConditionUpdating Cluster is being updating (upgrading, scaling up)
ClusterConditionUpdating = "Updating"
// ClusterConditionNoDiskPressure true when all cluster nodes have sufficient disk
ClusterConditionNoDiskPressure = "NoDiskPressure"
// ClusterConditionNoMemoryPressure true when all cluster nodes have sufficient memory
ClusterConditionNoMemoryPressure = "NoMemoryPressure"
// More conditions can be added if unredlying controllers request it
)
type Cluster struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec ClusterSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status ClusterStatus `json:"status"`
}
type ClusterSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
}
type ClusterStatus struct {
//Conditions represent the latest available observations of an object's current state:
//More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#typical-status-properties
Conditions []ClusterCondition `json:"conditions,omitempty"`
//Component statuses will represent cluster's components (etcd/controller/scheduler) health
// https://kubernetes.io/docs/api-reference/v1.8/#componentstatus-v1-core
ComponentStatuses []ClusterComponentStatus `json:"componentStatuses,omitempty"`
APIEndpoint string `json:"apiEndpoint,omitempty"`
ServiceAccountToken string `json:"serviceAccountToken,omitempty"`
CACert string `json:"caCert,omitempty"`
Capacity v1.ResourceList `json:"capacity,omitempty"`
Allocatable v1.ResourceList `json:"allocatable,omitempty"`
AppliedSpec ClusterSpec `json:"appliedSpec,omitempty"`
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
}
type ClusterComponentStatus struct {
Name string `json:"name"`
Conditions []v1.ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
}
type ClusterCondition struct {
// Type of cluster condition.
Type ClusterConditionType `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type GoogleKubernetesEngineConfig struct {
// ProjectID is the ID of your project to use when creating a cluster
ProjectID string `json:"projectId,omitempty"`
// The zone to launch the cluster
Zone string `json:"zone,omitempty"`
// The IP address range of the container pods
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty"`
// An optional description of this cluster
Description string `json:"description,omitempty"`
// The number of nodes in this cluster
NodeCount int64 `json:"nodeCount,omitempty"`
// Size of the disk attached to each node
DiskSizeGb int64 `json:"diskSizeGb,omitempty"`
// The name of a Google Compute Engine
MachineType string `json:"machineType,omitempty"`
// Node kubernetes version
NodeVersion string `json:"nodeVersion,omitempty"`
// the master kubernetes version
MasterVersion string `json:"masterVersion,omitempty"`
// The map of Kubernetes labels (key/value pairs) to be applied
// to each node.
Labels map[string]string `json:"labels,omitempty"`
// The content of the credential file(key.json)
Credential string `json:"credential,omitempty"`
// Enable alpha feature
EnableAlphaFeature bool `json:"enableAlphaFeature,omitempty"`
}
type AzureKubernetesServiceConfig struct {
//TBD
}
type RancherKubernetesEngineConfig struct {
// Kubernetes nodes
Nodes []RKEConfigNode `yaml:"nodes" json:"nodes,omitempty"`
// Kubernetes components
Services RKEConfigServices `yaml:"services" json:"services,omitempty"`
// Network configuration used in the kubernetes cluster (flannel, calico)
Network NetworkConfig `yaml:"network" json:"network,omitempty"`
// Authentication configuration used in the cluster (default: x509)
Authentication AuthConfig `yaml:"auth" json:"auth,omitempty"`
// YAML manifest for user provided addons to be deployed on the cluster
Addons string `yaml:"addons" json:"addons,omitempty"`
// List of images used internally for proxy, cert downlaod and kubedns
RKEImages map[string]string `yaml:"rke_images" json:"rke_images,omitempty"`
// SSH Private Key Path
SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"`
}
type RKEConfigNode struct {
// IP or FQDN that is fully resolvable and used for SSH communication
Address string `yaml:"address" json:"address,omitempty"`
// Optional - Internal address that will be used for components communication
InternalAddress string `yaml:"internal_address" json:"internalAddress,omitempty"`
// Node role in kubernetes cluster (controlplane, worker, or etcd)
Role []string `yaml:"role" json:"role,omitempty"`
// Optional - Hostname of the node
HostnameOverride string `yaml:"hostname_override" json:"hostnameOverride,omitempty"`
// SSH usesr that will be used by RKE
User string `yaml:"user" json:"user,omitempty"`
// Optional - Docker socket on the node that will be used in tunneling
DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"`
// SSH Private Key
SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty"`
// SSH Private Key Path
SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"`
}
type RKEConfigServices struct {
// Etcd Service
Etcd ETCDService `yaml:"etcd" json:"etcd,omitempty"`
// KubeAPI Service
KubeAPI KubeAPIService `yaml:"kube-api" json:"kubeApi,omitempty"`
// KubeController Service
KubeController KubeControllerService `yaml:"kube-controller" json:"kubeController,omitempty"`
// Scheduler Service
Scheduler SchedulerService `yaml:"scheduler" json:"scheduler,omitempty"`
// Kubelet Service
Kubelet KubeletService `yaml:"kubelet" json:"kubelet,omitempty"`
// KubeProxy Service
Kubeproxy KubeproxyService `yaml:"kubeproxy" json:"kubeproxy,omitempty"`
}
type ETCDService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
}
type KubeAPIService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range" json:"serviceClusterIpRange,omitempty"`
}
type KubeControllerService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
// CIDR Range for Pods in cluster
ClusterCIDR string `yaml:"cluster_cidr" json:"clusterCidr,omitempty"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range" json:"serviceClusterIpRange,omitempty"`
}
type KubeletService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
// Domain of the cluster (default: "cluster.local")
ClusterDomain string `yaml:"cluster_domain" json:"clusterDomain,omitempty"`
// The image whose network/ipc namespaces containers in each pod will use
InfraContainerImage string `yaml:"infra_container_image" json:"infraContainerImage,omitempty"`
// Cluster DNS service ip
ClusterDNSServer string `yaml:"cluster_dns_server" json:"clusterDnsServer,omitempty"`
}
type KubeproxyService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
}
type SchedulerService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
}
type BaseService struct {
// Docker image of the service
Image string `yaml:"image" json:"image,omitempty"`
// Extra arguments that are added to the services
ExtraArgs map[string]string `yaml:"extra_args" json:"extraArgs,omitempty"`
}
type NetworkConfig struct {
// Network Plugin That will be used in kubernetes cluster
Plugin string `yaml:"plugin" json:"plugin,omitempty"`
// Plugin options to configure network properties
Options map[string]string `yaml:"options" json:"options,omitempty"`
}
type AuthConfig struct {
// Authentication strategy that will be used in kubernetes cluster
Strategy string `yaml:"strategy" json:"strategy,omitempty"`
// Authentication options
Options map[string]string `yaml:"options" json:"options,omitempty"`
}
type ClusterNode struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the cluster node. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
v1.NodeSpec `json:"spec,omitempty"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status ClusterNodeStatus `json:"status"`
NodeName string
ClusterName string
}
type ClusterNodeStatus struct {
v1.NodeStatus
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
}
type MachineTemplate struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineTemplateSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineTemplateStatus `json:"status"`
}
type MachineTemplateStatus struct {
Conditions []MachineTemplateCondition `json:"conditions"`
}
type MachineTemplateCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineTemplateSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
FlavorPrefix string `json:"flavorPrefix"`
Driver string `json:"driver"`
SecretValues map[string]string `json:"secretValues"`
SecretName string `norman:"type=reference[/v1-cluster/schemas/globalSecret]"`
PublicValues map[string]string `json:"publicValues"`
}
type Machine struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineStatus `json:"status"`
}
type MachineStatus struct {
Conditions []MachineCondition `json:"conditions"`
}
type MachineCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineSpec struct {
ClusterName string `norman:"type=reference[cluster]"`
ExternalID string `json:"externalId"`
MachineTemplateName string `norman:"type=reference[machineTemplate]"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Hostname string `json:"hostname"`
Driver string `json:"driver"`
MachineGeneralParams `json:",inline"`
AmazonEC2Config AmazonEC2Config `json:"amazonEc2Config"`
AzureConfig AzureConfig `json:"azureConfig"`
DigitalOceanConfig DigitalOceanConfig `json:"digitalOceanConfig"`
}
type AmazonEC2Config struct {
}
type AzureConfig struct {
}
type DigitalOceanConfig struct {
}
type MachineGeneralParams struct {
AuthCertificateAuthority string `json:"authCertificateAuthority"`
AuthKey string `json:"authKey"`
EngineInstallURL string `json:"engineInstallURL"`
DockerVersion string `json:"dockerVersion"`
EngineOpt map[string]string `json:"engineOpt"`
EngineInsecureRegistry []string `json:"engineInsecureRegistry"`
EngineRegistryMirror []string `json:"engineRegistryMirror"`
EngineLabel map[string]string `json:"engineLabel"`
EngineStorageDriver string `json:"engineStorageDriver"`
EngineEnv map[string]string `json:"engineEnv"`
}
type MachineDriver struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineDriverSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineDriverStatus `json:"status"`
}
type MachineDriverStatus struct {
Conditions []MachineDriverCondition `json:"conditions"`
}
type MachineDriverCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineDriverSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
URL string `json:"url"`
ExternalID string `json:"externalId"`
Builtin bool `json:"builtin"`
DefaultActive bool `json:"defaultActive"`
ActivateOnCreate bool `json:"activateOnCreate"`
Checksum string `json:"checksum"`
UIURL string `json:"uiUrl"`
}

View File

@@ -1,187 +0,0 @@
package v1
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
ClusterNodeGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Kind: "ClusterNode",
}
ClusterNodeResource = metav1.APIResource{
Name: "clusternodes",
SingularName: "clusternode",
Namespaced: false,
Kind: ClusterNodeGroupVersionKind.Kind,
}
)
type ClusterNodeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterNode
}
type ClusterNodeHandlerFunc func(key string, obj *ClusterNode) error
type ClusterNodeLister interface {
List(namespace string, selector labels.Selector) (ret []*ClusterNode, err error)
Get(namespace, name string) (*ClusterNode, error)
}
type ClusterNodeController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterNodeLister
AddHandler(handler ClusterNodeHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterNodeInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*ClusterNode) (*ClusterNode, error)
Get(name string, opts metav1.GetOptions) (*ClusterNode, error)
Update(*ClusterNode) (*ClusterNode, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterNodeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterNodeController
}
type clusterNodeLister struct {
controller *clusterNodeController
}
func (l *clusterNodeLister) List(namespace string, selector labels.Selector) (ret []*ClusterNode, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ClusterNode))
})
return
}
func (l *clusterNodeLister) Get(namespace, name string) (*ClusterNode, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ClusterNodeGroupVersionKind.Group,
Resource: "clusterNode",
}, name)
}
return obj.(*ClusterNode), nil
}
type clusterNodeController struct {
controller.GenericController
}
func (c *clusterNodeController) Lister() ClusterNodeLister {
return &clusterNodeLister{
controller: c,
}
}
func (c *clusterNodeController) AddHandler(handler ClusterNodeHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ClusterNode))
})
}
type clusterNodeFactory struct {
}
func (c clusterNodeFactory) Object() runtime.Object {
return &ClusterNode{}
}
func (c clusterNodeFactory) List() runtime.Object {
return &ClusterNodeList{}
}
func (s *clusterNodeClient) Controller() ClusterNodeController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterNodeControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterNodeGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterNodeController{
GenericController: genericController,
}
s.client.clusterNodeControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterNodeClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ClusterNodeController
}
func (s *clusterNodeClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *clusterNodeClient) Create(o *ClusterNode) (*ClusterNode, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ClusterNode), err
}
func (s *clusterNodeClient) Get(name string, opts metav1.GetOptions) (*ClusterNode, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ClusterNode), err
}
func (s *clusterNodeClient) Update(o *ClusterNode) (*ClusterNode, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ClusterNode), err
}
func (s *clusterNodeClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterNodeClient) List(opts metav1.ListOptions) (*ClusterNodeList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterNodeList), err
}
func (s *clusterNodeClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *clusterNodeClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -1,133 +0,0 @@
package v1
import (
"context"
"sync"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
ClustersGetter
ClusterNodesGetter
MachinesGetter
MachineDriversGetter
MachineTemplatesGetter
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
clusterControllers map[string]ClusterController
clusterNodeControllers map[string]ClusterNodeController
machineControllers map[string]MachineController
machineDriverControllers map[string]MachineDriverController
machineTemplateControllers map[string]MachineTemplateController
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
configConfig := dynamic.ContentConfig()
config.NegotiatedSerializer = configConfig.NegotiatedSerializer
}
restClient, err := rest.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
clusterControllers: map[string]ClusterController{},
clusterNodeControllers: map[string]ClusterNodeController{},
machineControllers: map[string]MachineController{},
machineDriverControllers: map[string]MachineDriverController{},
machineTemplateControllers: map[string]MachineTemplateController{},
}, 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 ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
func (c *Client) Clusters(namespace string) ClusterInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterResource, ClusterGroupVersionKind, clusterFactory{})
return &clusterClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ClusterNodesGetter interface {
ClusterNodes(namespace string) ClusterNodeInterface
}
func (c *Client) ClusterNodes(namespace string) ClusterNodeInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterNodeResource, ClusterNodeGroupVersionKind, clusterNodeFactory{})
return &clusterNodeClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type MachinesGetter interface {
Machines(namespace string) MachineInterface
}
func (c *Client) Machines(namespace string) MachineInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &MachineResource, MachineGroupVersionKind, machineFactory{})
return &machineClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type MachineDriversGetter interface {
MachineDrivers(namespace string) MachineDriverInterface
}
func (c *Client) MachineDrivers(namespace string) MachineDriverInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &MachineDriverResource, MachineDriverGroupVersionKind, machineDriverFactory{})
return &machineDriverClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type MachineTemplatesGetter interface {
MachineTemplates(namespace string) MachineTemplateInterface
}
func (c *Client) MachineTemplates(namespace string) MachineTemplateInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &MachineTemplateResource, MachineTemplateGroupVersionKind, machineTemplateFactory{})
return &machineTemplateClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@@ -0,0 +1,66 @@
package v3
import (
extv1 "k8s.io/api/extensions/v1beta1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Project struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ProjectSpec `json:"spec,omitempty"`
}
type ProjectSpec struct {
DisplayName string `json:"displayName,omitempty" norman:"required"`
ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"`
}
type ProjectRoleTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Rules []rbacv1.PolicyRule `json:"rules,omitempty"`
Builtin bool `json:"builtin"`
ProjectRoleTemplateNames []string `json:"projectRoleTemplateNames,omitempty" norman:"type=array[reference[projectRoleTemplate]]"`
}
type PodSecurityPolicyTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec extv1.PodSecurityPolicySpec `json:"spec,omitempty"`
}
type ProjectRoleTemplateBinding struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Subject rbacv1.Subject `json:"subject,omitempty"`
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
ProjectRoleTemplateName string `json:"projectRoleTemplateName,omitempty" norman:"type=reference[projectRoleTemplate]"`
}
type ClusterRoleTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Rules []rbacv1.PolicyRule `json:"rules,omitempty"`
Builtin bool `json:"builtin"`
ClusterRoleTemplateNames []string `json:"clusterRoleTemplateNames,omitempty" norman:"type=array[reference[clusterRoleTemplate]]"`
}
type ClusterRoleTemplateBinding struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Subject rbacv1.Subject `json:"subject,omitempty"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster]"`
ClusterRoleTemplateName string `json:"clusterRoleTemplateName,omitempty" norman:"type=reference[clusterRoleTemplate]"`
}

View File

@@ -0,0 +1,110 @@
package v3
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ClusterConditionType string
const (
// ClusterConditionReady Cluster ready to serve API (healthy when true, unehalthy when false)
ClusterConditionReady = "Ready"
// ClusterConditionProvisioned Cluster is provisioned
ClusterConditionProvisioned = "Provisioned"
// ClusterConditionUpdating Cluster is being updating (upgrading, scaling up)
ClusterConditionUpdating = "Updating"
// ClusterConditionNoDiskPressure true when all cluster nodes have sufficient disk
ClusterConditionNoDiskPressure = "NoDiskPressure"
// ClusterConditionNoMemoryPressure true when all cluster nodes have sufficient memory
ClusterConditionNoMemoryPressure = "NoMemoryPressure"
// More conditions can be added if unredlying controllers request it
)
type Cluster struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec ClusterSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status ClusterStatus `json:"status"`
}
type ClusterSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
}
type ClusterStatus struct {
//Conditions represent the latest available observations of an object's current state:
//More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#typical-status-properties
Conditions []ClusterCondition `json:"conditions,omitempty"`
//Component statuses will represent cluster's components (etcd/controller/scheduler) health
// https://kubernetes.io/docs/api-reference/v1.8/#componentstatus-v1-core
ComponentStatuses []ClusterComponentStatus `json:"componentStatuses,omitempty"`
APIEndpoint string `json:"apiEndpoint,omitempty"`
ServiceAccountToken string `json:"serviceAccountToken,omitempty"`
CACert string `json:"caCert,omitempty"`
Capacity v1.ResourceList `json:"capacity,omitempty"`
Allocatable v1.ResourceList `json:"allocatable,omitempty"`
AppliedSpec ClusterSpec `json:"appliedSpec,omitempty"`
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
}
type ClusterComponentStatus struct {
Name string `json:"name"`
Conditions []v1.ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
}
type ClusterCondition struct {
// Type of cluster condition.
Type ClusterConditionType `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type GoogleKubernetesEngineConfig struct {
// ProjectID is the ID of your project to use when creating a cluster
ProjectID string `json:"projectId,omitempty"`
// The zone to launch the cluster
Zone string `json:"zone,omitempty"`
// The IP address range of the container pods
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty"`
// An optional description of this cluster
Description string `json:"description,omitempty"`
// The number of nodes in this cluster
NodeCount int64 `json:"nodeCount,omitempty"`
// Size of the disk attached to each node
DiskSizeGb int64 `json:"diskSizeGb,omitempty"`
// The name of a Google Compute Engine
MachineType string `json:"machineType,omitempty"`
// Node kubernetes version
NodeVersion string `json:"nodeVersion,omitempty"`
// the master kubernetes version
MasterVersion string `json:"masterVersion,omitempty"`
// The map of Kubernetes labels (key/value pairs) to be applied
// to each node.
Labels map[string]string `json:"labels,omitempty"`
// The content of the credential file(key.json)
Credential string `json:"credential,omitempty"`
// Enable alpha feature
EnableAlphaFeature bool `json:"enableAlphaFeature,omitempty"`
}
type AzureKubernetesServiceConfig struct {
//TBD
}

View File

@@ -0,0 +1,157 @@
package v3
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type MachineTemplate struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineTemplateSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineTemplateStatus `json:"status"`
}
type MachineTemplateStatus struct {
Conditions []MachineTemplateCondition `json:"conditions"`
}
type MachineTemplateCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineTemplateSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
FlavorPrefix string `json:"flavorPrefix"`
Driver string `json:"driver"`
SecretValues map[string]string `json:"secretValues"`
SecretName string `json:"secretName"`
PublicValues map[string]string `json:"publicValues"`
}
type Machine struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineStatus `json:"status"`
}
type MachineStatus struct {
Conditions []MachineCondition `json:"conditions"`
NodeStatus v1.NodeStatus `json:"nodeStatus"`
NodeName string `json:"nodeName"`
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
}
type MachineCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineSpec struct {
NodeSpec v1.NodeSpec `json:"nodeSpec"`
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
MachineTemplateName string `json:"machineTemplateName" norman:"type=reference[machineTemplate]"`
Description string `json:"description"`
Driver string `json:"driver"`
MachineCommonParams `json:",inline"`
AmazonEC2Config AmazonEC2Config `json:"amazonEc2Config"`
AzureConfig AzureConfig `json:"azureConfig"`
DigitalOceanConfig DigitalOceanConfig `json:"digitalOceanConfig"`
}
type AmazonEC2Config struct {
}
type AzureConfig struct {
}
type DigitalOceanConfig struct {
}
type MachineCommonParams struct {
AuthCertificateAuthority string `json:"authCertificateAuthority"`
AuthKey string `json:"authKey"`
EngineInstallURL string `json:"engineInstallURL"`
DockerVersion string `json:"dockerVersion"`
EngineOpt map[string]string `json:"engineOpt"`
EngineInsecureRegistry []string `json:"engineInsecureRegistry"`
EngineRegistryMirror []string `json:"engineRegistryMirror"`
EngineLabel map[string]string `json:"engineLabel"`
EngineStorageDriver string `json:"engineStorageDriver"`
EngineEnv map[string]string `json:"engineEnv"`
}
type MachineDriver struct {
metav1.TypeMeta `json:",inline"`
// Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec MachineDriverSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status MachineDriverStatus `json:"status"`
}
type MachineDriverStatus struct {
Conditions []MachineDriverCondition `json:"conditions"`
}
type MachineDriverCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type MachineDriverSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
URL string `json:"url"`
ExternalID string `json:"externalId"`
Builtin bool `json:"builtin"`
DefaultActive bool `json:"defaultActive"`
ActivateOnCreate bool `json:"activateOnCreate"`
Checksum string `json:"checksum"`
UIURL string `json:"uiUrl"`
}

View File

@@ -0,0 +1,115 @@
package v3
type RancherKubernetesEngineConfig struct {
// Kubernetes nodes
Nodes []RKEConfigNode `yaml:"nodes" json:"nodes,omitempty"`
// Kubernetes components
Services RKEConfigServices `yaml:"services" json:"services,omitempty"`
// Network configuration used in the kubernetes cluster (flannel, calico)
Network NetworkConfig `yaml:"network" json:"network,omitempty"`
// Authentication configuration used in the cluster (default: x509)
Authentication AuthConfig `yaml:"auth" json:"auth,omitempty"`
// YAML manifest for user provided addons to be deployed on the cluster
Addons string `yaml:"addons" json:"addons,omitempty"`
// List of images used internally for proxy, cert downlaod and kubedns
SystemImages map[string]string `yaml:"system_images" json:"systemImages,omitempty"`
// SSH Private Key Path
SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"`
}
type RKEConfigNode struct {
// IP or FQDN that is fully resolvable and used for SSH communication
Address string `yaml:"address" json:"address,omitempty"`
// Optional - Internal address that will be used for components communication
InternalAddress string `yaml:"internal_address" json:"internalAddress,omitempty"`
// Node role in kubernetes cluster (controlplane, worker, or etcd)
Role []string `yaml:"role" json:"role,omitempty"`
// Optional - Hostname of the node
HostnameOverride string `yaml:"hostname_override" json:"hostnameOverride,omitempty"`
// SSH usesr that will be used by RKE
User string `yaml:"user" json:"user,omitempty"`
// Optional - Docker socket on the node that will be used in tunneling
DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"`
// SSH Private Key
SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty"`
// SSH Private Key Path
SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"`
}
type RKEConfigServices struct {
// Etcd Service
Etcd ETCDService `yaml:"etcd" json:"etcd,omitempty"`
// KubeAPI Service
KubeAPI KubeAPIService `yaml:"kube-api" json:"kubeApi,omitempty"`
// KubeController Service
KubeController KubeControllerService `yaml:"kube-controller" json:"kubeController,omitempty"`
// Scheduler Service
Scheduler SchedulerService `yaml:"scheduler" json:"scheduler,omitempty"`
// Kubelet Service
Kubelet KubeletService `yaml:"kubelet" json:"kubelet,omitempty"`
// KubeProxy Service
Kubeproxy KubeproxyService `yaml:"kubeproxy" json:"kubeproxy,omitempty"`
}
type ETCDService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
}
type KubeAPIService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range" json:"serviceClusterIpRange,omitempty"`
}
type KubeControllerService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
// CIDR Range for Pods in cluster
ClusterCIDR string `yaml:"cluster_cidr" json:"clusterCidr,omitempty"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range" json:"serviceClusterIpRange,omitempty"`
}
type KubeletService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
// Domain of the cluster (default: "cluster.local")
ClusterDomain string `yaml:"cluster_domain" json:"clusterDomain,omitempty"`
// The image whose network/ipc namespaces containers in each pod will use
InfraContainerImage string `yaml:"infra_container_image" json:"infraContainerImage,omitempty"`
// Cluster DNS service ip
ClusterDNSServer string `yaml:"cluster_dns_server" json:"clusterDnsServer,omitempty"`
}
type KubeproxyService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
}
type SchedulerService struct {
// Base service properties
BaseService `yaml:",inline" json:",inline"`
}
type BaseService struct {
// Docker image of the service
Image string `yaml:"image" json:"image,omitempty"`
// Extra arguments that are added to the services
ExtraArgs map[string]string `yaml:"extra_args" json:"extraArgs,omitempty"`
}
type NetworkConfig struct {
// Network Plugin That will be used in kubernetes cluster
Plugin string `yaml:"plugin" json:"plugin,omitempty"`
// Plugin options to configure network properties
Options map[string]string `yaml:"options" json:"options,omitempty"`
}
type AuthConfig struct {
// Authentication strategy that will be used in kubernetes cluster
Strategy string `yaml:"strategy" json:"strategy,omitempty"`
// Authentication options
Options map[string]string `yaml:"options" json:"options,omitempty"`
}

View File

@@ -1,4 +1,4 @@
package v1
package v3
import (
"context"
@@ -16,8 +16,8 @@ import (
var (
ClusterGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Version: "v3",
Group: "management.cattle.io",
Kind: "Cluster",
}
ClusterResource = metav1.APIResource{

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ClusterLifecycle interface {
Initialize(obj *Cluster) error
Remove(obj *Cluster) error
Updated(obj *Cluster) error
}
type clusterLifecycleAdapter struct {
lifecycle ClusterLifecycle
}
func (w *clusterLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*Cluster))
}
func (w *clusterLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*Cluster))
}
func (w *clusterLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*Cluster))
}
func NewClusterLifecycleAdapter(name string, client ClusterInterface, l ClusterLifecycle) ClusterHandlerFunc {
adapter := &clusterLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *Cluster) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,187 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
ClusterRoleTemplateBindingGroupVersionKind = schema.GroupVersionKind{
Version: "v3",
Group: "management.cattle.io",
Kind: "ClusterRoleTemplateBinding",
}
ClusterRoleTemplateBindingResource = metav1.APIResource{
Name: "clusterroletemplatebindings",
SingularName: "clusterroletemplatebinding",
Namespaced: false,
Kind: ClusterRoleTemplateBindingGroupVersionKind.Kind,
}
)
type ClusterRoleTemplateBindingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterRoleTemplateBinding
}
type ClusterRoleTemplateBindingHandlerFunc func(key string, obj *ClusterRoleTemplateBinding) error
type ClusterRoleTemplateBindingLister interface {
List(namespace string, selector labels.Selector) (ret []*ClusterRoleTemplateBinding, err error)
Get(namespace, name string) (*ClusterRoleTemplateBinding, error)
}
type ClusterRoleTemplateBindingController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterRoleTemplateBindingLister
AddHandler(handler ClusterRoleTemplateBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterRoleTemplateBindingInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error)
Get(name string, opts metav1.GetOptions) (*ClusterRoleTemplateBinding, error)
Update(*ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterRoleTemplateBindingList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterRoleTemplateBindingController
}
type clusterRoleTemplateBindingLister struct {
controller *clusterRoleTemplateBindingController
}
func (l *clusterRoleTemplateBindingLister) List(namespace string, selector labels.Selector) (ret []*ClusterRoleTemplateBinding, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ClusterRoleTemplateBinding))
})
return
}
func (l *clusterRoleTemplateBindingLister) Get(namespace, name string) (*ClusterRoleTemplateBinding, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ClusterRoleTemplateBindingGroupVersionKind.Group,
Resource: "clusterRoleTemplateBinding",
}, name)
}
return obj.(*ClusterRoleTemplateBinding), nil
}
type clusterRoleTemplateBindingController struct {
controller.GenericController
}
func (c *clusterRoleTemplateBindingController) Lister() ClusterRoleTemplateBindingLister {
return &clusterRoleTemplateBindingLister{
controller: c,
}
}
func (c *clusterRoleTemplateBindingController) AddHandler(handler ClusterRoleTemplateBindingHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ClusterRoleTemplateBinding))
})
}
type clusterRoleTemplateBindingFactory struct {
}
func (c clusterRoleTemplateBindingFactory) Object() runtime.Object {
return &ClusterRoleTemplateBinding{}
}
func (c clusterRoleTemplateBindingFactory) List() runtime.Object {
return &ClusterRoleTemplateBindingList{}
}
func (s *clusterRoleTemplateBindingClient) Controller() ClusterRoleTemplateBindingController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterRoleTemplateBindingControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterRoleTemplateBindingGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterRoleTemplateBindingController{
GenericController: genericController,
}
s.client.clusterRoleTemplateBindingControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterRoleTemplateBindingClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ClusterRoleTemplateBindingController
}
func (s *clusterRoleTemplateBindingClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *clusterRoleTemplateBindingClient) Create(o *ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ClusterRoleTemplateBinding), err
}
func (s *clusterRoleTemplateBindingClient) Get(name string, opts metav1.GetOptions) (*ClusterRoleTemplateBinding, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ClusterRoleTemplateBinding), err
}
func (s *clusterRoleTemplateBindingClient) Update(o *ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ClusterRoleTemplateBinding), err
}
func (s *clusterRoleTemplateBindingClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterRoleTemplateBindingClient) List(opts metav1.ListOptions) (*ClusterRoleTemplateBindingList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterRoleTemplateBindingList), err
}
func (s *clusterRoleTemplateBindingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *clusterRoleTemplateBindingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ClusterRoleTemplateBindingLifecycle interface {
Initialize(obj *ClusterRoleTemplateBinding) error
Remove(obj *ClusterRoleTemplateBinding) error
Updated(obj *ClusterRoleTemplateBinding) error
}
type clusterRoleTemplateBindingLifecycleAdapter struct {
lifecycle ClusterRoleTemplateBindingLifecycle
}
func (w *clusterRoleTemplateBindingLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*ClusterRoleTemplateBinding))
}
func (w *clusterRoleTemplateBindingLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*ClusterRoleTemplateBinding))
}
func (w *clusterRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*ClusterRoleTemplateBinding))
}
func NewClusterRoleTemplateBindingLifecycleAdapter(name string, client ClusterRoleTemplateBindingInterface, l ClusterRoleTemplateBindingLifecycle) ClusterRoleTemplateBindingHandlerFunc {
adapter := &clusterRoleTemplateBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *ClusterRoleTemplateBinding) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,187 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
ClusterRoleTemplateGroupVersionKind = schema.GroupVersionKind{
Version: "v3",
Group: "management.cattle.io",
Kind: "ClusterRoleTemplate",
}
ClusterRoleTemplateResource = metav1.APIResource{
Name: "clusterroletemplates",
SingularName: "clusterroletemplate",
Namespaced: false,
Kind: ClusterRoleTemplateGroupVersionKind.Kind,
}
)
type ClusterRoleTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterRoleTemplate
}
type ClusterRoleTemplateHandlerFunc func(key string, obj *ClusterRoleTemplate) error
type ClusterRoleTemplateLister interface {
List(namespace string, selector labels.Selector) (ret []*ClusterRoleTemplate, err error)
Get(namespace, name string) (*ClusterRoleTemplate, error)
}
type ClusterRoleTemplateController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterRoleTemplateLister
AddHandler(handler ClusterRoleTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterRoleTemplateInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*ClusterRoleTemplate) (*ClusterRoleTemplate, error)
Get(name string, opts metav1.GetOptions) (*ClusterRoleTemplate, error)
Update(*ClusterRoleTemplate) (*ClusterRoleTemplate, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterRoleTemplateList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterRoleTemplateController
}
type clusterRoleTemplateLister struct {
controller *clusterRoleTemplateController
}
func (l *clusterRoleTemplateLister) List(namespace string, selector labels.Selector) (ret []*ClusterRoleTemplate, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ClusterRoleTemplate))
})
return
}
func (l *clusterRoleTemplateLister) Get(namespace, name string) (*ClusterRoleTemplate, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ClusterRoleTemplateGroupVersionKind.Group,
Resource: "clusterRoleTemplate",
}, name)
}
return obj.(*ClusterRoleTemplate), nil
}
type clusterRoleTemplateController struct {
controller.GenericController
}
func (c *clusterRoleTemplateController) Lister() ClusterRoleTemplateLister {
return &clusterRoleTemplateLister{
controller: c,
}
}
func (c *clusterRoleTemplateController) AddHandler(handler ClusterRoleTemplateHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ClusterRoleTemplate))
})
}
type clusterRoleTemplateFactory struct {
}
func (c clusterRoleTemplateFactory) Object() runtime.Object {
return &ClusterRoleTemplate{}
}
func (c clusterRoleTemplateFactory) List() runtime.Object {
return &ClusterRoleTemplateList{}
}
func (s *clusterRoleTemplateClient) Controller() ClusterRoleTemplateController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterRoleTemplateControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterRoleTemplateGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterRoleTemplateController{
GenericController: genericController,
}
s.client.clusterRoleTemplateControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterRoleTemplateClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ClusterRoleTemplateController
}
func (s *clusterRoleTemplateClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *clusterRoleTemplateClient) Create(o *ClusterRoleTemplate) (*ClusterRoleTemplate, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ClusterRoleTemplate), err
}
func (s *clusterRoleTemplateClient) Get(name string, opts metav1.GetOptions) (*ClusterRoleTemplate, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ClusterRoleTemplate), err
}
func (s *clusterRoleTemplateClient) Update(o *ClusterRoleTemplate) (*ClusterRoleTemplate, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ClusterRoleTemplate), err
}
func (s *clusterRoleTemplateClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterRoleTemplateClient) List(opts metav1.ListOptions) (*ClusterRoleTemplateList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterRoleTemplateList), err
}
func (s *clusterRoleTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *clusterRoleTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ClusterRoleTemplateLifecycle interface {
Initialize(obj *ClusterRoleTemplate) error
Remove(obj *ClusterRoleTemplate) error
Updated(obj *ClusterRoleTemplate) error
}
type clusterRoleTemplateLifecycleAdapter struct {
lifecycle ClusterRoleTemplateLifecycle
}
func (w *clusterRoleTemplateLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*ClusterRoleTemplate))
}
func (w *clusterRoleTemplateLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*ClusterRoleTemplate))
}
func (w *clusterRoleTemplateLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*ClusterRoleTemplate))
}
func NewClusterRoleTemplateLifecycleAdapter(name string, client ClusterRoleTemplateInterface, l ClusterRoleTemplateLifecycle) ClusterRoleTemplateHandlerFunc {
adapter := &clusterRoleTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *ClusterRoleTemplate) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -1,7 +1,8 @@
package v1
package v3
import (
core_v1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
rbac_v1 "k8s.io/api/rbac/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -133,7 +134,7 @@ func (in *ClusterComponentStatus) DeepCopyInto(out *ClusterComponentStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]core_v1.ComponentCondition, len(*in))
*out = make([]v1.ComponentCondition, len(*in))
copy(*out, *in)
}
return
@@ -200,27 +201,37 @@ func (in *ClusterList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterNode) DeepCopyInto(out *ClusterNode) {
func (in *ClusterRoleTemplate) DeepCopyInto(out *ClusterRoleTemplate) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.NodeSpec.DeepCopyInto(&out.NodeSpec)
in.Status.DeepCopyInto(&out.Status)
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]rbac_v1.PolicyRule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.ClusterRoleTemplateNames != nil {
in, out := &in.ClusterRoleTemplateNames, &out.ClusterRoleTemplateNames
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNode.
func (in *ClusterNode) DeepCopy() *ClusterNode {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleTemplate.
func (in *ClusterRoleTemplate) DeepCopy() *ClusterRoleTemplate {
if in == nil {
return nil
}
out := new(ClusterNode)
out := new(ClusterRoleTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterNode) DeepCopyObject() runtime.Object {
func (in *ClusterRoleTemplate) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
@@ -229,13 +240,41 @@ func (in *ClusterNode) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterNodeList) DeepCopyInto(out *ClusterNodeList) {
func (in *ClusterRoleTemplateBinding) DeepCopyInto(out *ClusterRoleTemplateBinding) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Subject = in.Subject
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleTemplateBinding.
func (in *ClusterRoleTemplateBinding) DeepCopy() *ClusterRoleTemplateBinding {
if in == nil {
return nil
}
out := new(ClusterRoleTemplateBinding)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterRoleTemplateBinding) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterRoleTemplateBindingList) DeepCopyInto(out *ClusterRoleTemplateBindingList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterNode, len(*in))
*out = make([]ClusterRoleTemplateBinding, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
@@ -243,18 +282,18 @@ func (in *ClusterNodeList) DeepCopyInto(out *ClusterNodeList) {
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodeList.
func (in *ClusterNodeList) DeepCopy() *ClusterNodeList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleTemplateBindingList.
func (in *ClusterRoleTemplateBindingList) DeepCopy() *ClusterRoleTemplateBindingList {
if in == nil {
return nil
}
out := new(ClusterNodeList)
out := new(ClusterRoleTemplateBindingList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterNodeList) DeepCopyObject() runtime.Object {
func (in *ClusterRoleTemplateBindingList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
@@ -263,36 +302,39 @@ func (in *ClusterNodeList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterNodeStatus) DeepCopyInto(out *ClusterNodeStatus) {
func (in *ClusterRoleTemplateList) DeepCopyInto(out *ClusterRoleTemplateList) {
*out = *in
in.NodeStatus.DeepCopyInto(&out.NodeStatus)
if in.Requested != nil {
in, out := &in.Requested, &out.Requested
*out = make(core_v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.Limits != nil {
in, out := &in.Limits, &out.Limits
*out = make(core_v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterRoleTemplate, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNodeStatus.
func (in *ClusterNodeStatus) DeepCopy() *ClusterNodeStatus {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleTemplateList.
func (in *ClusterRoleTemplateList) DeepCopy() *ClusterRoleTemplateList {
if in == nil {
return nil
}
out := new(ClusterNodeStatus)
out := new(ClusterRoleTemplateList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterRoleTemplateList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
*out = *in
@@ -353,14 +395,14 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
}
if in.Capacity != nil {
in, out := &in.Capacity, &out.Capacity
*out = make(core_v1.ResourceList, len(*in))
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.Allocatable != nil {
in, out := &in.Allocatable, &out.Allocatable
*out = make(core_v1.ResourceList, len(*in))
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
@@ -368,14 +410,14 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
in.AppliedSpec.DeepCopyInto(&out.AppliedSpec)
if in.Requested != nil {
in, out := &in.Requested, &out.Requested
*out = make(core_v1.ResourceList, len(*in))
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.Limits != nil {
in, out := &in.Limits, &out.Limits
*out = make(core_v1.ResourceList, len(*in))
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
@@ -546,6 +588,53 @@ func (in *Machine) DeepCopyObject() runtime.Object {
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MachineCommonParams) DeepCopyInto(out *MachineCommonParams) {
*out = *in
if in.EngineOpt != nil {
in, out := &in.EngineOpt, &out.EngineOpt
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.EngineInsecureRegistry != nil {
in, out := &in.EngineInsecureRegistry, &out.EngineInsecureRegistry
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EngineRegistryMirror != nil {
in, out := &in.EngineRegistryMirror, &out.EngineRegistryMirror
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EngineLabel != nil {
in, out := &in.EngineLabel, &out.EngineLabel
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.EngineEnv != nil {
in, out := &in.EngineEnv, &out.EngineEnv
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineCommonParams.
func (in *MachineCommonParams) DeepCopy() *MachineCommonParams {
if in == nil {
return nil
}
out := new(MachineCommonParams)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MachineCondition) DeepCopyInto(out *MachineCondition) {
*out = *in
@@ -678,53 +767,6 @@ func (in *MachineDriverStatus) DeepCopy() *MachineDriverStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MachineGeneralParams) DeepCopyInto(out *MachineGeneralParams) {
*out = *in
if in.EngineOpt != nil {
in, out := &in.EngineOpt, &out.EngineOpt
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.EngineInsecureRegistry != nil {
in, out := &in.EngineInsecureRegistry, &out.EngineInsecureRegistry
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EngineRegistryMirror != nil {
in, out := &in.EngineRegistryMirror, &out.EngineRegistryMirror
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EngineLabel != nil {
in, out := &in.EngineLabel, &out.EngineLabel
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.EngineEnv != nil {
in, out := &in.EngineEnv, &out.EngineEnv
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineGeneralParams.
func (in *MachineGeneralParams) DeepCopy() *MachineGeneralParams {
if in == nil {
return nil
}
out := new(MachineGeneralParams)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MachineList) DeepCopyInto(out *MachineList) {
*out = *in
@@ -762,7 +804,8 @@ func (in *MachineList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MachineSpec) DeepCopyInto(out *MachineSpec) {
*out = *in
in.MachineGeneralParams.DeepCopyInto(&out.MachineGeneralParams)
in.NodeSpec.DeepCopyInto(&out.NodeSpec)
in.MachineCommonParams.DeepCopyInto(&out.MachineCommonParams)
out.AmazonEC2Config = in.AmazonEC2Config
out.AzureConfig = in.AzureConfig
out.DigitalOceanConfig = in.DigitalOceanConfig
@@ -787,6 +830,21 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) {
*out = make([]MachineCondition, len(*in))
copy(*out, *in)
}
in.NodeStatus.DeepCopyInto(&out.NodeStatus)
if in.Requested != nil {
in, out := &in.Requested, &out.Requested
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.Limits != nil {
in, out := &in.Limits, &out.Limits
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
return
}
@@ -953,6 +1011,281 @@ func (in *NetworkConfig) DeepCopy() *NetworkConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSecurityPolicyTemplate) DeepCopyInto(out *PodSecurityPolicyTemplate) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSecurityPolicyTemplate.
func (in *PodSecurityPolicyTemplate) DeepCopy() *PodSecurityPolicyTemplate {
if in == nil {
return nil
}
out := new(PodSecurityPolicyTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodSecurityPolicyTemplate) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSecurityPolicyTemplateList) DeepCopyInto(out *PodSecurityPolicyTemplateList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PodSecurityPolicyTemplate, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSecurityPolicyTemplateList.
func (in *PodSecurityPolicyTemplateList) DeepCopy() *PodSecurityPolicyTemplateList {
if in == nil {
return nil
}
out := new(PodSecurityPolicyTemplateList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodSecurityPolicyTemplateList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Project) DeepCopyInto(out *Project) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Project.
func (in *Project) DeepCopy() *Project {
if in == nil {
return nil
}
out := new(Project)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Project) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectList) DeepCopyInto(out *ProjectList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Project, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectList.
func (in *ProjectList) DeepCopy() *ProjectList {
if in == nil {
return nil
}
out := new(ProjectList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ProjectList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectRoleTemplate) DeepCopyInto(out *ProjectRoleTemplate) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]rbac_v1.PolicyRule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.ProjectRoleTemplateNames != nil {
in, out := &in.ProjectRoleTemplateNames, &out.ProjectRoleTemplateNames
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleTemplate.
func (in *ProjectRoleTemplate) DeepCopy() *ProjectRoleTemplate {
if in == nil {
return nil
}
out := new(ProjectRoleTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ProjectRoleTemplate) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectRoleTemplateBinding) DeepCopyInto(out *ProjectRoleTemplateBinding) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Subject = in.Subject
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleTemplateBinding.
func (in *ProjectRoleTemplateBinding) DeepCopy() *ProjectRoleTemplateBinding {
if in == nil {
return nil
}
out := new(ProjectRoleTemplateBinding)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ProjectRoleTemplateBinding) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectRoleTemplateBindingList) DeepCopyInto(out *ProjectRoleTemplateBindingList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ProjectRoleTemplateBinding, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleTemplateBindingList.
func (in *ProjectRoleTemplateBindingList) DeepCopy() *ProjectRoleTemplateBindingList {
if in == nil {
return nil
}
out := new(ProjectRoleTemplateBindingList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ProjectRoleTemplateBindingList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectRoleTemplateList) DeepCopyInto(out *ProjectRoleTemplateList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ProjectRoleTemplate, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleTemplateList.
func (in *ProjectRoleTemplateList) DeepCopy() *ProjectRoleTemplateList {
if in == nil {
return nil
}
out := new(ProjectRoleTemplateList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ProjectRoleTemplateList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectSpec) DeepCopyInto(out *ProjectSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectSpec.
func (in *ProjectSpec) DeepCopy() *ProjectSpec {
if in == nil {
return nil
}
out := new(ProjectSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RKEConfigNode) DeepCopyInto(out *RKEConfigNode) {
*out = *in
@@ -1009,8 +1342,8 @@ func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngi
in.Services.DeepCopyInto(&out.Services)
in.Network.DeepCopyInto(&out.Network)
in.Authentication.DeepCopyInto(&out.Authentication)
if in.RKEImages != nil {
in, out := &in.RKEImages, &out.RKEImages
if in.SystemImages != nil {
in, out := &in.SystemImages, &out.SystemImages
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val

View File

@@ -0,0 +1,213 @@
package v3
import (
"context"
"sync"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
)
type Interface interface {
RESTClient() rest.Interface
controller.Starter
MachinesGetter
MachineDriversGetter
MachineTemplatesGetter
ProjectsGetter
ProjectRoleTemplatesGetter
PodSecurityPolicyTemplatesGetter
ClusterRoleTemplatesGetter
ClusterRoleTemplateBindingsGetter
ProjectRoleTemplateBindingsGetter
ClustersGetter
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
machineControllers map[string]MachineController
machineDriverControllers map[string]MachineDriverController
machineTemplateControllers map[string]MachineTemplateController
projectControllers map[string]ProjectController
projectRoleTemplateControllers map[string]ProjectRoleTemplateController
podSecurityPolicyTemplateControllers map[string]PodSecurityPolicyTemplateController
clusterRoleTemplateControllers map[string]ClusterRoleTemplateController
clusterRoleTemplateBindingControllers map[string]ClusterRoleTemplateBindingController
projectRoleTemplateBindingControllers map[string]ProjectRoleTemplateBindingController
clusterControllers map[string]ClusterController
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
configConfig := dynamic.ContentConfig()
config.NegotiatedSerializer = configConfig.NegotiatedSerializer
}
restClient, err := rest.UnversionedRESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{
restClient: restClient,
machineControllers: map[string]MachineController{},
machineDriverControllers: map[string]MachineDriverController{},
machineTemplateControllers: map[string]MachineTemplateController{},
projectControllers: map[string]ProjectController{},
projectRoleTemplateControllers: map[string]ProjectRoleTemplateController{},
podSecurityPolicyTemplateControllers: map[string]PodSecurityPolicyTemplateController{},
clusterRoleTemplateControllers: map[string]ClusterRoleTemplateController{},
clusterRoleTemplateBindingControllers: map[string]ClusterRoleTemplateBindingController{},
projectRoleTemplateBindingControllers: map[string]ProjectRoleTemplateBindingController{},
clusterControllers: map[string]ClusterController{},
}, 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 MachinesGetter interface {
Machines(namespace string) MachineInterface
}
func (c *Client) Machines(namespace string) MachineInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &MachineResource, MachineGroupVersionKind, machineFactory{})
return &machineClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type MachineDriversGetter interface {
MachineDrivers(namespace string) MachineDriverInterface
}
func (c *Client) MachineDrivers(namespace string) MachineDriverInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &MachineDriverResource, MachineDriverGroupVersionKind, machineDriverFactory{})
return &machineDriverClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type MachineTemplatesGetter interface {
MachineTemplates(namespace string) MachineTemplateInterface
}
func (c *Client) MachineTemplates(namespace string) MachineTemplateInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &MachineTemplateResource, MachineTemplateGroupVersionKind, machineTemplateFactory{})
return &machineTemplateClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ProjectsGetter interface {
Projects(namespace string) ProjectInterface
}
func (c *Client) Projects(namespace string) ProjectInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ProjectResource, ProjectGroupVersionKind, projectFactory{})
return &projectClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ProjectRoleTemplatesGetter interface {
ProjectRoleTemplates(namespace string) ProjectRoleTemplateInterface
}
func (c *Client) ProjectRoleTemplates(namespace string) ProjectRoleTemplateInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ProjectRoleTemplateResource, ProjectRoleTemplateGroupVersionKind, projectRoleTemplateFactory{})
return &projectRoleTemplateClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type PodSecurityPolicyTemplatesGetter interface {
PodSecurityPolicyTemplates(namespace string) PodSecurityPolicyTemplateInterface
}
func (c *Client) PodSecurityPolicyTemplates(namespace string) PodSecurityPolicyTemplateInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &PodSecurityPolicyTemplateResource, PodSecurityPolicyTemplateGroupVersionKind, podSecurityPolicyTemplateFactory{})
return &podSecurityPolicyTemplateClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ClusterRoleTemplatesGetter interface {
ClusterRoleTemplates(namespace string) ClusterRoleTemplateInterface
}
func (c *Client) ClusterRoleTemplates(namespace string) ClusterRoleTemplateInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterRoleTemplateResource, ClusterRoleTemplateGroupVersionKind, clusterRoleTemplateFactory{})
return &clusterRoleTemplateClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ClusterRoleTemplateBindingsGetter interface {
ClusterRoleTemplateBindings(namespace string) ClusterRoleTemplateBindingInterface
}
func (c *Client) ClusterRoleTemplateBindings(namespace string) ClusterRoleTemplateBindingInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterRoleTemplateBindingResource, ClusterRoleTemplateBindingGroupVersionKind, clusterRoleTemplateBindingFactory{})
return &clusterRoleTemplateBindingClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ProjectRoleTemplateBindingsGetter interface {
ProjectRoleTemplateBindings(namespace string) ProjectRoleTemplateBindingInterface
}
func (c *Client) ProjectRoleTemplateBindings(namespace string) ProjectRoleTemplateBindingInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ProjectRoleTemplateBindingResource, ProjectRoleTemplateBindingGroupVersionKind, projectRoleTemplateBindingFactory{})
return &projectRoleTemplateBindingClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
func (c *Client) Clusters(namespace string) ClusterInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterResource, ClusterGroupVersionKind, clusterFactory{})
return &clusterClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@@ -1,4 +1,4 @@
package v1
package v3
import (
"context"
@@ -16,8 +16,8 @@ import (
var (
MachineGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Version: "v3",
Group: "management.cattle.io",
Kind: "Machine",
}
MachineResource = metav1.APIResource{

View File

@@ -1,4 +1,4 @@
package v1
package v3
import (
"context"
@@ -16,8 +16,8 @@ import (
var (
MachineDriverGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Version: "v3",
Group: "management.cattle.io",
Kind: "MachineDriver",
}
MachineDriverResource = metav1.APIResource{

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type MachineDriverLifecycle interface {
Initialize(obj *MachineDriver) error
Remove(obj *MachineDriver) error
Updated(obj *MachineDriver) error
}
type machineDriverLifecycleAdapter struct {
lifecycle MachineDriverLifecycle
}
func (w *machineDriverLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*MachineDriver))
}
func (w *machineDriverLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*MachineDriver))
}
func (w *machineDriverLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*MachineDriver))
}
func NewMachineDriverLifecycleAdapter(name string, client MachineDriverInterface, l MachineDriverLifecycle) MachineDriverHandlerFunc {
adapter := &machineDriverLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *MachineDriver) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type MachineLifecycle interface {
Initialize(obj *Machine) error
Remove(obj *Machine) error
Updated(obj *Machine) error
}
type machineLifecycleAdapter struct {
lifecycle MachineLifecycle
}
func (w *machineLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*Machine))
}
func (w *machineLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*Machine))
}
func (w *machineLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*Machine))
}
func NewMachineLifecycleAdapter(name string, client MachineInterface, l MachineLifecycle) MachineHandlerFunc {
adapter := &machineLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *Machine) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -1,4 +1,4 @@
package v1
package v3
import (
"context"
@@ -16,8 +16,8 @@ import (
var (
MachineTemplateGroupVersionKind = schema.GroupVersionKind{
Version: "v1",
Group: "cluster.cattle.io",
Version: "v3",
Group: "management.cattle.io",
Kind: "MachineTemplate",
}
MachineTemplateResource = metav1.APIResource{

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type MachineTemplateLifecycle interface {
Initialize(obj *MachineTemplate) error
Remove(obj *MachineTemplate) error
Updated(obj *MachineTemplate) error
}
type machineTemplateLifecycleAdapter struct {
lifecycle MachineTemplateLifecycle
}
func (w *machineTemplateLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*MachineTemplate))
}
func (w *machineTemplateLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*MachineTemplate))
}
func (w *machineTemplateLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*MachineTemplate))
}
func NewMachineTemplateLifecycleAdapter(name string, client MachineTemplateInterface, l MachineTemplateLifecycle) MachineTemplateHandlerFunc {
adapter := &machineTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *MachineTemplate) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,187 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
PodSecurityPolicyTemplateGroupVersionKind = schema.GroupVersionKind{
Version: "v3",
Group: "management.cattle.io",
Kind: "PodSecurityPolicyTemplate",
}
PodSecurityPolicyTemplateResource = metav1.APIResource{
Name: "podsecuritypolicytemplates",
SingularName: "podsecuritypolicytemplate",
Namespaced: false,
Kind: PodSecurityPolicyTemplateGroupVersionKind.Kind,
}
)
type PodSecurityPolicyTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PodSecurityPolicyTemplate
}
type PodSecurityPolicyTemplateHandlerFunc func(key string, obj *PodSecurityPolicyTemplate) error
type PodSecurityPolicyTemplateLister interface {
List(namespace string, selector labels.Selector) (ret []*PodSecurityPolicyTemplate, err error)
Get(namespace, name string) (*PodSecurityPolicyTemplate, error)
}
type PodSecurityPolicyTemplateController interface {
Informer() cache.SharedIndexInformer
Lister() PodSecurityPolicyTemplateLister
AddHandler(handler PodSecurityPolicyTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type PodSecurityPolicyTemplateInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error)
Get(name string, opts metav1.GetOptions) (*PodSecurityPolicyTemplate, error)
Update(*PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*PodSecurityPolicyTemplateList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() PodSecurityPolicyTemplateController
}
type podSecurityPolicyTemplateLister struct {
controller *podSecurityPolicyTemplateController
}
func (l *podSecurityPolicyTemplateLister) List(namespace string, selector labels.Selector) (ret []*PodSecurityPolicyTemplate, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*PodSecurityPolicyTemplate))
})
return
}
func (l *podSecurityPolicyTemplateLister) Get(namespace, name string) (*PodSecurityPolicyTemplate, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: PodSecurityPolicyTemplateGroupVersionKind.Group,
Resource: "podSecurityPolicyTemplate",
}, name)
}
return obj.(*PodSecurityPolicyTemplate), nil
}
type podSecurityPolicyTemplateController struct {
controller.GenericController
}
func (c *podSecurityPolicyTemplateController) Lister() PodSecurityPolicyTemplateLister {
return &podSecurityPolicyTemplateLister{
controller: c,
}
}
func (c *podSecurityPolicyTemplateController) AddHandler(handler PodSecurityPolicyTemplateHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*PodSecurityPolicyTemplate))
})
}
type podSecurityPolicyTemplateFactory struct {
}
func (c podSecurityPolicyTemplateFactory) Object() runtime.Object {
return &PodSecurityPolicyTemplate{}
}
func (c podSecurityPolicyTemplateFactory) List() runtime.Object {
return &PodSecurityPolicyTemplateList{}
}
func (s *podSecurityPolicyTemplateClient) Controller() PodSecurityPolicyTemplateController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.podSecurityPolicyTemplateControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(PodSecurityPolicyTemplateGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &podSecurityPolicyTemplateController{
GenericController: genericController,
}
s.client.podSecurityPolicyTemplateControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type podSecurityPolicyTemplateClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller PodSecurityPolicyTemplateController
}
func (s *podSecurityPolicyTemplateClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *podSecurityPolicyTemplateClient) Create(o *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) {
obj, err := s.objectClient.Create(o)
return obj.(*PodSecurityPolicyTemplate), err
}
func (s *podSecurityPolicyTemplateClient) Get(name string, opts metav1.GetOptions) (*PodSecurityPolicyTemplate, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*PodSecurityPolicyTemplate), err
}
func (s *podSecurityPolicyTemplateClient) Update(o *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*PodSecurityPolicyTemplate), err
}
func (s *podSecurityPolicyTemplateClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *podSecurityPolicyTemplateClient) List(opts metav1.ListOptions) (*PodSecurityPolicyTemplateList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*PodSecurityPolicyTemplateList), err
}
func (s *podSecurityPolicyTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *podSecurityPolicyTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type PodSecurityPolicyTemplateLifecycle interface {
Initialize(obj *PodSecurityPolicyTemplate) error
Remove(obj *PodSecurityPolicyTemplate) error
Updated(obj *PodSecurityPolicyTemplate) error
}
type podSecurityPolicyTemplateLifecycleAdapter struct {
lifecycle PodSecurityPolicyTemplateLifecycle
}
func (w *podSecurityPolicyTemplateLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*PodSecurityPolicyTemplate))
}
func (w *podSecurityPolicyTemplateLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*PodSecurityPolicyTemplate))
}
func (w *podSecurityPolicyTemplateLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*PodSecurityPolicyTemplate))
}
func NewPodSecurityPolicyTemplateLifecycleAdapter(name string, client PodSecurityPolicyTemplateInterface, l PodSecurityPolicyTemplateLifecycle) PodSecurityPolicyTemplateHandlerFunc {
adapter := &podSecurityPolicyTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *PodSecurityPolicyTemplate) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,187 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
ProjectGroupVersionKind = schema.GroupVersionKind{
Version: "v3",
Group: "management.cattle.io",
Kind: "Project",
}
ProjectResource = metav1.APIResource{
Name: "projects",
SingularName: "project",
Namespaced: false,
Kind: ProjectGroupVersionKind.Kind,
}
)
type ProjectList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Project
}
type ProjectHandlerFunc func(key string, obj *Project) error
type ProjectLister interface {
List(namespace string, selector labels.Selector) (ret []*Project, err error)
Get(namespace, name string) (*Project, error)
}
type ProjectController interface {
Informer() cache.SharedIndexInformer
Lister() ProjectLister
AddHandler(handler ProjectHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ProjectInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*Project) (*Project, error)
Get(name string, opts metav1.GetOptions) (*Project, error)
Update(*Project) (*Project, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ProjectList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ProjectController
}
type projectLister struct {
controller *projectController
}
func (l *projectLister) List(namespace string, selector labels.Selector) (ret []*Project, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*Project))
})
return
}
func (l *projectLister) Get(namespace, name string) (*Project, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ProjectGroupVersionKind.Group,
Resource: "project",
}, name)
}
return obj.(*Project), nil
}
type projectController struct {
controller.GenericController
}
func (c *projectController) Lister() ProjectLister {
return &projectLister{
controller: c,
}
}
func (c *projectController) AddHandler(handler ProjectHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*Project))
})
}
type projectFactory struct {
}
func (c projectFactory) Object() runtime.Object {
return &Project{}
}
func (c projectFactory) List() runtime.Object {
return &ProjectList{}
}
func (s *projectClient) Controller() ProjectController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.projectControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ProjectGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &projectController{
GenericController: genericController,
}
s.client.projectControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type projectClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ProjectController
}
func (s *projectClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *projectClient) Create(o *Project) (*Project, error) {
obj, err := s.objectClient.Create(o)
return obj.(*Project), err
}
func (s *projectClient) Get(name string, opts metav1.GetOptions) (*Project, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*Project), err
}
func (s *projectClient) Update(o *Project) (*Project, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*Project), err
}
func (s *projectClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *projectClient) List(opts metav1.ListOptions) (*ProjectList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ProjectList), err
}
func (s *projectClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *projectClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ProjectLifecycle interface {
Initialize(obj *Project) error
Remove(obj *Project) error
Updated(obj *Project) error
}
type projectLifecycleAdapter struct {
lifecycle ProjectLifecycle
}
func (w *projectLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*Project))
}
func (w *projectLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*Project))
}
func (w *projectLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*Project))
}
func NewProjectLifecycleAdapter(name string, client ProjectInterface, l ProjectLifecycle) ProjectHandlerFunc {
adapter := &projectLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *Project) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,187 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
ProjectRoleTemplateBindingGroupVersionKind = schema.GroupVersionKind{
Version: "v3",
Group: "management.cattle.io",
Kind: "ProjectRoleTemplateBinding",
}
ProjectRoleTemplateBindingResource = metav1.APIResource{
Name: "projectroletemplatebindings",
SingularName: "projectroletemplatebinding",
Namespaced: false,
Kind: ProjectRoleTemplateBindingGroupVersionKind.Kind,
}
)
type ProjectRoleTemplateBindingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ProjectRoleTemplateBinding
}
type ProjectRoleTemplateBindingHandlerFunc func(key string, obj *ProjectRoleTemplateBinding) error
type ProjectRoleTemplateBindingLister interface {
List(namespace string, selector labels.Selector) (ret []*ProjectRoleTemplateBinding, err error)
Get(namespace, name string) (*ProjectRoleTemplateBinding, error)
}
type ProjectRoleTemplateBindingController interface {
Informer() cache.SharedIndexInformer
Lister() ProjectRoleTemplateBindingLister
AddHandler(handler ProjectRoleTemplateBindingHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ProjectRoleTemplateBindingInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error)
Get(name string, opts metav1.GetOptions) (*ProjectRoleTemplateBinding, error)
Update(*ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ProjectRoleTemplateBindingList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ProjectRoleTemplateBindingController
}
type projectRoleTemplateBindingLister struct {
controller *projectRoleTemplateBindingController
}
func (l *projectRoleTemplateBindingLister) List(namespace string, selector labels.Selector) (ret []*ProjectRoleTemplateBinding, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ProjectRoleTemplateBinding))
})
return
}
func (l *projectRoleTemplateBindingLister) Get(namespace, name string) (*ProjectRoleTemplateBinding, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ProjectRoleTemplateBindingGroupVersionKind.Group,
Resource: "projectRoleTemplateBinding",
}, name)
}
return obj.(*ProjectRoleTemplateBinding), nil
}
type projectRoleTemplateBindingController struct {
controller.GenericController
}
func (c *projectRoleTemplateBindingController) Lister() ProjectRoleTemplateBindingLister {
return &projectRoleTemplateBindingLister{
controller: c,
}
}
func (c *projectRoleTemplateBindingController) AddHandler(handler ProjectRoleTemplateBindingHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ProjectRoleTemplateBinding))
})
}
type projectRoleTemplateBindingFactory struct {
}
func (c projectRoleTemplateBindingFactory) Object() runtime.Object {
return &ProjectRoleTemplateBinding{}
}
func (c projectRoleTemplateBindingFactory) List() runtime.Object {
return &ProjectRoleTemplateBindingList{}
}
func (s *projectRoleTemplateBindingClient) Controller() ProjectRoleTemplateBindingController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.projectRoleTemplateBindingControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ProjectRoleTemplateBindingGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &projectRoleTemplateBindingController{
GenericController: genericController,
}
s.client.projectRoleTemplateBindingControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type projectRoleTemplateBindingClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ProjectRoleTemplateBindingController
}
func (s *projectRoleTemplateBindingClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *projectRoleTemplateBindingClient) Create(o *ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ProjectRoleTemplateBinding), err
}
func (s *projectRoleTemplateBindingClient) Get(name string, opts metav1.GetOptions) (*ProjectRoleTemplateBinding, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ProjectRoleTemplateBinding), err
}
func (s *projectRoleTemplateBindingClient) Update(o *ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ProjectRoleTemplateBinding), err
}
func (s *projectRoleTemplateBindingClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *projectRoleTemplateBindingClient) List(opts metav1.ListOptions) (*ProjectRoleTemplateBindingList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ProjectRoleTemplateBindingList), err
}
func (s *projectRoleTemplateBindingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *projectRoleTemplateBindingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ProjectRoleTemplateBindingLifecycle interface {
Initialize(obj *ProjectRoleTemplateBinding) error
Remove(obj *ProjectRoleTemplateBinding) error
Updated(obj *ProjectRoleTemplateBinding) error
}
type projectRoleTemplateBindingLifecycleAdapter struct {
lifecycle ProjectRoleTemplateBindingLifecycle
}
func (w *projectRoleTemplateBindingLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*ProjectRoleTemplateBinding))
}
func (w *projectRoleTemplateBindingLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*ProjectRoleTemplateBinding))
}
func (w *projectRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*ProjectRoleTemplateBinding))
}
func NewProjectRoleTemplateBindingLifecycleAdapter(name string, client ProjectRoleTemplateBindingInterface, l ProjectRoleTemplateBindingLifecycle) ProjectRoleTemplateBindingHandlerFunc {
adapter := &projectRoleTemplateBindingLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *ProjectRoleTemplateBinding) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -0,0 +1,187 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
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/watch"
"k8s.io/client-go/tools/cache"
)
var (
ProjectRoleTemplateGroupVersionKind = schema.GroupVersionKind{
Version: "v3",
Group: "management.cattle.io",
Kind: "ProjectRoleTemplate",
}
ProjectRoleTemplateResource = metav1.APIResource{
Name: "projectroletemplates",
SingularName: "projectroletemplate",
Namespaced: false,
Kind: ProjectRoleTemplateGroupVersionKind.Kind,
}
)
type ProjectRoleTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ProjectRoleTemplate
}
type ProjectRoleTemplateHandlerFunc func(key string, obj *ProjectRoleTemplate) error
type ProjectRoleTemplateLister interface {
List(namespace string, selector labels.Selector) (ret []*ProjectRoleTemplate, err error)
Get(namespace, name string) (*ProjectRoleTemplate, error)
}
type ProjectRoleTemplateController interface {
Informer() cache.SharedIndexInformer
Lister() ProjectRoleTemplateLister
AddHandler(handler ProjectRoleTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ProjectRoleTemplateInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*ProjectRoleTemplate) (*ProjectRoleTemplate, error)
Get(name string, opts metav1.GetOptions) (*ProjectRoleTemplate, error)
Update(*ProjectRoleTemplate) (*ProjectRoleTemplate, error)
Delete(name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ProjectRoleTemplateList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ProjectRoleTemplateController
}
type projectRoleTemplateLister struct {
controller *projectRoleTemplateController
}
func (l *projectRoleTemplateLister) List(namespace string, selector labels.Selector) (ret []*ProjectRoleTemplate, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ProjectRoleTemplate))
})
return
}
func (l *projectRoleTemplateLister) Get(namespace, name string) (*ProjectRoleTemplate, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ProjectRoleTemplateGroupVersionKind.Group,
Resource: "projectRoleTemplate",
}, name)
}
return obj.(*ProjectRoleTemplate), nil
}
type projectRoleTemplateController struct {
controller.GenericController
}
func (c *projectRoleTemplateController) Lister() ProjectRoleTemplateLister {
return &projectRoleTemplateLister{
controller: c,
}
}
func (c *projectRoleTemplateController) AddHandler(handler ProjectRoleTemplateHandlerFunc) {
c.GenericController.AddHandler(func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ProjectRoleTemplate))
})
}
type projectRoleTemplateFactory struct {
}
func (c projectRoleTemplateFactory) Object() runtime.Object {
return &ProjectRoleTemplate{}
}
func (c projectRoleTemplateFactory) List() runtime.Object {
return &ProjectRoleTemplateList{}
}
func (s *projectRoleTemplateClient) Controller() ProjectRoleTemplateController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.projectRoleTemplateControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ProjectRoleTemplateGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &projectRoleTemplateController{
GenericController: genericController,
}
s.client.projectRoleTemplateControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type projectRoleTemplateClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ProjectRoleTemplateController
}
func (s *projectRoleTemplateClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *projectRoleTemplateClient) Create(o *ProjectRoleTemplate) (*ProjectRoleTemplate, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ProjectRoleTemplate), err
}
func (s *projectRoleTemplateClient) Get(name string, opts metav1.GetOptions) (*ProjectRoleTemplate, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ProjectRoleTemplate), err
}
func (s *projectRoleTemplateClient) Update(o *ProjectRoleTemplate) (*ProjectRoleTemplate, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ProjectRoleTemplate), err
}
func (s *projectRoleTemplateClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *projectRoleTemplateClient) List(opts metav1.ListOptions) (*ProjectRoleTemplateList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ProjectRoleTemplateList), err
}
func (s *projectRoleTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
func (s *projectRoleTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}

View File

@@ -0,0 +1,39 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ProjectRoleTemplateLifecycle interface {
Initialize(obj *ProjectRoleTemplate) error
Remove(obj *ProjectRoleTemplate) error
Updated(obj *ProjectRoleTemplate) error
}
type projectRoleTemplateLifecycleAdapter struct {
lifecycle ProjectRoleTemplateLifecycle
}
func (w *projectRoleTemplateLifecycleAdapter) Initialize(obj runtime.Object) error {
return w.lifecycle.Initialize(obj.(*ProjectRoleTemplate))
}
func (w *projectRoleTemplateLifecycleAdapter) Finalize(obj runtime.Object) error {
return w.lifecycle.Remove(obj.(*ProjectRoleTemplate))
}
func (w *projectRoleTemplateLifecycleAdapter) Updated(obj runtime.Object) error {
return w.lifecycle.Updated(obj.(*ProjectRoleTemplate))
}
func NewProjectRoleTemplateLifecycleAdapter(name string, client ProjectRoleTemplateInterface, l ProjectRoleTemplateLifecycle) ProjectRoleTemplateHandlerFunc {
adapter := &projectRoleTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
return func(key string, obj *ProjectRoleTemplate) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -3,5 +3,5 @@ github.com/rancher/types
k8s.io/kubernetes v1.8.3 transitive=true,staging=true
bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git
github.com/rancher/norman 5ec6a8d719917fcca3cab8e8e9036384385ced40
github.com/rancher/norman 18d3f69aa84ed39326e731ebfa509cf104bf9ad1 transitive=true
golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5