1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-01 23:33:39 +00:00

Merge pull request #377 from galal-hussein/update_vendor

Vendor Update
This commit is contained in:
Alena Prokharchyk 2018-02-23 16:23:08 -08:00 committed by GitHub
commit 98c77a2e26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 610 additions and 89 deletions

View File

@ -24,4 +24,4 @@ github.com/coreos/go-semver e214231b295a8ea9479f11b70b35d5acf3556d9
github.com/ugorji/go/codec ccfe18359b55b97855cee1d3f74e5efbda4869dc
github.com/rancher/norman 151aa66e3e99de7e0d195e2d5ca96b1f95544555
github.com/rancher/types 70d61f81e1ec0c9df98fff3098629d2d4ed17cb6
github.com/rancher/types 7baa43c5d1a5f9385a1e791f85151978553bf38d

View File

@ -69,19 +69,19 @@ type TargetNode struct {
NodeName string `json:"nodeName,omitempty" norman:"type=reference[node]"`
Selector map[string]string `json:"selector,omitempty"`
Condition string `json:"condition,omitempty" norman:"required,options=notready|mem|cpu,default=notready"`
MemThreshold int `json:"memThreshold,omitempty" norman:"min=1,max=100"`
CPUThreshold int `json:"cpuThreshold,omitempty" norman:"min=1"`
MemThreshold int `json:"memThreshold,omitempty" norman:"min=1,max=100,default=70"`
CPUThreshold int `json:"cpuThreshold,omitempty" norman:"min=1,default=70"`
}
type TargetPod struct {
PodName string `json:"podName,omitempty" norman:"required,type=reference[/v3/projects/schemas/pod]"`
Condition string `json:"condition,omitempty" norman:"required,options=notrunning|notscheduled|restarts,default=notrunning"`
RestartTimes int `json:"restartTimes,omitempty" norman:"min=1"`
RestartIntervalSeconds int `json:"restartIntervalSeconds,omitempty" norman:"min=1"`
RestartTimes int `json:"restartTimes,omitempty" norman:"min=1,default=3"`
RestartIntervalSeconds int `json:"restartIntervalSeconds,omitempty" norman:"min=1,default=300"`
}
type TargetEvent struct {
Type string `json:"type,omitempty" norman:"required,options=Normal|Warning,default=warning"`
Type string `json:"type,omitempty" norman:"required,options=Normal|Warning,default=Warning"`
ResourceKind string `json:"resourceKind,omitempty" norman:"required,options=Pod|Node|Deployment|Statefulset|Daemonset"`
}
@ -89,7 +89,7 @@ type TargetWorkload struct {
WorkloadID string `json:"workloadId,omitempty"`
Type string `json:"type,omitempty" norman:"required,options=deployment|statefulset|daemonset,default=deployment"`
Selector map[string]string `json:"selector,omitempty"`
AvailablePercentage int `json:"availablePercentage,omitempty" norman:"required,min=1,max=100"`
AvailablePercentage int `json:"availablePercentage,omitempty" norman:"required,min=1,max=100,default=70"`
}
type TargetSystemService struct {
@ -97,7 +97,7 @@ type TargetSystemService struct {
}
type AlertStatus struct {
State string `json:"state,omitempty" norman:"required,options=active|inactive|alerting|muted,default=active"`
AlertState string `json:"alertState,omitempty" norman:"options=active|inactive|alerting|muted,default=active"`
}
type Notifier struct {

View File

@ -14,10 +14,12 @@ type Token struct {
ProviderInfo map[string]string `json:"providerInfo,omitempty"`
UserID string `json:"userId" norman:"type=reference[user]"`
AuthProvider string `json:"authProvider"`
TTLMillis int `json:"ttl"`
TTLMillis int64 `json:"ttl"`
LastUpdateTime string `json:"lastUpdateTime"`
IsDerived bool `json:"isDerived"`
Description string `json:"description"`
Expired bool `json:"expired"`
ExpiresAt string `json:"expiresAt"`
}
type User struct {

View File

@ -25,7 +25,9 @@ const (
ClusterConditionconditionDefautlProjectCreated condition.Cond = "DefaultProjectCreated"
// ClusterConditionDefaultNamespaceAssigned true when cluster's default namespace has been initially assigned
ClusterConditionDefaultNamespaceAssigned condition.Cond = "DefaultNamespaceAssigned"
// More conditions can be added if unredlying controllers request it
ClusterDriverImported = "imported"
ClusterDriverRKE = "rancherKubernetesEngine"
)
type Cluster struct {
@ -42,7 +44,6 @@ type Cluster struct {
}
type ClusterSpec struct {
NodePools []NodePool `json:"nodePools"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Internal bool `json:"internal" norman:"nocreate,noupdate"`
@ -207,8 +208,9 @@ type ClusterRegistrationTokenSpec struct {
}
type ClusterRegistrationTokenStatus struct {
Command string `json:"command"`
NodeCommand string `json:"nodeCommand"`
ManifestURL string `json:"manifestUrl"`
Token string `json:"token"`
InsecureCommand string `json:"insecureCommand"`
Command string `json:"command"`
NodeCommand string `json:"nodeCommand"`
ManifestURL string `json:"manifestUrl"`
Token string `json:"token"`
}

View File

@ -0,0 +1,58 @@
package v3
var (
K8sVersionToRKESystemImages = map[string]RKESystemImages{
"v1.8.7-rancher1-1": v187SystemImages,
}
RancherK8sVersionToSystemImages = map[string]RancherSystemImages{
"v1.9.3-rancher1-1": v193SystemImages,
}
// v187SystemImages defaults for rke and rancher 2.0
v187SystemImages = RKESystemImages{
Etcd: "rancher/coreos-etcd:v3.0.17",
Kubernetes: "rancher/k8s:v1.8.7-rancher1-1",
Alpine: "alpine:latest",
NginxProxy: "rancher/rke-nginx-proxy:v0.1.1",
CertDownloader: "rancher/rke-cert-deployer:v0.1.1",
KubernetesServicesSidecar: "rancher/rke-service-sidekick:v0.1.0",
KubeDNS: "rancher/k8s-dns-kube-dns-amd64:1.14.5",
DNSmasq: "rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.5",
KubeDNSSidecar: "rancher/k8s-dns-sidecar-amd64:1.14.5",
KubeDNSAutoscaler: "rancher/cluster-proportional-autoscaler-amd64:1.0.0",
Flannel: "rancher/coreos-flannel:v0.9.1",
FlannelCNI: "rancher/coreos-flannel-cni:v0.2.0",
CalicoNode: "rancher/calico-node:v3.0.2",
CalicoCNI: "rancher/calico-cni:v2.0.0",
CalicoCtl: "rancher/calico-ctl:v2.0.0",
CanalNode: "rancher/calico-node:v2.6.2",
CanalCNI: "rancher/calico-cni:v1.11.0",
CanalFlannel: "rancher/coreos-flannel:v0.9.1",
WeaveNode: "weaveworks/weave-kube:2.1.2",
WeaveCNI: "weaveworks/weave-npc:2.1.2",
PodInfraContainer: "rancher/pause-amd64:3.0",
Ingress: "rancher/nginx-ingress-controller:0.10.2",
IngressBackend: "rancher/nginx-ingress-controller-defaultbackend:1.4",
}
// v193SystemImages defaults for 1.6 with k8s v1.9
v193SystemImages = RancherSystemImages{
RKESystemImages: RKESystemImages{
Etcd: "rancher/etcd:v2.3.7-13",
Kubernetes: "rancher/k8s:v1.9.3-rancher1-1",
KubeDNS: "rancher/k8s-dns-kube-dns-amd64:1.14.7",
DNSmasq: "rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.7",
KubeDNSSidecar: "rancher/k8s-dns-sidecar-amd64:1.14.7",
Ingress: "rancher/lb-service-rancher:v0.7.17",
},
Kubectld: "rancher/kubectld:v0.8.6",
EtcHostUpdater: "rancher/etc-host-updater:v0.0.3",
K8sAgent: "rancher/kubernetes-agent:v0.6.6",
K8sAuth: "rancher/kubernetes-auth:v0.0.8",
Heapster: "rancher/heapster-grafana-amd64:v4.4.3",
Grafana: "rancher/heapster-amd64:v1.5.0",
Influxdb: "rancher/heapster-influxdb-amd64:v1.3.3",
Tiller: "rancher/tiller:v2.7.2",
}
)

View File

@ -77,6 +77,8 @@ type NodeStatus struct {
var (
NodeConditionInitialized condition.Cond = "Initialized"
NodeConditionProvisioned condition.Cond = "Provisioned"
NodeConditionRegistered condition.Cond = "Registered"
NodeConditionRemoved condition.Cond = "Removed"
NodeConditionConfigSaved condition.Cond = "Saved"
NodeConditionReady condition.Cond = "Ready"
)
@ -96,14 +98,39 @@ type NodeCondition struct {
Message string `json:"message,omitempty"`
}
type NodePool struct {
CommonNodeSpec
var (
NodePoolConditionUpdated condition.Cond = "Updated"
)
UUID string `json:"uuid" norman:"nocreate,noupdate"`
HostnamePrefix string `json:"hostnamePrefix" norman:"required"`
Quantity int `json:"quantity" norman:"required,default=1"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
type NodePool struct {
types.Namespaced
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"`
Spec NodePoolSpec `json:"spec"`
Status NodePoolStatus `json:"status"`
}
type NodePoolSpec struct {
Etcd bool `json:"etcd"`
ControlPlane bool `json:"controlPlane"`
Worker bool `json:"worker"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],required,notnullable"`
HostnamePrefix string `json:"hostnamePrefix" norman:"required,notnullable"`
Quantity int `json:"quantity" norman:"required,default=1"`
NodeLabels map[string]string `json:"nodeLabels"`
NodeAnnotations map[string]string `json:"nodeAnnotations"`
DisplayName string `json:"displayName"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
}
type NodePoolStatus struct {
Conditions []Condition `json:"conditions"`
}
type CustomConfig struct {
@ -119,16 +146,15 @@ type CustomConfig struct {
SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty"`
}
type CommonNodeSpec struct {
Etcd bool `json:"etcd"`
ControlPlane bool `json:"controlPlane"`
Worker bool `json:"worker"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate]"`
}
type NodeSpec struct {
CommonNodeSpec `json:",inline"`
NodePoolUUID string `json:"nodePoolUuid" norman:"nocreate,noupdate"`
// Common fields. They aren't in a shared struct because the annotations are different
Etcd bool `json:"etcd" norman:"noupdate"`
ControlPlane bool `json:"controlPlane" norman:"noupdate"`
Worker bool `json:"worker" norman:"noupdate"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],noupdate"`
NodePoolName string `json:"nodePoolName" norman:"type=reference[nodePool],nocreate,noupdate"`
CustomConfig *CustomConfig `json:"customConfig"`
Imported bool `json:"imported"`
Description string `json:"description,omitempty"`
@ -166,7 +192,7 @@ type NodeDriver struct {
}
type NodeDriverStatus struct {
Conditions []NodeDriverCondition `json:"conditions"`
Conditions []Condition `json:"conditions"`
}
var (
@ -175,7 +201,7 @@ var (
NodeDriverConditionInactive condition.Cond = "Inactive"
)
type NodeDriverCondition struct {
type Condition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.

View File

@ -78,7 +78,7 @@ type GithubClusterConfig struct {
}
type PipelineStatus struct {
State string `json:"state,omitempty" norman:"required,options=active|inactive,default=active"`
PipelineState string `json:"pipelineState,omitempty" norman:"required,options=active|inactive,default=active"`
NextRun int `json:"nextRun" yaml:"nextRun,omitempty" norman:"default=1,min=1"`
LastExecutionID string `json:"lastExecutionId,omitempty" yaml:"lastExecutionId,omitempty"`
LastRunState string `json:"lastRunState,omitempty" yaml:"lastRunState,omitempty"`
@ -144,11 +144,11 @@ type PipelineExecutionSpec struct {
}
type PipelineExecutionStatus struct {
Commit string `json:"commit,omitempty"`
State string `json:"state,omitempty"`
Started string `json:"started,omitempty"`
Ended string `json:"ended,omitempty"`
Stages []StageStatus `json:"stages,omitempty"`
Commit string `json:"commit,omitempty"`
ExecutionState string `json:"executionState,omitempty"`
Started string `json:"started,omitempty"`
Ended string `json:"ended,omitempty"`
Stages []StageStatus `json:"stages,omitempty"`
}
type StageStatus struct {

View File

@ -36,6 +36,29 @@ type PrivateRegistry struct {
Password string `yaml:"password" json:"password,omitempty"`
}
type RancherSystemImages struct {
// RKE system images
RKESystemImages `yaml:",inline" json:",inline"`
// Kubectld image
Kubectld string `yaml:"kubectld" json:"kubectld,omitempty"`
// Etc host updater image
EtcHostUpdater string `yaml:"etc_host_updater" json:"etcHostUpdater,omitempty"`
// Kubernetes agent image
K8sAgent string `yaml:"k8s_agent" json:"k8sAgent,omitempty"`
// Kubernetes auth service agent
K8sAuth string `yaml:"k8s_auth" json:"k8sAuth,omitempty"`
// Kubernetes Dashboard image
Dashboard string `yaml:"dashboard" json:"dashboard,omitempty"`
// Heapster addon image
Heapster string `yaml:"heapster" json:"heapster,omitempty"`
// Grafana image for heapster addon
Grafana string `yaml:"grafana" json:"grafana,omitempty"`
// Influxdb image for heapster addon
Influxdb string `yaml:"influxdb" json:"influxdb,omitempty"`
// Tiller addon image
Tiller string `yaml:"tiller" json:"tiller,omitempty"`
}
type RKESystemImages struct {
// etcd image
Etcd string `yaml:"etcd" json:"etcd,omitempty"`

View File

@ -188,9 +188,9 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
return nil
}, InType: reflect.TypeOf(&ClusterStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*CommonNodeSpec).DeepCopyInto(out.(*CommonNodeSpec))
in.(*Condition).DeepCopyInto(out.(*Condition))
return nil
}, InType: reflect.TypeOf(&CommonNodeSpec{})},
}, InType: reflect.TypeOf(&Condition{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*CustomConfig).DeepCopyInto(out.(*CustomConfig))
return nil
@ -367,10 +367,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*NodeDriver).DeepCopyInto(out.(*NodeDriver))
return nil
}, InType: reflect.TypeOf(&NodeDriver{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NodeDriverCondition).DeepCopyInto(out.(*NodeDriverCondition))
return nil
}, InType: reflect.TypeOf(&NodeDriverCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NodeDriverList).DeepCopyInto(out.(*NodeDriverList))
return nil
@ -391,6 +387,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*NodePool).DeepCopyInto(out.(*NodePool))
return nil
}, InType: reflect.TypeOf(&NodePool{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NodePoolList).DeepCopyInto(out.(*NodePoolList))
return nil
}, InType: reflect.TypeOf(&NodePoolList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NodePoolSpec).DeepCopyInto(out.(*NodePoolSpec))
return nil
}, InType: reflect.TypeOf(&NodePoolSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NodePoolStatus).DeepCopyInto(out.(*NodePoolStatus))
return nil
}, InType: reflect.TypeOf(&NodePoolStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NodeSpec).DeepCopyInto(out.(*NodeSpec))
return nil
@ -623,6 +631,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*RancherKubernetesEngineConfig).DeepCopyInto(out.(*RancherKubernetesEngineConfig))
return nil
}, InType: reflect.TypeOf(&RancherKubernetesEngineConfig{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*RancherSystemImages).DeepCopyInto(out.(*RancherSystemImages))
return nil
}, InType: reflect.TypeOf(&RancherSystemImages{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*Recipient).DeepCopyInto(out.(*Recipient))
return nil
@ -1826,13 +1838,6 @@ func (in *ClusterRoleTemplateBindingList) DeepCopyObject() runtime.Object {
// 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
if in.NodePools != nil {
in, out := &in.NodePools, &out.NodePools
*out = make([]NodePool, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.ImportedConfig != nil {
in, out := &in.ImportedConfig, &out.ImportedConfig
if *in == nil {
@ -1949,17 +1954,17 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CommonNodeSpec) DeepCopyInto(out *CommonNodeSpec) {
func (in *Condition) DeepCopyInto(out *Condition) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonNodeSpec.
func (in *CommonNodeSpec) DeepCopy() *CommonNodeSpec {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
func (in *Condition) DeepCopy() *Condition {
if in == nil {
return nil
}
out := new(CommonNodeSpec)
out := new(Condition)
in.DeepCopyInto(out)
return out
}
@ -3125,22 +3130,6 @@ func (in *NodeDriver) DeepCopyObject() runtime.Object {
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeDriverCondition) DeepCopyInto(out *NodeDriverCondition) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeDriverCondition.
func (in *NodeDriverCondition) DeepCopy() *NodeDriverCondition {
if in == nil {
return nil
}
out := new(NodeDriverCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeDriverList) DeepCopyInto(out *NodeDriverList) {
*out = *in
@ -3196,7 +3185,7 @@ func (in *NodeDriverStatus) DeepCopyInto(out *NodeDriverStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]NodeDriverCondition, len(*in))
*out = make([]Condition, len(*in))
copy(*out, *in)
}
return
@ -3249,21 +3238,11 @@ func (in *NodeList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodePool) DeepCopyInto(out *NodePool) {
*out = *in
out.CommonNodeSpec = in.CommonNodeSpec
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
@ -3277,10 +3256,103 @@ func (in *NodePool) DeepCopy() *NodePool {
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NodePool) 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 *NodePoolList) DeepCopyInto(out *NodePoolList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]NodePool, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolList.
func (in *NodePoolList) DeepCopy() *NodePoolList {
if in == nil {
return nil
}
out := new(NodePoolList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NodePoolList) 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 *NodePoolSpec) DeepCopyInto(out *NodePoolSpec) {
*out = *in
if in.NodeLabels != nil {
in, out := &in.NodeLabels, &out.NodeLabels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.NodeAnnotations != nil {
in, out := &in.NodeAnnotations, &out.NodeAnnotations
*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 NodePoolSpec.
func (in *NodePoolSpec) DeepCopy() *NodePoolSpec {
if in == nil {
return nil
}
out := new(NodePoolSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodePoolStatus) DeepCopyInto(out *NodePoolStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]Condition, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolStatus.
func (in *NodePoolStatus) DeepCopy() *NodePoolStatus {
if in == nil {
return nil
}
out := new(NodePoolStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeSpec) DeepCopyInto(out *NodeSpec) {
*out = *in
out.CommonNodeSpec = in.CommonNodeSpec
if in.CustomConfig != nil {
in, out := &in.CustomConfig, &out.CustomConfig
if *in == nil {
@ -4884,6 +4956,23 @@ func (in *RancherKubernetesEngineConfig) DeepCopy() *RancherKubernetesEngineConf
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RancherSystemImages) DeepCopyInto(out *RancherSystemImages) {
*out = *in
out.RKESystemImages = in.RKESystemImages
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RancherSystemImages.
func (in *RancherSystemImages) DeepCopy() *RancherSystemImages {
if in == nil {
return nil
}
out := new(RancherSystemImages)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Recipient) DeepCopyInto(out *Recipient) {
*out = *in

View File

@ -14,6 +14,7 @@ type Interface interface {
RESTClient() rest.Interface
controller.Starter
NodePoolsGetter
NodesGetter
NodeDriversGetter
NodeTemplatesGetter
@ -59,6 +60,7 @@ type Client struct {
restClient rest.Interface
starters []controller.Starter
nodePoolControllers map[string]NodePoolController
nodeControllers map[string]NodeController
nodeDriverControllers map[string]NodeDriverController
nodeTemplateControllers map[string]NodeTemplateController
@ -113,6 +115,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
return &Client{
restClient: restClient,
nodePoolControllers: map[string]NodePoolController{},
nodeControllers: map[string]NodeController{},
nodeDriverControllers: map[string]NodeDriverController{},
nodeTemplateControllers: map[string]NodeTemplateController{},
@ -166,6 +169,19 @@ func (c *Client) Start(ctx context.Context, threadiness int) error {
return controller.Start(ctx, threadiness, c.starters...)
}
type NodePoolsGetter interface {
NodePools(namespace string) NodePoolInterface
}
func (c *Client) NodePools(namespace string) NodePoolInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &NodePoolResource, NodePoolGroupVersionKind, nodePoolFactory{})
return &nodePoolClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type NodesGetter interface {
Nodes(namespace string) NodeInterface
}

View File

@ -0,0 +1,252 @@
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 (
NodePoolGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "NodePool",
}
NodePoolResource = metav1.APIResource{
Name: "nodepools",
SingularName: "nodepool",
Namespaced: true,
Kind: NodePoolGroupVersionKind.Kind,
}
)
type NodePoolList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NodePool
}
type NodePoolHandlerFunc func(key string, obj *NodePool) error
type NodePoolLister interface {
List(namespace string, selector labels.Selector) (ret []*NodePool, err error)
Get(namespace, name string) (*NodePool, error)
}
type NodePoolController interface {
Informer() cache.SharedIndexInformer
Lister() NodePoolLister
AddHandler(name string, handler NodePoolHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NodePoolHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type NodePoolInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*NodePool) (*NodePool, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*NodePool, error)
Get(name string, opts metav1.GetOptions) (*NodePool, error)
Update(*NodePool) (*NodePool, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*NodePoolList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() NodePoolController
AddHandler(name string, sync NodePoolHandlerFunc)
AddLifecycle(name string, lifecycle NodePoolLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NodePoolHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NodePoolLifecycle)
}
type nodePoolLister struct {
controller *nodePoolController
}
func (l *nodePoolLister) List(namespace string, selector labels.Selector) (ret []*NodePool, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*NodePool))
})
return
}
func (l *nodePoolLister) Get(namespace, name string) (*NodePool, error) {
var key string
if namespace != "" {
key = namespace + "/" + name
} else {
key = name
}
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: NodePoolGroupVersionKind.Group,
Resource: "nodePool",
}, name)
}
return obj.(*NodePool), nil
}
type nodePoolController struct {
controller.GenericController
}
func (c *nodePoolController) Lister() NodePoolLister {
return &nodePoolLister{
controller: c,
}
}
func (c *nodePoolController) AddHandler(name string, handler NodePoolHandlerFunc) {
c.GenericController.AddHandler(name, 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.(*NodePool))
})
}
func (c *nodePoolController) AddClusterScopedHandler(name, cluster string, handler NodePoolHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NodePool))
})
}
type nodePoolFactory struct {
}
func (c nodePoolFactory) Object() runtime.Object {
return &NodePool{}
}
func (c nodePoolFactory) List() runtime.Object {
return &NodePoolList{}
}
func (s *nodePoolClient) Controller() NodePoolController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.nodePoolControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(NodePoolGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &nodePoolController{
GenericController: genericController,
}
s.client.nodePoolControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type nodePoolClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller NodePoolController
}
func (s *nodePoolClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *nodePoolClient) Create(o *NodePool) (*NodePool, error) {
obj, err := s.objectClient.Create(o)
return obj.(*NodePool), err
}
func (s *nodePoolClient) Get(name string, opts metav1.GetOptions) (*NodePool, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*NodePool), err
}
func (s *nodePoolClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*NodePool, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*NodePool), err
}
func (s *nodePoolClient) Update(o *NodePool) (*NodePool, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*NodePool), err
}
func (s *nodePoolClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *nodePoolClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *nodePoolClient) List(opts metav1.ListOptions) (*NodePoolList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*NodePoolList), err
}
func (s *nodePoolClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *nodePoolClient) Patch(o *NodePool, data []byte, subresources ...string) (*NodePool, error) {
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
return obj.(*NodePool), err
}
func (s *nodePoolClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *nodePoolClient) AddHandler(name string, sync NodePoolHandlerFunc) {
s.Controller().AddHandler(name, sync)
}
func (s *nodePoolClient) AddLifecycle(name string, lifecycle NodePoolLifecycle) {
sync := NewNodePoolLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *nodePoolClient) AddClusterScopedHandler(name, clusterName string, sync NodePoolHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *nodePoolClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NodePoolLifecycle) {
sync := NewNodePoolLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@ -0,0 +1,51 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type NodePoolLifecycle interface {
Create(obj *NodePool) (*NodePool, error)
Remove(obj *NodePool) (*NodePool, error)
Updated(obj *NodePool) (*NodePool, error)
}
type nodePoolLifecycleAdapter struct {
lifecycle NodePoolLifecycle
}
func (w *nodePoolLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*NodePool))
if o == nil {
return nil, err
}
return o, err
}
func (w *nodePoolLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*NodePool))
if o == nil {
return nil, err
}
return o, err
}
func (w *nodePoolLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*NodePool))
if o == nil {
return nil, err
}
return o, err
}
func NewNodePoolLifecycleAdapter(name string, clusterScoped bool, client NodePoolInterface, l NodePoolLifecycle) NodePoolHandlerFunc {
adapter := &nodePoolLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NodePool) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@ -33,6 +33,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
// TODO this gets cleaned up when the types are fixed
scheme.AddKnownTypes(SchemeGroupVersion,
&NodePool{},
&NodePoolList{},
&Node{},
&NodeList{},
&NodeDriver{},