mirror of https://github.com/k3s-io/k3s
run copy.sh
parent
2f43d080da
commit
a6c5d3331c
|
@ -163,16 +163,16 @@ type RESTMapping struct {
|
|||
// TODO(caesarxuchao): Add proper multi-group support so that kinds & resources are
|
||||
// scoped to groups. See http://issues.k8s.io/12413 and http://issues.k8s.io/10009.
|
||||
type RESTMapper interface {
|
||||
// KindFor takes a partial resource and returns back the single match. Returns an error if there are multiple matches
|
||||
// KindFor takes a partial resource and returns the single match. Returns an error if there are multiple matches
|
||||
KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error)
|
||||
|
||||
// KindsFor takes a partial resource and returns back the list of potential kinds in priority order
|
||||
// KindsFor takes a partial resource and returns the list of potential kinds in priority order
|
||||
KindsFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionKind, error)
|
||||
|
||||
// ResourceFor takes a partial resource and returns back the single match. Returns an error if there are multiple matches
|
||||
// ResourceFor takes a partial resource and returns the single match. Returns an error if there are multiple matches
|
||||
ResourceFor(input unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error)
|
||||
|
||||
// ResourcesFor takes a partial resource and returns back the list of potential resource in priority order
|
||||
// ResourcesFor takes a partial resource and returns the list of potential resource in priority order
|
||||
ResourcesFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error)
|
||||
|
||||
// RESTMapping identifies a preferred resource mapping for the provided group kind.
|
||||
|
|
|
@ -189,7 +189,7 @@ func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, e
|
|||
}
|
||||
|
||||
if currSingular.Resource != singular.Resource {
|
||||
return resourceType, fmt.Errorf("multiple possibile singular resources (%v) found for %v", resources, resourceType)
|
||||
return resourceType, fmt.Errorf("multiple possible singular resources (%v) found for %v", resources, resourceType)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ const (
|
|||
|
||||
// TODO: to be de!eted after v1.3 is released. PodSpec has a dedicated Subdomain field.
|
||||
// The annotation value is a string specifying the subdomain e.g. "my-web-service"
|
||||
// If specified, on the the pod itself, "<hostname>.my-web-service.<namespace>.svc.<cluster domain>" would resolve to
|
||||
// If specified, on the pod itself, "<hostname>.my-web-service.<namespace>.svc.<cluster domain>" would resolve to
|
||||
// the pod's IP.
|
||||
// If there is a headless service named "my-web-service" in the same namespace as the pod, then,
|
||||
// <hostname>.my-web-service.<namespace>.svc.<cluster domain>" would be resolved by the cluster DNS Server.
|
||||
|
|
|
@ -45,12 +45,12 @@ var Unversioned = unversioned.GroupVersion{Group: "", Version: "v1"}
|
|||
// ParameterCodec handles versioning of objects that are converted to query parameters.
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
|
||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) unversioned.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) unversioned.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ var (
|
|||
|
||||
func init() {
|
||||
// TODO(lavalamp): move this call to scheme builder above. Can't
|
||||
// remove it from here because lots of people inapropriately rely on it
|
||||
// remove it from here because lots of people inappropriately rely on it
|
||||
// (specifically the unversioned time conversion). Can't have it in
|
||||
// both places because then it gets double registered. Consequence of
|
||||
// current state is that it only ever gets registered in the main
|
||||
|
|
|
@ -93,7 +93,7 @@ func GetPodReadyCondition(status PodStatus) *PodCondition {
|
|||
}
|
||||
|
||||
// GetPodCondition extracts the provided condition from the given status and returns that.
|
||||
// Returns nil and -1 if the condition is not present, and the the index of the located condition.
|
||||
// Returns nil and -1 if the condition is not present, and the index of the located condition.
|
||||
func GetPodCondition(status *PodStatus, conditionType PodConditionType) (int, *PodCondition) {
|
||||
if status == nil {
|
||||
return -1, nil
|
||||
|
@ -107,7 +107,7 @@ func GetPodCondition(status *PodStatus, conditionType PodConditionType) (int, *P
|
|||
}
|
||||
|
||||
// GetNodeCondition extracts the provided condition from the given status and returns that.
|
||||
// Returns nil and -1 if the condition is not present, and the the index of the located condition.
|
||||
// Returns nil and -1 if the condition is not present, and the index of the located condition.
|
||||
func GetNodeCondition(status *NodeStatus, conditionType NodeConditionType) (int, *NodeCondition) {
|
||||
if status == nil {
|
||||
return -1, nil
|
||||
|
|
|
@ -219,7 +219,7 @@ type VolumeSource struct {
|
|||
Quobyte *QuobyteVolumeSource `json:"quobyte,omitempty"`
|
||||
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.
|
||||
// provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.
|
||||
FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty"`
|
||||
|
||||
// Cinder represents a cinder volume attached and mounted on kubelets host machine
|
||||
|
@ -271,7 +271,7 @@ type PersistentVolumeSource struct {
|
|||
// kubelet's host machine and then exposed to the pod.
|
||||
ISCSI *ISCSIVolumeSource `json:"iscsi,omitempty"`
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.
|
||||
// provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.
|
||||
FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty"`
|
||||
// Cinder represents a cinder volume attached and mounted on kubelets host machine
|
||||
Cinder *CinderVolumeSource `json:"cinder,omitempty"`
|
||||
|
@ -530,7 +530,7 @@ type ISCSIVolumeSource struct {
|
|||
// Fibre Channel volumes can only be mounted as read/write once.
|
||||
// Fibre Channel volumes support ownership management and SELinux relabeling.
|
||||
type FCVolumeSource struct {
|
||||
// Required: FC target world wide names (WWNs)
|
||||
// Required: FC target worldwide names (WWNs)
|
||||
TargetWWNs []string `json:"targetWWNs"`
|
||||
// Required: FC target lun number
|
||||
Lun *int32 `json:"lun"`
|
||||
|
@ -545,7 +545,7 @@ type FCVolumeSource struct {
|
|||
}
|
||||
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.
|
||||
// provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.
|
||||
type FlexVolumeSource struct {
|
||||
// Driver is the name of the driver to use for this volume.
|
||||
Driver string `json:"driver"`
|
||||
|
@ -569,7 +569,7 @@ type FlexVolumeSource struct {
|
|||
// Represents a Persistent Disk resource in AWS.
|
||||
//
|
||||
// An AWS EBS disk must exist before mounting to a container. The disk
|
||||
// must also be in the same AWS zone as the kubelet. A AWS EBS disk
|
||||
// must also be in the same AWS zone as the kubelet. An AWS EBS disk
|
||||
// can only be mounted as read/write once. AWS EBS volumes support
|
||||
// ownership management and SELinux relabeling.
|
||||
type AWSElasticBlockStoreVolumeSource struct {
|
||||
|
|
|
@ -19,7 +19,7 @@ package unversioned
|
|||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = GroupVersion{Group: "", Version: ""}
|
||||
|
||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ message ExportOptions {
|
|||
// Fibre Channel volumes can only be mounted as read/write once.
|
||||
// Fibre Channel volumes support ownership management and SELinux relabeling.
|
||||
message FCVolumeSource {
|
||||
// Required: FC target world wide names (WWNs)
|
||||
// Required: FC target worldwide names (WWNs)
|
||||
repeated string targetWWNs = 1;
|
||||
|
||||
// Required: FC target lun number
|
||||
|
@ -814,7 +814,7 @@ message FCVolumeSource {
|
|||
}
|
||||
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.
|
||||
// provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.
|
||||
message FlexVolumeSource {
|
||||
// Driver is the name of the driver to use for this volume.
|
||||
optional string driver = 1;
|
||||
|
@ -1248,7 +1248,7 @@ message NodeAffinity {
|
|||
repeated PreferredSchedulingTerm preferredDuringSchedulingIgnoredDuringExecution = 2;
|
||||
}
|
||||
|
||||
// NodeCondition contains condition infromation for a node.
|
||||
// NodeCondition contains condition information for a node.
|
||||
message NodeCondition {
|
||||
// Type of node condition.
|
||||
optional string type = 1;
|
||||
|
@ -1766,7 +1766,7 @@ message PersistentVolumeSource {
|
|||
optional FlockerVolumeSource flocker = 11;
|
||||
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an
|
||||
// provisioned/attached using an exec based plugin. This is an
|
||||
// alpha feature and may change in future.
|
||||
optional FlexVolumeSource flexVolume = 12;
|
||||
|
||||
|
@ -1804,7 +1804,7 @@ message PersistentVolumeSpec {
|
|||
|
||||
// What happens to a persistent volume when released from its claim.
|
||||
// Valid options are Retain (default) and Recycle.
|
||||
// Recyling must be supported by the volume plugin underlying this persistent volume.
|
||||
// Recycling must be supported by the volume plugin underlying this persistent volume.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#recycling-policy
|
||||
optional string persistentVolumeReclaimPolicy = 5;
|
||||
}
|
||||
|
@ -3029,7 +3029,7 @@ message VolumeSource {
|
|||
optional RBDVolumeSource rbd = 11;
|
||||
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an
|
||||
// provisioned/attached using an exec based plugin. This is an
|
||||
// alpha feature and may change in future.
|
||||
optional FlexVolumeSource flexVolume = 12;
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ type VolumeSource struct {
|
|||
// More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md
|
||||
RBD *RBDVolumeSource `json:"rbd,omitempty" protobuf:"bytes,11,opt,name=rbd"`
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an
|
||||
// provisioned/attached using an exec based plugin. This is an
|
||||
// alpha feature and may change in future.
|
||||
FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty" protobuf:"bytes,12,opt,name=flexVolume"`
|
||||
// Cinder represents a cinder volume attached and mounted on kubelets host machine
|
||||
|
@ -337,7 +337,7 @@ type PersistentVolumeSource struct {
|
|||
// Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running
|
||||
Flocker *FlockerVolumeSource `json:"flocker,omitempty" protobuf:"bytes,11,opt,name=flocker"`
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an
|
||||
// provisioned/attached using an exec based plugin. This is an
|
||||
// alpha feature and may change in future.
|
||||
FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty" protobuf:"bytes,12,opt,name=flexVolume"`
|
||||
// AzureFile represents an Azure File Service mount on the host and bind mount to the pod.
|
||||
|
@ -391,7 +391,7 @@ type PersistentVolumeSpec struct {
|
|||
ClaimRef *ObjectReference `json:"claimRef,omitempty" protobuf:"bytes,4,opt,name=claimRef"`
|
||||
// What happens to a persistent volume when released from its claim.
|
||||
// Valid options are Retain (default) and Recycle.
|
||||
// Recyling must be supported by the volume plugin underlying this persistent volume.
|
||||
// Recycling must be supported by the volume plugin underlying this persistent volume.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#recycling-policy
|
||||
PersistentVolumeReclaimPolicy PersistentVolumeReclaimPolicy `json:"persistentVolumeReclaimPolicy,omitempty" protobuf:"bytes,5,opt,name=persistentVolumeReclaimPolicy,casttype=PersistentVolumeReclaimPolicy"`
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ type QuobyteVolumeSource struct {
|
|||
}
|
||||
|
||||
// FlexVolume represents a generic volume resource that is
|
||||
// provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.
|
||||
// provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.
|
||||
type FlexVolumeSource struct {
|
||||
// Driver is the name of the driver to use for this volume.
|
||||
Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"`
|
||||
|
@ -861,7 +861,7 @@ type ISCSIVolumeSource struct {
|
|||
// Fibre Channel volumes can only be mounted as read/write once.
|
||||
// Fibre Channel volumes support ownership management and SELinux relabeling.
|
||||
type FCVolumeSource struct {
|
||||
// Required: FC target world wide names (WWNs)
|
||||
// Required: FC target worldwide names (WWNs)
|
||||
TargetWWNs []string `json:"targetWWNs" protobuf:"bytes,1,rep,name=targetWWNs"`
|
||||
// Required: FC target lun number
|
||||
Lun *int32 `json:"lun" protobuf:"varint,2,opt,name=lun"`
|
||||
|
@ -2596,7 +2596,7 @@ const (
|
|||
NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable"
|
||||
)
|
||||
|
||||
// NodeCondition contains condition infromation for a node.
|
||||
// NodeCondition contains condition information for a node.
|
||||
type NodeCondition struct {
|
||||
// Type of node condition.
|
||||
Type NodeConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=NodeConditionType"`
|
||||
|
|
|
@ -505,7 +505,7 @@ func (ExportOptions) SwaggerDoc() map[string]string {
|
|||
|
||||
var map_FCVolumeSource = map[string]string{
|
||||
"": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
|
||||
"targetWWNs": "Required: FC target world wide names (WWNs)",
|
||||
"targetWWNs": "Required: FC target worldwide names (WWNs)",
|
||||
"lun": "Required: FC target lun number",
|
||||
"fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
|
||||
"readOnly": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
|
||||
|
@ -516,7 +516,7 @@ func (FCVolumeSource) SwaggerDoc() map[string]string {
|
|||
}
|
||||
|
||||
var map_FlexVolumeSource = map[string]string{
|
||||
"": "FlexVolume represents a generic volume resource that is provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.",
|
||||
"": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.",
|
||||
"driver": "Driver is the name of the driver to use for this volume.",
|
||||
"fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.",
|
||||
"secretRef": "Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.",
|
||||
|
@ -825,7 +825,7 @@ func (NodeAffinity) SwaggerDoc() map[string]string {
|
|||
}
|
||||
|
||||
var map_NodeCondition = map[string]string{
|
||||
"": "NodeCondition contains condition infromation for a node.",
|
||||
"": "NodeCondition contains condition information for a node.",
|
||||
"type": "Type of node condition.",
|
||||
"status": "Status of the condition, one of True, False, Unknown.",
|
||||
"lastHeartbeatTime": "Last time we got an update on a given condition.",
|
||||
|
@ -1092,7 +1092,7 @@ var map_PersistentVolumeSource = map[string]string{
|
|||
"cephfs": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime",
|
||||
"fc": "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.",
|
||||
"flocker": "Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running",
|
||||
"flexVolume": "FlexVolume represents a generic volume resource that is provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.",
|
||||
"flexVolume": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.",
|
||||
"azureFile": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.",
|
||||
"vsphereVolume": "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine",
|
||||
"quobyte": "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime",
|
||||
|
@ -1108,7 +1108,7 @@ var map_PersistentVolumeSpec = map[string]string{
|
|||
"capacity": "A description of the persistent volume's resources and capacity. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#capacity",
|
||||
"accessModes": "AccessModes contains all ways the volume can be mounted. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#access-modes",
|
||||
"claimRef": "ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#binding",
|
||||
"persistentVolumeReclaimPolicy": "What happens to a persistent volume when released from its claim. Valid options are Retain (default) and Recycle. Recyling must be supported by the volume plugin underlying this persistent volume. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#recycling-policy",
|
||||
"persistentVolumeReclaimPolicy": "What happens to a persistent volume when released from its claim. Valid options are Retain (default) and Recycle. Recycling must be supported by the volume plugin underlying this persistent volume. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#recycling-policy",
|
||||
}
|
||||
|
||||
func (PersistentVolumeSpec) SwaggerDoc() map[string]string {
|
||||
|
@ -1771,7 +1771,7 @@ var map_VolumeSource = map[string]string{
|
|||
"glusterfs": "Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md",
|
||||
"persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#persistentvolumeclaims",
|
||||
"rbd": "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md",
|
||||
"flexVolume": "FlexVolume represents a generic volume resource that is provisioned/attached using a exec based plugin. This is an alpha feature and may change in future.",
|
||||
"flexVolume": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.",
|
||||
"cinder": "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md",
|
||||
"cephfs": "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime",
|
||||
"flocker": "Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running",
|
||||
|
|
|
@ -365,7 +365,7 @@ func ValidateObjectMeta(meta *api.ObjectMeta, requiresNamespace bool, nameFn Val
|
|||
}
|
||||
// If the generated name validates, but the calculated value does not, it's a problem with generation, and we
|
||||
// report it here. This may confuse users, but indicates a programming bug and still must be validated.
|
||||
// If there are multiple fields out of which one is required then add a or as a separator
|
||||
// If there are multiple fields out of which one is required then add an or as a separator
|
||||
if len(meta.Name) == 0 {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("name"), "name or generateName is required"))
|
||||
} else {
|
||||
|
@ -624,7 +624,7 @@ func validateVolumeSource(source *api.VolumeSource, fldPath *field.Path) field.E
|
|||
}
|
||||
if source.FlexVolume != nil {
|
||||
if numVolumes > 0 {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("flexVolume"), "may not specifiy more than 1 volume type"))
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("flexVolume"), "may not specify more than 1 volume type"))
|
||||
} else {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateFlexVolumeSource(source.FlexVolume, fldPath.Child("flexVolume"))...)
|
||||
|
@ -632,7 +632,7 @@ func validateVolumeSource(source *api.VolumeSource, fldPath *field.Path) field.E
|
|||
}
|
||||
if source.ConfigMap != nil {
|
||||
if numVolumes > 0 {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("configMap"), "may not specifiy more than 1 volume type"))
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("configMap"), "may not specify more than 1 volume type"))
|
||||
} else {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateConfigMapVolumeSource(source.ConfigMap, fldPath.Child("configMap"))...)
|
||||
|
@ -812,11 +812,11 @@ func validateNFSVolumeSource(nfs *api.NFSVolumeSource, fldPath *field.Path) fiel
|
|||
func validateQuobyteVolumeSource(quobyte *api.QuobyteVolumeSource, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if len(quobyte.Registry) == 0 {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("registry"), "must be a host:port pair or multiple pairs seperated by commas"))
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("registry"), "must be a host:port pair or multiple pairs separated by commas"))
|
||||
} else {
|
||||
for _, hostPortPair := range strings.Split(quobyte.Registry, ",") {
|
||||
if _, _, err := net.SplitHostPort(hostPortPair); err != nil {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("registry"), quobyte.Registry, "must be a host:port pair or multiple pairs seperated by commas"))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("registry"), quobyte.Registry, "must be a host:port pair or multiple pairs separated by commas"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ var (
|
|||
knownFeatures = map[string]featureSpec{
|
||||
allAlphaGate: {false, alpha},
|
||||
externalTrafficLocalOnly: {false, alpha},
|
||||
appArmor: {true, alpha},
|
||||
appArmor: {true, beta},
|
||||
dynamicKubeletConfig: {false, alpha},
|
||||
dynamicVolumeProvisioning: {true, alpha},
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ type FeatureGate interface {
|
|||
// MyFeature() bool
|
||||
|
||||
// owner: @timstclair
|
||||
// alpha: v1.4
|
||||
// beta: v1.4
|
||||
AppArmor() bool
|
||||
|
||||
// owner: @girishkalele
|
||||
|
|
|
@ -329,7 +329,7 @@ func (config *DirectClientConfig) getCluster() clientcmdapi.Cluster {
|
|||
clusterInfoName := config.getClusterName()
|
||||
|
||||
var mergedClusterInfo clientcmdapi.Cluster
|
||||
mergo.Merge(&mergedClusterInfo, DefaultCluster)
|
||||
mergo.Merge(&mergedClusterInfo, config.overrides.ClusterDefaults)
|
||||
mergo.Merge(&mergedClusterInfo, EnvVarCluster)
|
||||
if configClusterInfo, exists := clusterInfos[clusterInfoName]; exists {
|
||||
mergo.Merge(&mergedClusterInfo, configClusterInfo)
|
||||
|
|
|
@ -304,11 +304,13 @@ func TestCreateCleanWithPrefix(t *testing.T) {
|
|||
cleanConfig.Server = tc.server
|
||||
config.Clusters["clean"] = cleanConfig
|
||||
|
||||
clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil)
|
||||
clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{
|
||||
ClusterDefaults: DefaultCluster,
|
||||
}, nil)
|
||||
|
||||
clientConfig, err := clientBuilder.ClientConfig()
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
matchStringArg(tc.host, clientConfig.Host, t)
|
||||
|
@ -321,7 +323,7 @@ func TestCreateCleanDefault(t *testing.T) {
|
|||
|
||||
clientConfig, err := clientBuilder.ClientConfig()
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t)
|
||||
|
@ -329,14 +331,42 @@ func TestCreateCleanDefault(t *testing.T) {
|
|||
matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t)
|
||||
}
|
||||
|
||||
func TestCreateMissingContext(t *testing.T) {
|
||||
func TestCreateCleanDefaultCluster(t *testing.T) {
|
||||
config := createValidTestConfig()
|
||||
clientBuilder := NewDefaultClientConfig(*config, &ConfigOverrides{
|
||||
ClusterDefaults: DefaultCluster,
|
||||
})
|
||||
|
||||
clientConfig, err := clientBuilder.ClientConfig()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t)
|
||||
matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t)
|
||||
matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t)
|
||||
}
|
||||
|
||||
func TestCreateMissingContextNoDefault(t *testing.T) {
|
||||
const expectedErrorContains = "Context was not found for specified context"
|
||||
config := createValidTestConfig()
|
||||
clientBuilder := NewNonInteractiveClientConfig(*config, "not-present", &ConfigOverrides{}, nil)
|
||||
|
||||
_, err := clientBuilder.ClientConfig()
|
||||
if err == nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
func TestCreateMissingContext(t *testing.T) {
|
||||
const expectedErrorContains = "Context was not found for specified context"
|
||||
config := createValidTestConfig()
|
||||
clientBuilder := NewNonInteractiveClientConfig(*config, "not-present", &ConfigOverrides{
|
||||
ClusterDefaults: DefaultCluster,
|
||||
}, nil)
|
||||
|
||||
clientConfig, err := clientBuilder.ClientConfig()
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
expectedConfig := &rest.Config{Host: clientConfig.Host}
|
||||
|
@ -344,7 +374,6 @@ func TestCreateMissingContext(t *testing.T) {
|
|||
if !reflect.DeepEqual(expectedConfig, clientConfig) {
|
||||
t.Errorf("Expected %#v, got %#v", expectedConfig, clientConfig)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func matchBoolArg(expected, got bool, t *testing.T) {
|
||||
|
|
|
@ -27,10 +27,12 @@ import (
|
|||
// ConfigOverrides holds values that should override whatever information is pulled from the actual Config object. You can't
|
||||
// simply use an actual Config object, because Configs hold maps, but overrides are restricted to "at most one"
|
||||
type ConfigOverrides struct {
|
||||
AuthInfo clientcmdapi.AuthInfo
|
||||
ClusterInfo clientcmdapi.Cluster
|
||||
Context clientcmdapi.Context
|
||||
CurrentContext string
|
||||
AuthInfo clientcmdapi.AuthInfo
|
||||
// ClusterDefaults are applied before the configured cluster info is loaded.
|
||||
ClusterDefaults clientcmdapi.Cluster
|
||||
ClusterInfo clientcmdapi.Cluster
|
||||
Context clientcmdapi.Context
|
||||
CurrentContext string
|
||||
}
|
||||
|
||||
// ConfigOverrideFlags holds the flag names to be used for binding command line flags. Notice that this structure tightly
|
||||
|
|
Loading…
Reference in New Issue