1
0
mirror of https://github.com/rancher/types.git synced 2025-06-28 14:36:50 +00:00

Merge pull request #14 from galal-hussein/rke_changes

Add network and auth config structure and json annotations
This commit is contained in:
Alena Prokharchyk 2017-11-14 09:42:37 -08:00 committed by GitHub
commit a71860ee9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 218 additions and 130 deletions

View File

@ -35,9 +35,9 @@ type Cluster struct {
}
type ClusterSpec struct {
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
RKEConfig *RKEConfig `json:"rkeConfig,omitempty"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
}
type ClusterStatus struct {
@ -105,94 +105,108 @@ type AzureKubernetesServiceConfig struct {
//TBD
}
type RKEConfig struct {
type RancherKubernetesEngineConfig struct {
// Kubernetes nodes
Hosts []RKEConfigHost `yaml:"hosts"`
Hosts []RKEConfigHost `yaml:"hosts" json:"hosts,omitempty"`
// Kubernetes components
Services RKEConfigServices `yaml:"services"`
// Network plugin used in the kubernetes cluster (flannel, calico)
NetworkPlugin string `yaml:"network_plugin"`
// Authentication type used in the cluster (default: x509)
AuthType string `yaml:"auth_type"`
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"`
}
type RKEConfigHost struct {
// SSH IP address of the host
IP string `yaml:"ip"`
IP string `yaml:"ip" json:"ip,omitempty"`
// Advertised address that will be used for components communication
AdvertiseAddress string `yaml:"advertise_address"`
AdvertiseAddress string `yaml:"advertise_address" json:"advertiseAddress,omitempty"`
// Host role in kubernetes cluster (controlplane, worker, or etcd)
Role []string `yaml:"role"`
Role []string `yaml:"role" json:"role,omitempty"`
// Hostname of the host
Hostname string `yaml:"hostname"`
AdvertisedHostname string `yaml:"advertised_hostname" json:"advertisedHostname,omitempty"`
// SSH usesr that will be used by RKE
User string `yaml:"user"`
User string `yaml:"user" json:"user,omitempty"`
// Docker socket on the host that will be used in tunneling
DockerSocket string `yaml:"docker_socket"`
DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"`
}
type RKEConfigServices struct {
// Etcd Service
Etcd ETCDService `yaml:"etcd"`
Etcd ETCDService `yaml:"etcd" json:"etcd,omitempty"`
// KubeAPI Service
KubeAPI KubeAPIService `yaml:"kube-api"`
KubeAPI KubeAPIService `yaml:"kube-api" json:"kube-api,omitempty"`
// KubeController Service
KubeController KubeControllerService `yaml:"kube-controller"`
KubeController KubeControllerService `yaml:"kube-controller" json:"kube-controller,omitempty"`
// Scheduler Service
Scheduler SchedulerService `yaml:"scheduler"`
Scheduler SchedulerService `yaml:"scheduler" json:"scheduler,omitempty"`
// Kubelet Service
Kubelet KubeletService `yaml:"kubelet"`
Kubelet KubeletService `yaml:"kubelet" json:"kubelet,omitempty"`
// KubeProxy Service
Kubeproxy KubeproxyService `yaml:"kubeproxy"`
Kubeproxy KubeproxyService `yaml:"kubeproxy" json:"kubeproxy,omitempty"`
}
type ETCDService struct {
// Base service properties
BaseService `yaml:",inline"`
BaseService `yaml:",inline" json:",inline"`
}
type KubeAPIService struct {
// Base service properties
BaseService `yaml:",inline"`
BaseService `yaml:",inline" json:",inline"`
// Virtual IP range that will be used by Kubernetes services
ServiceClusterIPRange string `yaml:"service_cluster_ip_range"`
ServiceClusterIPRange string `yaml:"service_cluster_ip_range" json:"serviceClusterIpRange,omitempty"`
}
type KubeControllerService struct {
// Base service properties
BaseService `yaml:",inline"`
BaseService `yaml:",inline" json:",inline"`
// CIDR Range for Pods in cluster
ClusterCIDR string `yaml:"cluster_cidr"`
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"`
ServiceClusterIPRange string `yaml:"service_cluster_ip_range" json:"serviceClusterIpRange,omitempty"`
}
type KubeletService struct {
// Base service properties
BaseService `yaml:",inline"`
BaseService `yaml:",inline" json:",inline"`
// Domain of the cluster (default: "cluster.local")
ClusterDomain string `yaml:"cluster_domain"`
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"`
InfraContainerImage string `yaml:"infra_container_image" json:"infraContainerImage,omitempty"`
// Cluster DNS service ip
ClusterDNSServer string `yaml:"cluster_dns_server"`
ClusterDNSServer string `yaml:"cluster_dns_server" json:"clusterDnsServer,omitempty"`
}
type KubeproxyService struct {
// Base service properties
BaseService `yaml:",inline"`
BaseService `yaml:",inline" json:",inline"`
}
type SchedulerService struct {
// Base service properties
BaseService `yaml:",inline"`
BaseService `yaml:",inline" json:",inline"`
}
type BaseService struct {
// Docker image of the service
Image string `yaml:"image"`
Image string `yaml:"image" json:"image,omitempty"`
// Extra arguments that are added to the services
ExtraArgs []string `yaml:"extra_args"`
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 {

View File

@ -5,6 +5,29 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AuthConfig) DeepCopyInto(out *AuthConfig) {
*out = *in
if in.Options != nil {
in, out := &in.Options, &out.Options
*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 AuthConfig.
func (in *AuthConfig) DeepCopy() *AuthConfig {
if in == nil {
return nil
}
out := new(AuthConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AzureKubernetesServiceConfig) DeepCopyInto(out *AzureKubernetesServiceConfig) {
*out = *in
@ -26,8 +49,10 @@ func (in *BaseService) DeepCopyInto(out *BaseService) {
*out = *in
if in.ExtraArgs != nil {
in, out := &in.ExtraArgs, &out.ExtraArgs
*out = make([]string, len(*in))
copy(*out, *in)
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
@ -231,12 +256,12 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
**out = **in
}
}
if in.RKEConfig != nil {
in, out := &in.RKEConfig, &out.RKEConfig
if in.RancherKubernetesEngineConfig != nil {
in, out := &in.RancherKubernetesEngineConfig, &out.RancherKubernetesEngineConfig
if *in == nil {
*out = nil
} else {
*out = new(RKEConfig)
*out = new(RancherKubernetesEngineConfig)
(*in).DeepCopyInto(*out)
}
}
@ -405,25 +430,24 @@ func (in *KubeproxyService) DeepCopy() *KubeproxyService {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RKEConfig) DeepCopyInto(out *RKEConfig) {
func (in *NetworkConfig) DeepCopyInto(out *NetworkConfig) {
*out = *in
if in.Hosts != nil {
in, out := &in.Hosts, &out.Hosts
*out = make([]RKEConfigHost, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
if in.Options != nil {
in, out := &in.Options, &out.Options
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
in.Services.DeepCopyInto(&out.Services)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RKEConfig.
func (in *RKEConfig) DeepCopy() *RKEConfig {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkConfig.
func (in *NetworkConfig) DeepCopy() *NetworkConfig {
if in == nil {
return nil
}
out := new(RKEConfig)
out := new(NetworkConfig)
in.DeepCopyInto(out)
return out
}
@ -471,6 +495,32 @@ func (in *RKEConfigServices) DeepCopy() *RKEConfigServices {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngineConfig) {
*out = *in
if in.Hosts != nil {
in, out := &in.Hosts, &out.Hosts
*out = make([]RKEConfigHost, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
in.Services.DeepCopyInto(&out.Services)
in.Network.DeepCopyInto(&out.Network)
in.Authentication.DeepCopyInto(&out.Authentication)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RancherKubernetesEngineConfig.
func (in *RancherKubernetesEngineConfig) DeepCopy() *RancherKubernetesEngineConfig {
if in == nil {
return nil
}
out := new(RancherKubernetesEngineConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SchedulerService) DeepCopyInto(out *SchedulerService) {
*out = *in

View File

@ -0,0 +1,12 @@
package client
const (
AuthConfigType = "authConfig"
AuthConfigFieldOptions = "options"
AuthConfigFieldStrategy = "strategy"
)
type AuthConfig struct {
Options map[string]string `json:"options,omitempty"`
Strategy string `json:"strategy,omitempty"`
}

View File

@ -5,35 +5,35 @@ import (
)
const (
ClusterType = "cluster"
ClusterFieldAPIVersion = "apiVersion"
ClusterFieldAnnotations = "annotations"
ClusterFieldAzureKubernetesServiceConfig = "azureKubernetesServiceConfig"
ClusterFieldCreated = "created"
ClusterFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig"
ClusterFieldKind = "kind"
ClusterFieldLabels = "labels"
ClusterFieldName = "name"
ClusterFieldNamespace = "namespace"
ClusterFieldRKEConfig = "rkeConfig"
ClusterFieldRemoved = "removed"
ClusterFieldUuid = "uuid"
ClusterType = "cluster"
ClusterFieldAPIVersion = "apiVersion"
ClusterFieldAnnotations = "annotations"
ClusterFieldAzureKubernetesServiceConfig = "azureKubernetesServiceConfig"
ClusterFieldCreated = "created"
ClusterFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig"
ClusterFieldKind = "kind"
ClusterFieldLabels = "labels"
ClusterFieldName = "name"
ClusterFieldNamespace = "namespace"
ClusterFieldRancherKubernetesEngineConfig = "rancherKubernetesEngineConfig"
ClusterFieldRemoved = "removed"
ClusterFieldUuid = "uuid"
)
type Cluster struct {
types.Resource
APIVersion string `json:"apiVersion,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
Created string `json:"created,omitempty"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
Kind string `json:"kind,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
RKEConfig *RKEConfig `json:"rkeConfig,omitempty"`
Removed string `json:"removed,omitempty"`
Uuid string `json:"uuid,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
Created string `json:"created,omitempty"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
Kind string `json:"kind,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
Removed string `json:"removed,omitempty"`
Uuid string `json:"uuid,omitempty"`
}
type ClusterCollection struct {
types.Collection

View File

@ -1,14 +1,14 @@
package client
const (
ClusterSpecType = "clusterSpec"
ClusterSpecFieldAzureKubernetesServiceConfig = "azureKubernetesServiceConfig"
ClusterSpecFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig"
ClusterSpecFieldRKEConfig = "rkeConfig"
ClusterSpecType = "clusterSpec"
ClusterSpecFieldAzureKubernetesServiceConfig = "azureKubernetesServiceConfig"
ClusterSpecFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig"
ClusterSpecFieldRancherKubernetesEngineConfig = "rancherKubernetesEngineConfig"
)
type ClusterSpec struct {
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
RKEConfig *RKEConfig `json:"rkeConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"`
RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"`
}

View File

@ -7,6 +7,6 @@ const (
)
type ETCDService struct {
ExtraArgs []string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
}

View File

@ -8,7 +8,7 @@ const (
)
type KubeAPIService struct {
ExtraArgs []string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ServiceClusterIPRange string `json:"serviceClusterIPRange,omitempty"`
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ServiceClusterIPRange string `json:"serviceClusterIPRange,omitempty"`
}

View File

@ -9,8 +9,8 @@ const (
)
type KubeControllerService struct {
ClusterCIDR string `json:"clusterCIDR,omitempty"`
ExtraArgs []string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ServiceClusterIPRange string `json:"serviceClusterIPRange,omitempty"`
ClusterCIDR string `json:"clusterCIDR,omitempty"`
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ServiceClusterIPRange string `json:"serviceClusterIPRange,omitempty"`
}

View File

@ -10,9 +10,9 @@ const (
)
type KubeletService struct {
ClusterDNSServer string `json:"clusterDNSServer,omitempty"`
ClusterDomain string `json:"clusterDomain,omitempty"`
ExtraArgs []string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
InfraContainerImage string `json:"infraContainerImage,omitempty"`
ClusterDNSServer string `json:"clusterDNSServer,omitempty"`
ClusterDomain string `json:"clusterDomain,omitempty"`
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
InfraContainerImage string `json:"infraContainerImage,omitempty"`
}

View File

@ -7,6 +7,6 @@ const (
)
type KubeproxyService struct {
ExtraArgs []string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
}

View File

@ -0,0 +1,12 @@
package client
const (
NetworkConfigType = "networkConfig"
NetworkConfigFieldOptions = "options"
NetworkConfigFieldPlugin = "plugin"
)
type NetworkConfig struct {
Options map[string]string `json:"options,omitempty"`
Plugin string `json:"plugin,omitempty"`
}

View File

@ -0,0 +1,16 @@
package client
const (
RancherKubernetesEngineConfigType = "rancherKubernetesEngineConfig"
RancherKubernetesEngineConfigFieldAuthentication = "authentication"
RancherKubernetesEngineConfigFieldHosts = "hosts"
RancherKubernetesEngineConfigFieldNetwork = "network"
RancherKubernetesEngineConfigFieldServices = "services"
)
type RancherKubernetesEngineConfig struct {
Authentication AuthConfig `json:"authentication,omitempty"`
Hosts []RKEConfigHost `json:"hosts,omitempty"`
Network NetworkConfig `json:"network,omitempty"`
Services RKEConfigServices `json:"services,omitempty"`
}

View File

@ -1,16 +0,0 @@
package client
const (
RKEConfigType = "rkeConfig"
RKEConfigFieldAuthType = "authType"
RKEConfigFieldHosts = "hosts"
RKEConfigFieldNetworkPlugin = "networkPlugin"
RKEConfigFieldServices = "services"
)
type RKEConfig struct {
AuthType string `json:"authType,omitempty"`
Hosts []RKEConfigHost `json:"hosts,omitempty"`
NetworkPlugin string `json:"networkPlugin,omitempty"`
Services RKEConfigServices `json:"services,omitempty"`
}

View File

@ -1,20 +1,20 @@
package client
const (
RKEConfigHostType = "rkeConfigHost"
RKEConfigHostFieldAdvertiseAddress = "advertiseAddress"
RKEConfigHostFieldDockerSocket = "dockerSocket"
RKEConfigHostFieldHostname = "hostname"
RKEConfigHostFieldIP = "ip"
RKEConfigHostFieldRole = "role"
RKEConfigHostFieldUser = "user"
RKEConfigHostType = "rkeConfigHost"
RKEConfigHostFieldAdvertiseAddress = "advertiseAddress"
RKEConfigHostFieldAdvertisedHostname = "advertisedHostname"
RKEConfigHostFieldDockerSocket = "dockerSocket"
RKEConfigHostFieldIP = "ip"
RKEConfigHostFieldRole = "role"
RKEConfigHostFieldUser = "user"
)
type RKEConfigHost struct {
AdvertiseAddress string `json:"advertiseAddress,omitempty"`
DockerSocket string `json:"dockerSocket,omitempty"`
Hostname string `json:"hostname,omitempty"`
IP string `json:"ip,omitempty"`
Role []string `json:"role,omitempty"`
User string `json:"user,omitempty"`
AdvertiseAddress string `json:"advertiseAddress,omitempty"`
AdvertisedHostname string `json:"advertisedHostname,omitempty"`
DockerSocket string `json:"dockerSocket,omitempty"`
IP string `json:"ip,omitempty"`
Role []string `json:"role,omitempty"`
User string `json:"user,omitempty"`
}

View File

@ -7,6 +7,6 @@ const (
)
type SchedulerService struct {
ExtraArgs []string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
ExtraArgs map[string]string `json:"extraArgs,omitempty"`
Image string `json:"image,omitempty"`
}