Add Attributes to models.Zone and add functions to parse (#215)
from/to operator.Zone to/from models.Zone Tenant Add, GetTenantInfo and AddZone now can parse operator.Zone extra attributes
This commit is contained in:
272
models/node_selector_term.go
Normal file
272
models/node_selector_term.go
Normal file
@@ -0,0 +1,272 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2020 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NodeSelectorTerm A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.
|
||||
//
|
||||
// swagger:model nodeSelectorTerm
|
||||
type NodeSelectorTerm struct {
|
||||
|
||||
// A list of node selector requirements by node's labels.
|
||||
MatchExpressions []*NodeSelectorTermMatchExpressionsItems0 `json:"matchExpressions"`
|
||||
|
||||
// A list of node selector requirements by node's fields.
|
||||
MatchFields []*NodeSelectorTermMatchFieldsItems0 `json:"matchFields"`
|
||||
}
|
||||
|
||||
// Validate validates this node selector term
|
||||
func (m *NodeSelectorTerm) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMatchExpressions(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMatchFields(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NodeSelectorTerm) validateMatchExpressions(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.MatchExpressions) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.MatchExpressions); i++ {
|
||||
if swag.IsZero(m.MatchExpressions[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.MatchExpressions[i] != nil {
|
||||
if err := m.MatchExpressions[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchExpressions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NodeSelectorTerm) validateMatchFields(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.MatchFields) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.MatchFields); i++ {
|
||||
if swag.IsZero(m.MatchFields[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.MatchFields[i] != nil {
|
||||
if err := m.MatchFields[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchFields" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *NodeSelectorTerm) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *NodeSelectorTerm) UnmarshalBinary(b []byte) error {
|
||||
var res NodeSelectorTerm
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// NodeSelectorTermMatchExpressionsItems0 A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
|
||||
//
|
||||
// swagger:model NodeSelectorTermMatchExpressionsItems0
|
||||
type NodeSelectorTermMatchExpressionsItems0 struct {
|
||||
|
||||
// The label key that the selector applies to.
|
||||
// Required: true
|
||||
Key *string `json:"key"`
|
||||
|
||||
// Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
|
||||
// Required: true
|
||||
Operator *string `json:"operator"`
|
||||
|
||||
// An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
|
||||
Values []string `json:"values"`
|
||||
}
|
||||
|
||||
// Validate validates this node selector term match expressions items0
|
||||
func (m *NodeSelectorTermMatchExpressionsItems0) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateOperator(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NodeSelectorTermMatchExpressionsItems0) validateKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("key", "body", m.Key); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NodeSelectorTermMatchExpressionsItems0) validateOperator(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("operator", "body", m.Operator); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *NodeSelectorTermMatchExpressionsItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *NodeSelectorTermMatchExpressionsItems0) UnmarshalBinary(b []byte) error {
|
||||
var res NodeSelectorTermMatchExpressionsItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// NodeSelectorTermMatchFieldsItems0 A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
|
||||
//
|
||||
// swagger:model NodeSelectorTermMatchFieldsItems0
|
||||
type NodeSelectorTermMatchFieldsItems0 struct {
|
||||
|
||||
// The label key that the selector applies to.
|
||||
// Required: true
|
||||
Key *string `json:"key"`
|
||||
|
||||
// Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
|
||||
// Required: true
|
||||
Operator *string `json:"operator"`
|
||||
|
||||
// An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
|
||||
Values []string `json:"values"`
|
||||
}
|
||||
|
||||
// Validate validates this node selector term match fields items0
|
||||
func (m *NodeSelectorTermMatchFieldsItems0) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateOperator(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NodeSelectorTermMatchFieldsItems0) validateKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("key", "body", m.Key); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NodeSelectorTermMatchFieldsItems0) validateOperator(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("operator", "body", m.Operator); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *NodeSelectorTermMatchFieldsItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *NodeSelectorTermMatchFieldsItems0) UnmarshalBinary(b []byte) error {
|
||||
var res NodeSelectorTermMatchFieldsItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
251
models/pod_affinity_term.go
Normal file
251
models/pod_affinity_term.go
Normal file
@@ -0,0 +1,251 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2020 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// PodAffinityTerm Required. A pod affinity term, associated with the corresponding weight.
|
||||
//
|
||||
// swagger:model podAffinityTerm
|
||||
type PodAffinityTerm struct {
|
||||
|
||||
// label selector
|
||||
LabelSelector *PodAffinityTermLabelSelector `json:"labelSelector,omitempty"`
|
||||
|
||||
// namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace"
|
||||
Namespaces []string `json:"namespaces"`
|
||||
|
||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.
|
||||
// Required: true
|
||||
TopologyKey *string `json:"topologyKey"`
|
||||
}
|
||||
|
||||
// Validate validates this pod affinity term
|
||||
func (m *PodAffinityTerm) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateLabelSelector(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateTopologyKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodAffinityTerm) validateLabelSelector(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.LabelSelector) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.LabelSelector != nil {
|
||||
if err := m.LabelSelector.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labelSelector")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodAffinityTerm) validateTopologyKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("topologyKey", "body", m.TopologyKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PodAffinityTerm) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PodAffinityTerm) UnmarshalBinary(b []byte) error {
|
||||
var res PodAffinityTerm
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// PodAffinityTermLabelSelector A label query over a set of resources, in this case pods.
|
||||
//
|
||||
// swagger:model PodAffinityTermLabelSelector
|
||||
type PodAffinityTermLabelSelector struct {
|
||||
|
||||
// matchExpressions is a list of label selector requirements. The requirements are ANDed.
|
||||
MatchExpressions []*PodAffinityTermLabelSelectorMatchExpressionsItems0 `json:"matchExpressions"`
|
||||
|
||||
// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
|
||||
MatchLabels map[string]string `json:"matchLabels,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this pod affinity term label selector
|
||||
func (m *PodAffinityTermLabelSelector) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMatchExpressions(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodAffinityTermLabelSelector) validateMatchExpressions(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.MatchExpressions) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.MatchExpressions); i++ {
|
||||
if swag.IsZero(m.MatchExpressions[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.MatchExpressions[i] != nil {
|
||||
if err := m.MatchExpressions[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PodAffinityTermLabelSelector) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PodAffinityTermLabelSelector) UnmarshalBinary(b []byte) error {
|
||||
var res PodAffinityTermLabelSelector
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// PodAffinityTermLabelSelectorMatchExpressionsItems0 A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
|
||||
//
|
||||
// swagger:model PodAffinityTermLabelSelectorMatchExpressionsItems0
|
||||
type PodAffinityTermLabelSelectorMatchExpressionsItems0 struct {
|
||||
|
||||
// key is the label key that the selector applies to.
|
||||
// Required: true
|
||||
Key *string `json:"key"`
|
||||
|
||||
// operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
|
||||
// Required: true
|
||||
Operator *string `json:"operator"`
|
||||
|
||||
// values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
|
||||
Values []string `json:"values"`
|
||||
}
|
||||
|
||||
// Validate validates this pod affinity term label selector match expressions items0
|
||||
func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateOperator(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) validateKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("key", "body", m.Key); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) validateOperator(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("operator", "body", m.Operator); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) UnmarshalBinary(b []byte) error {
|
||||
var res PodAffinityTermLabelSelectorMatchExpressionsItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -34,13 +34,25 @@ import (
|
||||
// swagger:model zone
|
||||
type Zone struct {
|
||||
|
||||
// affinity
|
||||
Affinity *ZoneAffinity `json:"affinity,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
|
||||
NodeSelector map[string]string `json:"node_selector,omitempty"`
|
||||
|
||||
// resources
|
||||
Resources *ZoneResources `json:"resources,omitempty"`
|
||||
|
||||
// servers
|
||||
// Required: true
|
||||
Servers *int64 `json:"servers"`
|
||||
|
||||
// tolerations
|
||||
Tolerations ZoneTolerations `json:"tolerations,omitempty"`
|
||||
|
||||
// volume configuration
|
||||
// Required: true
|
||||
VolumeConfiguration *ZoneVolumeConfiguration `json:"volume_configuration"`
|
||||
@@ -54,10 +66,22 @@ type Zone struct {
|
||||
func (m *Zone) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAffinity(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateResources(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateServers(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateTolerations(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateVolumeConfiguration(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -72,6 +96,42 @@ func (m *Zone) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateAffinity(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Affinity) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Affinity != nil {
|
||||
if err := m.Affinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("affinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateResources(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Resources) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Resources != nil {
|
||||
if err := m.Resources.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("resources")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateServers(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("servers", "body", m.Servers); err != nil {
|
||||
@@ -81,6 +141,22 @@ func (m *Zone) validateServers(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateTolerations(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Tolerations) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Tolerations.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tolerations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Zone) validateVolumeConfiguration(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("volume_configuration", "body", m.VolumeConfiguration); err != nil {
|
||||
|
||||
726
models/zone_affinity.go
Normal file
726
models/zone_affinity.go
Normal file
@@ -0,0 +1,726 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2020 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// ZoneAffinity If specified, affinity will define the pod's scheduling constraints
|
||||
//
|
||||
// swagger:model zoneAffinity
|
||||
type ZoneAffinity struct {
|
||||
|
||||
// node affinity
|
||||
NodeAffinity *ZoneAffinityNodeAffinity `json:"nodeAffinity,omitempty"`
|
||||
|
||||
// pod affinity
|
||||
PodAffinity *ZoneAffinityPodAffinity `json:"podAffinity,omitempty"`
|
||||
|
||||
// pod anti affinity
|
||||
PodAntiAffinity *ZoneAffinityPodAntiAffinity `json:"podAntiAffinity,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity
|
||||
func (m *ZoneAffinity) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateNodeAffinity(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePodAffinity(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePodAntiAffinity(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinity) validateNodeAffinity(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.NodeAffinity) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.NodeAffinity != nil {
|
||||
if err := m.NodeAffinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinity) validatePodAffinity(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PodAffinity) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.PodAffinity != nil {
|
||||
if err := m.PodAffinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinity) validatePodAntiAffinity(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PodAntiAffinity) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.PodAntiAffinity != nil {
|
||||
if err := m.PodAntiAffinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinity) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinity) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinity
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityNodeAffinity Describes node affinity scheduling rules for the pod.
|
||||
//
|
||||
// swagger:model ZoneAffinityNodeAffinity
|
||||
type ZoneAffinityNodeAffinity struct {
|
||||
|
||||
// The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.
|
||||
PreferredDuringSchedulingIgnoredDuringExecution []*ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 `json:"preferredDuringSchedulingIgnoredDuringExecution"`
|
||||
|
||||
// required during scheduling ignored during execution
|
||||
RequiredDuringSchedulingIgnoredDuringExecution *ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity node affinity
|
||||
func (m *ZoneAffinityNodeAffinity) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePreferredDuringSchedulingIgnoredDuringExecution(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequiredDuringSchedulingIgnoredDuringExecution(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityNodeAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ {
|
||||
if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil {
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityNodeAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.RequiredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityNodeAffinity) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityNodeAffinity) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityNodeAffinity
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).
|
||||
//
|
||||
// swagger:model ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0
|
||||
type ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 struct {
|
||||
|
||||
// A node selector term, associated with the corresponding weight.
|
||||
// Required: true
|
||||
Preference *NodeSelectorTerm `json:"preference"`
|
||||
|
||||
// Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
|
||||
// Required: true
|
||||
Weight *int32 `json:"weight"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity node affinity preferred during scheduling ignored during execution items0
|
||||
func (m *ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePreference(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateWeight(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validatePreference(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("preference", "body", m.Preference); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Preference != nil {
|
||||
if err := m.Preference.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("preference")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validateWeight(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("weight", "body", m.Weight); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.
|
||||
//
|
||||
// swagger:model ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution
|
||||
type ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution struct {
|
||||
|
||||
// Required. A list of node selector terms. The terms are ORed.
|
||||
// Required: true
|
||||
NodeSelectorTerms []*NodeSelectorTerm `json:"nodeSelectorTerms"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity node affinity required during scheduling ignored during execution
|
||||
func (m *ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateNodeSelectorTerms(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) validateNodeSelectorTerms(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("nodeAffinity"+"."+"requiredDuringSchedulingIgnoredDuringExecution"+"."+"nodeSelectorTerms", "body", m.NodeSelectorTerms); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.NodeSelectorTerms); i++ {
|
||||
if swag.IsZero(m.NodeSelectorTerms[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.NodeSelectorTerms[i] != nil {
|
||||
if err := m.NodeSelectorTerms[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityPodAffinity Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).
|
||||
//
|
||||
// swagger:model ZoneAffinityPodAffinity
|
||||
type ZoneAffinityPodAffinity struct {
|
||||
|
||||
// The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.
|
||||
PreferredDuringSchedulingIgnoredDuringExecution []*ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 `json:"preferredDuringSchedulingIgnoredDuringExecution"`
|
||||
|
||||
// If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.
|
||||
RequiredDuringSchedulingIgnoredDuringExecution []*PodAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity pod affinity
|
||||
func (m *ZoneAffinityPodAffinity) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePreferredDuringSchedulingIgnoredDuringExecution(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequiredDuringSchedulingIgnoredDuringExecution(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ {
|
||||
if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil {
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ {
|
||||
if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil {
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAffinity) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAffinity) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityPodAffinity
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)
|
||||
//
|
||||
// swagger:model ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0
|
||||
type ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 struct {
|
||||
|
||||
// pod affinity term
|
||||
// Required: true
|
||||
PodAffinityTerm *PodAffinityTerm `json:"podAffinityTerm"`
|
||||
|
||||
// weight associated with matching the corresponding podAffinityTerm, in the range 1-100.
|
||||
// Required: true
|
||||
Weight *int32 `json:"weight"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity pod affinity preferred during scheduling ignored during execution items0
|
||||
func (m *ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePodAffinityTerm(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateWeight(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validatePodAffinityTerm(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("podAffinityTerm", "body", m.PodAffinityTerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.PodAffinityTerm != nil {
|
||||
if err := m.PodAffinityTerm.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinityTerm")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validateWeight(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("weight", "body", m.Weight); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityPodAntiAffinity Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).
|
||||
//
|
||||
// swagger:model ZoneAffinityPodAntiAffinity
|
||||
type ZoneAffinityPodAntiAffinity struct {
|
||||
|
||||
// The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.
|
||||
PreferredDuringSchedulingIgnoredDuringExecution []*ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 `json:"preferredDuringSchedulingIgnoredDuringExecution"`
|
||||
|
||||
// If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.
|
||||
RequiredDuringSchedulingIgnoredDuringExecution []*PodAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity pod anti affinity
|
||||
func (m *ZoneAffinityPodAntiAffinity) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePreferredDuringSchedulingIgnoredDuringExecution(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequiredDuringSchedulingIgnoredDuringExecution(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAntiAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ {
|
||||
if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil {
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAntiAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ {
|
||||
if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil {
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAntiAffinity) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAntiAffinity) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityPodAntiAffinity
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)
|
||||
//
|
||||
// swagger:model ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0
|
||||
type ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0 struct {
|
||||
|
||||
// pod affinity term
|
||||
// Required: true
|
||||
PodAffinityTerm *PodAffinityTerm `json:"podAffinityTerm"`
|
||||
|
||||
// weight associated with matching the corresponding podAffinityTerm, in the range 1-100.
|
||||
// Required: true
|
||||
Weight *int32 `json:"weight"`
|
||||
}
|
||||
|
||||
// Validate validates this zone affinity pod anti affinity preferred during scheduling ignored during execution items0
|
||||
func (m *ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePodAffinityTerm(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateWeight(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validatePodAffinityTerm(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("podAffinityTerm", "body", m.PodAffinityTerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.PodAffinityTerm != nil {
|
||||
if err := m.PodAffinityTerm.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinityTerm")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) validateWeight(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("weight", "body", m.Weight); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
63
models/zone_resources.go
Normal file
63
models/zone_resources.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2020 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// ZoneResources If provided, use these requests and limit for cpu/memory resource allocation
|
||||
//
|
||||
// swagger:model zoneResources
|
||||
type ZoneResources struct {
|
||||
|
||||
// Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
|
||||
Limits map[string]int64 `json:"limits,omitempty"`
|
||||
|
||||
// Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
|
||||
Requests map[string]int64 `json:"requests,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this zone resources
|
||||
func (m *ZoneResources) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneResources) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneResources) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneResources
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
106
models/zone_tolerations.go
Normal file
106
models/zone_tolerations.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2020 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// ZoneTolerations Tolerations allows users to set entries like effect, key, operator, value.
|
||||
//
|
||||
// swagger:model zoneTolerations
|
||||
type ZoneTolerations []*ZoneTolerationsItems0
|
||||
|
||||
// Validate validates this zone tolerations
|
||||
func (m ZoneTolerations) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ZoneTolerationsItems0 The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>.
|
||||
//
|
||||
// swagger:model ZoneTolerationsItems0
|
||||
type ZoneTolerationsItems0 struct {
|
||||
|
||||
// Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
|
||||
Effect string `json:"effect,omitempty"`
|
||||
|
||||
// Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.
|
||||
Key string `json:"key,omitempty"`
|
||||
|
||||
// Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
|
||||
Operator string `json:"operator,omitempty"`
|
||||
|
||||
// TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.
|
||||
TolerationSeconds int64 `json:"tolerationSeconds,omitempty"`
|
||||
|
||||
// Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this zone tolerations items0
|
||||
func (m *ZoneTolerationsItems0) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ZoneTolerationsItems0) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ZoneTolerationsItems0) UnmarshalBinary(b []byte) error {
|
||||
var res ZoneTolerationsItems0
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -108,7 +108,7 @@ func registerTenantHandlers(api *operations.ConsoleAPI) {
|
||||
err := getTenantAddZoneResponse(session, params)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return admin_api.NewTenantAddZoneDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String("Unable to update tenant")})
|
||||
return admin_api.NewTenantAddZoneDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String("Unable to add zone")})
|
||||
}
|
||||
return admin_api.NewTenantAddZoneCreated()
|
||||
})
|
||||
@@ -199,21 +199,7 @@ func getTenantInfo(tenant *operator.Tenant) *models.Tenant {
|
||||
|
||||
var totalSize int64
|
||||
for _, z := range tenant.Spec.Zones {
|
||||
zoneModel := &models.Zone{
|
||||
Name: z.Name,
|
||||
Servers: swag.Int64(int64(z.Servers)),
|
||||
VolumesPerServer: swag.Int32(z.VolumesPerServer),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{},
|
||||
}
|
||||
|
||||
if z.VolumeClaimTemplate != nil {
|
||||
zoneModel.VolumeConfiguration.Size = swag.Int64(z.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value())
|
||||
if z.VolumeClaimTemplate.Spec.StorageClassName != nil {
|
||||
zoneModel.VolumeConfiguration.StorageClassName = *z.VolumeClaimTemplate.Spec.StorageClassName
|
||||
}
|
||||
}
|
||||
|
||||
zones = append(zones, zoneModel)
|
||||
zones = append(zones, parseTenantZone(&z))
|
||||
zoneSize := int64(z.Servers) * int64(z.VolumesPerServer) * z.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value()
|
||||
totalSize = totalSize + zoneSize
|
||||
}
|
||||
@@ -268,11 +254,9 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
|
||||
}
|
||||
|
||||
var tenants []*models.TenantList
|
||||
|
||||
var totalSize int64
|
||||
|
||||
for _, minInst := range minTenants.Items {
|
||||
|
||||
var instanceCount int64
|
||||
var volumeCount int64
|
||||
for _, zone := range minInst.Spec.Zones {
|
||||
@@ -390,12 +374,6 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
enableConsole = *params.Body.EnableConsole
|
||||
}
|
||||
|
||||
// TODO: Calculate this ourselves?
|
||||
memorySize, err := resource.ParseQuantity(getTenantMemorySize())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//Construct a MinIO Instance with everything we are getting from parameters
|
||||
minInst := operator.Tenant{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@@ -414,7 +392,6 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
|
||||
if enableConsole {
|
||||
consoleSelector := fmt.Sprintf("%s-console", *params.Body.Name)
|
||||
|
||||
consoleSecretName := fmt.Sprintf("%s-secret", consoleSelector)
|
||||
imm := true
|
||||
instanceSecret := corev1.Secret{
|
||||
@@ -448,39 +425,12 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create
|
||||
minInst.Spec.ServiceName = params.Body.ServiceName
|
||||
}
|
||||
// set the zones if they are provided
|
||||
if len(params.Body.Zones) > 0 {
|
||||
for _, zone := range params.Body.Zones {
|
||||
volumeSize := resource.NewQuantity(*zone.VolumeConfiguration.Size, resource.DecimalExponent)
|
||||
volTemp := corev1.PersistentVolumeClaimSpec{
|
||||
AccessModes: []corev1.PersistentVolumeAccessMode{
|
||||
corev1.ReadWriteOnce,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceStorage: *volumeSize,
|
||||
},
|
||||
},
|
||||
}
|
||||
if zone.VolumeConfiguration.StorageClassName != "" {
|
||||
volTemp.StorageClassName = &zone.VolumeConfiguration.StorageClassName
|
||||
}
|
||||
minInst.Spec.Zones = append(minInst.Spec.Zones, operator.Zone{
|
||||
Name: zone.Name,
|
||||
Servers: int32(*zone.Servers),
|
||||
VolumesPerServer: *zone.VolumesPerServer,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "data",
|
||||
},
|
||||
Spec: volTemp,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceMemory: memorySize,
|
||||
},
|
||||
},
|
||||
})
|
||||
for _, zone := range params.Body.Zones {
|
||||
zone, err := parseTenantZoneRequest(zone)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
minInst.Spec.Zones = append(minInst.Spec.Zones, *zone)
|
||||
}
|
||||
|
||||
// Set Mount Path if provided
|
||||
@@ -574,72 +524,23 @@ func getUpdateTenantResponse(session *models.Principal, params admin_api.UpdateT
|
||||
|
||||
// addTenantZone creates a zone to a defined tenant
|
||||
func addTenantZone(ctx context.Context, operatorClient OperatorClient, params admin_api.TenantAddZoneParams) error {
|
||||
minInst, err := operatorClient.TenantGet(ctx, params.Namespace, params.Tenant, metav1.GetOptions{})
|
||||
tenant, err := operatorClient.TenantGet(ctx, params.Namespace, params.Tenant, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
zoneParams := params.Body
|
||||
if zoneParams.VolumeConfiguration == nil {
|
||||
return errors.New("a volume configuration must be specified")
|
||||
zone, err := parseTenantZoneRequest(zoneParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if zoneParams.VolumeConfiguration.Size == nil || *zoneParams.VolumeConfiguration.Size <= int64(0) {
|
||||
return errors.New("volume size must be greater than 0")
|
||||
}
|
||||
|
||||
if zoneParams.Servers == nil || *zoneParams.Servers <= 0 {
|
||||
return errors.New("number of servers must be greater than 0")
|
||||
}
|
||||
|
||||
if zoneParams.VolumesPerServer == nil || *zoneParams.VolumesPerServer <= 0 {
|
||||
return errors.New("number of volumes per server must be greater than 0")
|
||||
}
|
||||
|
||||
volumeSize := resource.NewQuantity(*zoneParams.VolumeConfiguration.Size, resource.DecimalExponent)
|
||||
volTemp := corev1.PersistentVolumeClaimSpec{
|
||||
AccessModes: []corev1.PersistentVolumeAccessMode{
|
||||
corev1.ReadWriteOnce,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceStorage: *volumeSize,
|
||||
},
|
||||
},
|
||||
}
|
||||
if zoneParams.VolumeConfiguration.StorageClassName != "" {
|
||||
volTemp.StorageClassName = &zoneParams.VolumeConfiguration.StorageClassName
|
||||
}
|
||||
|
||||
// TODO: Calculate this ourselves?
|
||||
memorySize, err := resource.ParseQuantity(getTenantMemorySize())
|
||||
tenant.Spec.Zones = append(tenant.Spec.Zones, *zone)
|
||||
payloadBytes, err := json.Marshal(tenant)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
minInst.Spec.Zones = append(minInst.Spec.Zones, operator.Zone{
|
||||
Name: zoneParams.Name,
|
||||
Servers: int32(*zoneParams.Servers),
|
||||
VolumesPerServer: *zoneParams.VolumesPerServer,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "data",
|
||||
},
|
||||
Spec: volTemp,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceMemory: memorySize,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
payloadBytes, err := json.Marshal(minInst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = operatorClient.TenantPatch(ctx, params.Namespace, minInst.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{})
|
||||
_, err = operatorClient.TenantPatch(ctx, params.Namespace, tenant.Name, types.MergePatchType, payloadBytes, metav1.PatchOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -724,3 +625,399 @@ func getTenantUsageResponse(session *models.Principal, params admin_api.GetTenan
|
||||
info := &models.TenantUsage{UsedSize: adminInfo.Usage}
|
||||
return info, nil
|
||||
}
|
||||
|
||||
// parseTenantZoneRequest parse zone request and returns the equivalent
|
||||
// operator.Zone object
|
||||
func parseTenantZoneRequest(zoneParams *models.Zone) (*operator.Zone, error) {
|
||||
if zoneParams.VolumeConfiguration == nil {
|
||||
return nil, errors.New("a volume configuration must be specified")
|
||||
}
|
||||
|
||||
if zoneParams.VolumeConfiguration.Size == nil || *zoneParams.VolumeConfiguration.Size <= int64(0) {
|
||||
return nil, errors.New("volume size must be greater than 0")
|
||||
}
|
||||
|
||||
if zoneParams.Servers == nil || *zoneParams.Servers <= 0 {
|
||||
return nil, errors.New("number of servers must be greater than 0")
|
||||
}
|
||||
|
||||
if zoneParams.VolumesPerServer == nil || *zoneParams.VolumesPerServer <= 0 {
|
||||
return nil, errors.New("number of volumes per server must be greater than 0")
|
||||
}
|
||||
|
||||
volumeSize := resource.NewQuantity(*zoneParams.VolumeConfiguration.Size, resource.DecimalExponent)
|
||||
volTemp := corev1.PersistentVolumeClaimSpec{
|
||||
AccessModes: []corev1.PersistentVolumeAccessMode{
|
||||
corev1.ReadWriteOnce,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceStorage: *volumeSize,
|
||||
},
|
||||
},
|
||||
}
|
||||
if zoneParams.VolumeConfiguration.StorageClassName != "" {
|
||||
volTemp.StorageClassName = &zoneParams.VolumeConfiguration.StorageClassName
|
||||
}
|
||||
|
||||
// parse resources' requests
|
||||
var resourcesRequests corev1.ResourceList
|
||||
var resourcesLimits corev1.ResourceList
|
||||
if zoneParams.Resources != nil {
|
||||
for key, val := range zoneParams.Resources.Requests {
|
||||
resourcesRequests[corev1.ResourceName(key)] = *resource.NewQuantity(val, resource.BinarySI)
|
||||
}
|
||||
for key, val := range zoneParams.Resources.Limits {
|
||||
resourcesLimits[corev1.ResourceName(key)] = *resource.NewQuantity(val, resource.BinarySI)
|
||||
}
|
||||
}
|
||||
|
||||
// parse Node Affinity
|
||||
nodeSelectorTerms := []corev1.NodeSelectorTerm{}
|
||||
preferredSchedulingTerm := []corev1.PreferredSchedulingTerm{}
|
||||
if zoneParams.Affinity != nil && zoneParams.Affinity.NodeAffinity != nil {
|
||||
if zoneParams.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
for _, elem := range zoneParams.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms {
|
||||
term := parseModelsNodeSelectorTerm(elem)
|
||||
nodeSelectorTerms = append(nodeSelectorTerms, term)
|
||||
}
|
||||
}
|
||||
for _, elem := range zoneParams.Affinity.NodeAffinity.PreferredDuringSchedulingIgnoredDuringExecution {
|
||||
pst := corev1.PreferredSchedulingTerm{
|
||||
Weight: *elem.Weight,
|
||||
Preference: parseModelsNodeSelectorTerm(elem.Preference),
|
||||
}
|
||||
preferredSchedulingTerm = append(preferredSchedulingTerm, pst)
|
||||
}
|
||||
}
|
||||
var nodeAffinity *corev1.NodeAffinity
|
||||
if len(nodeSelectorTerms) > 0 || len(preferredSchedulingTerm) > 0 {
|
||||
nodeAffinity = &corev1.NodeAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{
|
||||
NodeSelectorTerms: nodeSelectorTerms,
|
||||
},
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: preferredSchedulingTerm,
|
||||
}
|
||||
}
|
||||
|
||||
// parse Pod Affinity
|
||||
podAffinityTerms := []corev1.PodAffinityTerm{}
|
||||
weightedPodAffinityTerms := []corev1.WeightedPodAffinityTerm{}
|
||||
if zoneParams.Affinity != nil && zoneParams.Affinity.PodAffinity != nil {
|
||||
for _, elem := range zoneParams.Affinity.PodAffinity.RequiredDuringSchedulingIgnoredDuringExecution {
|
||||
podAffinityTerms = append(podAffinityTerms, parseModelPodAffinityTerm(elem))
|
||||
}
|
||||
for _, elem := range zoneParams.Affinity.PodAffinity.PreferredDuringSchedulingIgnoredDuringExecution {
|
||||
wAffinityTerm := corev1.WeightedPodAffinityTerm{
|
||||
Weight: *elem.Weight,
|
||||
PodAffinityTerm: parseModelPodAffinityTerm(elem.PodAffinityTerm),
|
||||
}
|
||||
weightedPodAffinityTerms = append(weightedPodAffinityTerms, wAffinityTerm)
|
||||
}
|
||||
}
|
||||
var podAffinity *corev1.PodAffinity
|
||||
if len(podAffinityTerms) > 0 || len(weightedPodAffinityTerms) > 0 {
|
||||
podAffinity = &corev1.PodAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: podAffinityTerms,
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAffinityTerms,
|
||||
}
|
||||
}
|
||||
|
||||
// parse Pod Anti Affinity
|
||||
podAntiAffinityTerms := []corev1.PodAffinityTerm{}
|
||||
weightedPodAntiAffinityTerms := []corev1.WeightedPodAffinityTerm{}
|
||||
if zoneParams.Affinity != nil && zoneParams.Affinity.PodAntiAffinity != nil {
|
||||
for _, elem := range zoneParams.Affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution {
|
||||
podAntiAffinityTerms = append(podAntiAffinityTerms, parseModelPodAffinityTerm(elem))
|
||||
}
|
||||
for _, elem := range zoneParams.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution {
|
||||
wAffinityTerm := corev1.WeightedPodAffinityTerm{
|
||||
Weight: *elem.Weight,
|
||||
PodAffinityTerm: parseModelPodAffinityTerm(elem.PodAffinityTerm),
|
||||
}
|
||||
weightedPodAntiAffinityTerms = append(weightedPodAntiAffinityTerms, wAffinityTerm)
|
||||
}
|
||||
}
|
||||
var podAntiAffinity *corev1.PodAntiAffinity
|
||||
if len(podAntiAffinityTerms) > 0 || len(weightedPodAntiAffinityTerms) > 0 {
|
||||
podAntiAffinity = &corev1.PodAntiAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: podAntiAffinityTerms,
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAntiAffinityTerms,
|
||||
}
|
||||
}
|
||||
|
||||
var affinity *corev1.Affinity
|
||||
if nodeAffinity != nil || podAffinity != nil || podAntiAffinity != nil {
|
||||
affinity = &corev1.Affinity{
|
||||
NodeAffinity: nodeAffinity,
|
||||
PodAffinity: podAffinity,
|
||||
PodAntiAffinity: podAntiAffinity,
|
||||
}
|
||||
}
|
||||
|
||||
// parse tolerations
|
||||
tolerations := []corev1.Toleration{}
|
||||
for _, elem := range zoneParams.Tolerations {
|
||||
toleration := corev1.Toleration{
|
||||
Key: elem.Key,
|
||||
Operator: corev1.TolerationOperator(elem.Operator),
|
||||
Value: elem.Value,
|
||||
Effect: corev1.TaintEffect(elem.Effect),
|
||||
TolerationSeconds: &elem.TolerationSeconds,
|
||||
}
|
||||
tolerations = append(tolerations, toleration)
|
||||
}
|
||||
|
||||
zone := &operator.Zone{
|
||||
Name: zoneParams.Name,
|
||||
Servers: int32(*zoneParams.Servers),
|
||||
VolumesPerServer: *zoneParams.VolumesPerServer,
|
||||
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "data",
|
||||
},
|
||||
Spec: volTemp,
|
||||
},
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: resourcesRequests,
|
||||
Limits: resourcesLimits,
|
||||
},
|
||||
NodeSelector: zoneParams.NodeSelector,
|
||||
Affinity: affinity,
|
||||
Tolerations: tolerations,
|
||||
}
|
||||
return zone, nil
|
||||
}
|
||||
|
||||
func parseModelPodAffinityTerm(term *models.PodAffinityTerm) corev1.PodAffinityTerm {
|
||||
labelMatchExpressions := []metav1.LabelSelectorRequirement{}
|
||||
for _, exp := range term.LabelSelector.MatchExpressions {
|
||||
labelSelectorReq := metav1.LabelSelectorRequirement{
|
||||
Key: *exp.Key,
|
||||
Operator: metav1.LabelSelectorOperator(*exp.Operator),
|
||||
Values: exp.Values,
|
||||
}
|
||||
labelMatchExpressions = append(labelMatchExpressions, labelSelectorReq)
|
||||
}
|
||||
|
||||
podAffinityTerm := corev1.PodAffinityTerm{
|
||||
LabelSelector: &metav1.LabelSelector{
|
||||
MatchExpressions: labelMatchExpressions,
|
||||
MatchLabels: term.LabelSelector.MatchLabels,
|
||||
},
|
||||
Namespaces: term.Namespaces,
|
||||
TopologyKey: *term.TopologyKey,
|
||||
}
|
||||
return podAffinityTerm
|
||||
}
|
||||
|
||||
func parseModelsNodeSelectorTerm(elem *models.NodeSelectorTerm) corev1.NodeSelectorTerm {
|
||||
var term corev1.NodeSelectorTerm
|
||||
for _, matchExpression := range elem.MatchExpressions {
|
||||
matchExp := corev1.NodeSelectorRequirement{
|
||||
Key: *matchExpression.Key,
|
||||
Operator: corev1.NodeSelectorOperator(*matchExpression.Operator),
|
||||
Values: matchExpression.Values,
|
||||
}
|
||||
term.MatchExpressions = append(term.MatchExpressions, matchExp)
|
||||
}
|
||||
for _, matchField := range elem.MatchFields {
|
||||
matchF := corev1.NodeSelectorRequirement{
|
||||
Key: *matchField.Key,
|
||||
Operator: corev1.NodeSelectorOperator(*matchField.Operator),
|
||||
Values: matchField.Values,
|
||||
}
|
||||
term.MatchFields = append(term.MatchFields, matchF)
|
||||
}
|
||||
return term
|
||||
}
|
||||
|
||||
// parseTenantZone operator Zone object and returns the equivalent
|
||||
// models.Zone object
|
||||
func parseTenantZone(zone *operator.Zone) *models.Zone {
|
||||
var size *int64
|
||||
var storageClassName string
|
||||
if zone.VolumeClaimTemplate != nil {
|
||||
size = swag.Int64(zone.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value())
|
||||
if zone.VolumeClaimTemplate.Spec.StorageClassName != nil {
|
||||
storageClassName = *zone.VolumeClaimTemplate.Spec.StorageClassName
|
||||
}
|
||||
}
|
||||
|
||||
// parse resources' requests
|
||||
var resources *models.ZoneResources
|
||||
var resourcesRequests map[string]int64
|
||||
var resourcesLimits map[string]int64
|
||||
for key, val := range zone.Resources.Requests {
|
||||
resourcesRequests[key.String()] = val.Value()
|
||||
}
|
||||
for key, val := range zone.Resources.Limits {
|
||||
resourcesLimits[key.String()] = val.Value()
|
||||
}
|
||||
if len(resourcesRequests) > 0 || len(resourcesLimits) > 0 {
|
||||
resources = &models.ZoneResources{
|
||||
Limits: resourcesLimits,
|
||||
Requests: resourcesRequests,
|
||||
}
|
||||
}
|
||||
|
||||
// parse Node Affinity
|
||||
nodeSelectorTerms := []*models.NodeSelectorTerm{}
|
||||
preferredSchedulingTerm := []*models.ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{}
|
||||
|
||||
if zone.Affinity != nil && zone.Affinity.NodeAffinity != nil {
|
||||
if zone.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
for _, elem := range zone.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms {
|
||||
term := parseNodeSelectorTerm(&elem)
|
||||
nodeSelectorTerms = append(nodeSelectorTerms, term)
|
||||
}
|
||||
}
|
||||
for _, elem := range zone.Affinity.NodeAffinity.PreferredDuringSchedulingIgnoredDuringExecution {
|
||||
pst := &models.ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{
|
||||
Weight: swag.Int32(elem.Weight),
|
||||
Preference: parseNodeSelectorTerm(&elem.Preference),
|
||||
}
|
||||
preferredSchedulingTerm = append(preferredSchedulingTerm, pst)
|
||||
}
|
||||
}
|
||||
|
||||
var nodeAffinity *models.ZoneAffinityNodeAffinity
|
||||
if len(nodeSelectorTerms) > 0 || len(preferredSchedulingTerm) > 0 {
|
||||
nodeAffinity = &models.ZoneAffinityNodeAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: &models.ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution{
|
||||
NodeSelectorTerms: nodeSelectorTerms,
|
||||
},
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: preferredSchedulingTerm,
|
||||
}
|
||||
}
|
||||
|
||||
// parse Pod Affinity
|
||||
podAffinityTerms := []*models.PodAffinityTerm{}
|
||||
weightedPodAffinityTerms := []*models.ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{}
|
||||
|
||||
if zone.Affinity != nil && zone.Affinity.PodAffinity != nil {
|
||||
for _, elem := range zone.Affinity.PodAffinity.RequiredDuringSchedulingIgnoredDuringExecution {
|
||||
podAffinityTerms = append(podAffinityTerms, parsePodAffinityTerm(&elem))
|
||||
}
|
||||
for _, elem := range zone.Affinity.PodAffinity.PreferredDuringSchedulingIgnoredDuringExecution {
|
||||
wAffinityTerm := &models.ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{
|
||||
Weight: swag.Int32(elem.Weight),
|
||||
PodAffinityTerm: parsePodAffinityTerm(&elem.PodAffinityTerm),
|
||||
}
|
||||
weightedPodAffinityTerms = append(weightedPodAffinityTerms, wAffinityTerm)
|
||||
}
|
||||
}
|
||||
var podAffinity *models.ZoneAffinityPodAffinity
|
||||
if len(podAffinityTerms) > 0 || len(weightedPodAffinityTerms) > 0 {
|
||||
podAffinity = &models.ZoneAffinityPodAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: podAffinityTerms,
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAffinityTerms,
|
||||
}
|
||||
}
|
||||
|
||||
// parse Pod Anti Affinity
|
||||
podAntiAffinityTerms := []*models.PodAffinityTerm{}
|
||||
weightedPodAntiAffinityTerms := []*models.ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{}
|
||||
|
||||
if zone.Affinity != nil && zone.Affinity.PodAntiAffinity != nil {
|
||||
for _, elem := range zone.Affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution {
|
||||
podAntiAffinityTerms = append(podAntiAffinityTerms, parsePodAffinityTerm(&elem))
|
||||
}
|
||||
for _, elem := range zone.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution {
|
||||
wAffinityTerm := &models.ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0{
|
||||
Weight: swag.Int32(elem.Weight),
|
||||
PodAffinityTerm: parsePodAffinityTerm(&elem.PodAffinityTerm),
|
||||
}
|
||||
weightedPodAntiAffinityTerms = append(weightedPodAntiAffinityTerms, wAffinityTerm)
|
||||
}
|
||||
}
|
||||
|
||||
var podAntiAffinity *models.ZoneAffinityPodAntiAffinity
|
||||
if len(podAntiAffinityTerms) > 0 || len(weightedPodAntiAffinityTerms) > 0 {
|
||||
podAntiAffinity = &models.ZoneAffinityPodAntiAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: podAntiAffinityTerms,
|
||||
PreferredDuringSchedulingIgnoredDuringExecution: weightedPodAntiAffinityTerms,
|
||||
}
|
||||
}
|
||||
|
||||
// build affinity object
|
||||
var affinity *models.ZoneAffinity
|
||||
if nodeAffinity != nil || podAffinity != nil || podAntiAffinity != nil {
|
||||
affinity = &models.ZoneAffinity{
|
||||
NodeAffinity: nodeAffinity,
|
||||
PodAffinity: podAffinity,
|
||||
PodAntiAffinity: podAntiAffinity,
|
||||
}
|
||||
}
|
||||
|
||||
// parse tolerations
|
||||
var tolerations models.ZoneTolerations
|
||||
for _, elem := range zone.Tolerations {
|
||||
toleration := &models.ZoneTolerationsItems0{
|
||||
Key: elem.Key,
|
||||
Operator: string(elem.Operator),
|
||||
Value: elem.Value,
|
||||
Effect: string(elem.Effect),
|
||||
TolerationSeconds: *elem.TolerationSeconds,
|
||||
}
|
||||
tolerations = append(tolerations, toleration)
|
||||
}
|
||||
|
||||
zoneModel := &models.Zone{
|
||||
Name: zone.Name,
|
||||
Servers: swag.Int64(int64(zone.Servers)),
|
||||
VolumesPerServer: swag.Int32(zone.VolumesPerServer),
|
||||
VolumeConfiguration: &models.ZoneVolumeConfiguration{
|
||||
Size: size,
|
||||
StorageClassName: storageClassName,
|
||||
},
|
||||
NodeSelector: zone.NodeSelector,
|
||||
Resources: resources,
|
||||
Affinity: affinity,
|
||||
Tolerations: tolerations,
|
||||
}
|
||||
return zoneModel
|
||||
}
|
||||
|
||||
func parsePodAffinityTerm(term *corev1.PodAffinityTerm) *models.PodAffinityTerm {
|
||||
labelMatchExpressions := []*models.PodAffinityTermLabelSelectorMatchExpressionsItems0{}
|
||||
for _, exp := range term.LabelSelector.MatchExpressions {
|
||||
labelSelectorReq := &models.PodAffinityTermLabelSelectorMatchExpressionsItems0{
|
||||
Key: swag.String(exp.Key),
|
||||
Operator: swag.String(string(exp.Operator)),
|
||||
Values: exp.Values,
|
||||
}
|
||||
labelMatchExpressions = append(labelMatchExpressions, labelSelectorReq)
|
||||
}
|
||||
|
||||
podAffinityTerm := &models.PodAffinityTerm{
|
||||
LabelSelector: &models.PodAffinityTermLabelSelector{
|
||||
MatchExpressions: labelMatchExpressions,
|
||||
MatchLabels: term.LabelSelector.MatchLabels,
|
||||
},
|
||||
Namespaces: term.Namespaces,
|
||||
TopologyKey: swag.String(term.TopologyKey),
|
||||
}
|
||||
return podAffinityTerm
|
||||
}
|
||||
|
||||
func parseNodeSelectorTerm(term *corev1.NodeSelectorTerm) *models.NodeSelectorTerm {
|
||||
var t models.NodeSelectorTerm
|
||||
for _, matchExpression := range term.MatchExpressions {
|
||||
matchExp := &models.NodeSelectorTermMatchExpressionsItems0{
|
||||
Key: swag.String(matchExpression.Key),
|
||||
Operator: swag.String(string(matchExpression.Operator)),
|
||||
Values: matchExpression.Values,
|
||||
}
|
||||
t.MatchExpressions = append(t.MatchExpressions, matchExp)
|
||||
}
|
||||
for _, matchField := range term.MatchFields {
|
||||
matchF := &models.NodeSelectorTermMatchFieldsItems0{
|
||||
Key: swag.String(matchField.Key),
|
||||
Operator: swag.String(string(matchField.Operator)),
|
||||
Values: matchField.Values,
|
||||
}
|
||||
t.MatchFields = append(t.MatchFields, matchF)
|
||||
}
|
||||
return &t
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ var TLSPort = "9443"
|
||||
// TLSRedirect console tls redirect rule
|
||||
var TLSRedirect = "off"
|
||||
|
||||
// defaultTenantMemorySize default value used
|
||||
// when generating minioTenant request
|
||||
var defaultTenantMemorySize = "16Gi"
|
||||
|
||||
func getAccessKey() string {
|
||||
return env.Get(ConsoleAccessKey, "minioadmin")
|
||||
}
|
||||
@@ -232,9 +228,3 @@ func getSecureFeaturePolicy() string {
|
||||
func getSecureExpectCTHeader() string {
|
||||
return env.Get(ConsoleSecureExpectCTHeader, "")
|
||||
}
|
||||
|
||||
// getTenantMemorySize Memory size value to be used when generating the
|
||||
// Tenant request
|
||||
func getTenantMemorySize() string {
|
||||
return env.Get(ConsoleTenantMemorySize, defaultTenantMemorySize)
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// This file is part of MinIO Kubernetes Cloud
|
||||
// Copyright (c) 2020 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package restapi
|
||||
|
||||
const (
|
||||
// ConsoleTenantMemorySize Memory size to be used when creating Tenant request
|
||||
ConsoleTenantMemorySize = "CONSOLE_TENANT_MEMORY_SIZE"
|
||||
)
|
||||
@@ -2248,6 +2248,70 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodeSelectorTerm": {
|
||||
"description": "A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"description": "A list of node selector requirements by node's labels.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "The label key that the selector applies to.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.",
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"matchFields": {
|
||||
"description": "A list of node selector requirements by node's fields.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "The label key that the selector applies to.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.",
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nofiticationService": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -2373,6 +2437,68 @@ func init() {
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"podAffinityTerm": {
|
||||
"description": "Required. A pod affinity term, associated with the corresponding weight.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"topologyKey"
|
||||
],
|
||||
"properties": {
|
||||
"labelSelector": {
|
||||
"description": "A label query over a set of resources, in this case pods.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "key is the label key that the selector applies to.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.",
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"matchLabels": {
|
||||
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"namespaces": {
|
||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"topologyKey": {
|
||||
"description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"policy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2738,12 +2864,28 @@ func init() {
|
||||
"volume_configuration"
|
||||
],
|
||||
"properties": {
|
||||
"affinity": {
|
||||
"$ref": "#/definitions/zoneAffinity"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"node_selector": {
|
||||
"description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"$ref": "#/definitions/zoneResources"
|
||||
},
|
||||
"servers": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tolerations": {
|
||||
"$ref": "#/definitions/zoneTolerations"
|
||||
},
|
||||
"volume_configuration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -2763,6 +2905,181 @@ func init() {
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoneAffinity": {
|
||||
"description": "If specified, affinity will define the pod's scheduling constraints",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nodeAffinity": {
|
||||
"description": "Describes node affinity scheduling rules for the pod.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"preference",
|
||||
"weight"
|
||||
],
|
||||
"properties": {
|
||||
"preference": {
|
||||
"description": "A node selector term, associated with the corresponding weight.",
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/nodeSelectorTerm"
|
||||
},
|
||||
"weight": {
|
||||
"description": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"nodeSelectorTerms"
|
||||
],
|
||||
"properties": {
|
||||
"nodeSelectorTerms": {
|
||||
"description": "Required. A list of node selector terms. The terms are ORed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/nodeSelectorTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"podAffinity": {
|
||||
"description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"podAffinityTerm",
|
||||
"weight"
|
||||
],
|
||||
"properties": {
|
||||
"podAffinityTerm": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
},
|
||||
"weight": {
|
||||
"description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"podAntiAffinity": {
|
||||
"description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"podAffinityTerm",
|
||||
"weight"
|
||||
],
|
||||
"properties": {
|
||||
"podAffinityTerm": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
},
|
||||
"weight": {
|
||||
"description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoneResources": {
|
||||
"description": "If provided, use these requests and limit for cpu/memory resource allocation",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limits": {
|
||||
"description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
},
|
||||
"requests": {
|
||||
"description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoneTolerations": {
|
||||
"description": "Tolerations allows users to set entries like effect, key, operator, value.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"effect": {
|
||||
"description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.",
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.",
|
||||
"type": "string"
|
||||
},
|
||||
"tolerationSeconds": {
|
||||
"description": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.",
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"value": {
|
||||
"description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
@@ -4525,6 +4842,269 @@ func init() {
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"NodeSelectorTermMatchExpressionsItems0": {
|
||||
"description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "The label key that the selector applies to.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.",
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"NodeSelectorTermMatchFieldsItems0": {
|
||||
"description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "The label key that the selector applies to.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.",
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PodAffinityTermLabelSelector": {
|
||||
"description": "A label query over a set of resources, in this case pods.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/PodAffinityTermLabelSelectorMatchExpressionsItems0"
|
||||
}
|
||||
},
|
||||
"matchLabels": {
|
||||
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PodAffinityTermLabelSelectorMatchExpressionsItems0": {
|
||||
"description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "key is the label key that the selector applies to.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.",
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityNodeAffinity": {
|
||||
"description": "Describes node affinity scheduling rules for the pod.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0"
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"nodeSelectorTerms"
|
||||
],
|
||||
"properties": {
|
||||
"nodeSelectorTerms": {
|
||||
"description": "Required. A list of node selector terms. The terms are ORed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/nodeSelectorTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0": {
|
||||
"description": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"preference",
|
||||
"weight"
|
||||
],
|
||||
"properties": {
|
||||
"preference": {
|
||||
"description": "A node selector term, associated with the corresponding weight.",
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/nodeSelectorTerm"
|
||||
},
|
||||
"weight": {
|
||||
"description": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"nodeSelectorTerms"
|
||||
],
|
||||
"properties": {
|
||||
"nodeSelectorTerms": {
|
||||
"description": "Required. A list of node selector terms. The terms are ORed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/nodeSelectorTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityPodAffinity": {
|
||||
"description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0"
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0": {
|
||||
"description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"podAffinityTerm",
|
||||
"weight"
|
||||
],
|
||||
"properties": {
|
||||
"podAffinityTerm": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
},
|
||||
"weight": {
|
||||
"description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityPodAntiAffinity": {
|
||||
"description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0"
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0": {
|
||||
"description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"podAffinityTerm",
|
||||
"weight"
|
||||
],
|
||||
"properties": {
|
||||
"podAffinityTerm": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
},
|
||||
"weight": {
|
||||
"description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneTolerationsItems0": {
|
||||
"description": "The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"effect": {
|
||||
"description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.",
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.",
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.",
|
||||
"type": "string"
|
||||
},
|
||||
"tolerationSeconds": {
|
||||
"description": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.",
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"value": {
|
||||
"description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ZoneVolumeConfiguration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -5007,6 +5587,26 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodeSelectorTerm": {
|
||||
"description": "A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"description": "A list of node selector requirements by node's labels.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/NodeSelectorTermMatchExpressionsItems0"
|
||||
}
|
||||
},
|
||||
"matchFields": {
|
||||
"description": "A list of node selector requirements by node's fields.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/NodeSelectorTermMatchFieldsItems0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nofiticationService": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -5132,6 +5732,46 @@ func init() {
|
||||
"get"
|
||||
]
|
||||
},
|
||||
"podAffinityTerm": {
|
||||
"description": "Required. A pod affinity term, associated with the corresponding weight.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"topologyKey"
|
||||
],
|
||||
"properties": {
|
||||
"labelSelector": {
|
||||
"description": "A label query over a set of resources, in this case pods.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/PodAffinityTermLabelSelectorMatchExpressionsItems0"
|
||||
}
|
||||
},
|
||||
"matchLabels": {
|
||||
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"namespaces": {
|
||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"topologyKey": {
|
||||
"description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"policy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5497,12 +6137,28 @@ func init() {
|
||||
"volume_configuration"
|
||||
],
|
||||
"properties": {
|
||||
"affinity": {
|
||||
"$ref": "#/definitions/zoneAffinity"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"node_selector": {
|
||||
"description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"$ref": "#/definitions/zoneResources"
|
||||
},
|
||||
"servers": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tolerations": {
|
||||
"$ref": "#/definitions/zoneTolerations"
|
||||
},
|
||||
"volume_configuration": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -5522,6 +6178,110 @@ func init() {
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoneAffinity": {
|
||||
"description": "If specified, affinity will define the pod's scheduling constraints",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nodeAffinity": {
|
||||
"description": "Describes node affinity scheduling rules for the pod.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0"
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"nodeSelectorTerms"
|
||||
],
|
||||
"properties": {
|
||||
"nodeSelectorTerms": {
|
||||
"description": "Required. A list of node selector terms. The terms are ORed.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/nodeSelectorTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"podAffinity": {
|
||||
"description": "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0"
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"podAntiAffinity": {
|
||||
"description": "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"preferredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0"
|
||||
}
|
||||
},
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
"description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/podAffinityTerm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoneResources": {
|
||||
"description": "If provided, use these requests and limit for cpu/memory resource allocation",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limits": {
|
||||
"description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
},
|
||||
"requests": {
|
||||
"description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"zoneTolerations": {
|
||||
"description": "Tolerations allows users to set entries like effect, key, operator, value.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ZoneTolerationsItems0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
403
swagger.yml
403
swagger.yml
@@ -1840,6 +1840,409 @@ definitions:
|
||||
type: integer
|
||||
storage_class_name:
|
||||
type: string
|
||||
resources:
|
||||
$ref: "#/definitions/zoneResources"
|
||||
node_selector:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: "NodeSelector is a selector which must be true for
|
||||
the pod to fit on a node. Selector which must match a node's
|
||||
labels for the pod to be scheduled on that node. More info:
|
||||
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/"
|
||||
affinity:
|
||||
$ref: "#/definitions/zoneAffinity"
|
||||
tolerations:
|
||||
$ref: "#/definitions/zoneTolerations"
|
||||
|
||||
zoneTolerations:
|
||||
description: Tolerations allows users to set entries like effect,
|
||||
key, operator, value.
|
||||
items:
|
||||
description: The pod this Toleration is attached to tolerates
|
||||
any taint that matches the triple <key,value,effect> using
|
||||
the matching operator <operator>.
|
||||
properties:
|
||||
effect:
|
||||
description: Effect indicates the taint effect to match.
|
||||
Empty means match all taint effects. When specified, allowed
|
||||
values are NoSchedule, PreferNoSchedule and NoExecute.
|
||||
type: string
|
||||
key:
|
||||
description: Key is the taint key that the toleration applies
|
||||
to. Empty means match all taint keys. If the key is empty,
|
||||
operator must be Exists; this combination means to match
|
||||
all values and all keys.
|
||||
type: string
|
||||
operator:
|
||||
description: Operator represents a key's relationship to
|
||||
the value. Valid operators are Exists and Equal. Defaults
|
||||
to Equal. Exists is equivalent to wildcard for value,
|
||||
so that a pod can tolerate all taints of a particular
|
||||
category.
|
||||
type: string
|
||||
tolerationSeconds:
|
||||
description: TolerationSeconds represents the period of
|
||||
time the toleration (which must be of effect NoExecute,
|
||||
otherwise this field is ignored) tolerates the taint.
|
||||
By default, it is not set, which means tolerate the taint
|
||||
forever (do not evict). Zero and negative values will
|
||||
be treated as 0 (evict immediately) by the system.
|
||||
format: int64
|
||||
type: integer
|
||||
value:
|
||||
description: Value is the taint value the toleration matches
|
||||
to. If the operator is Exists, the value should be empty,
|
||||
otherwise just a regular string.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
|
||||
zoneResources:
|
||||
description: If provided, use these requests and limit for cpu/memory
|
||||
resource allocation
|
||||
properties:
|
||||
limits:
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Limits describes the maximum amount of compute
|
||||
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/"
|
||||
type: object
|
||||
requests:
|
||||
additionalProperties:
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Requests describes the minimum amount of compute
|
||||
resources required. If Requests is omitted for a container,
|
||||
it defaults to Limits if that is explicitly specified, otherwise
|
||||
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/"
|
||||
type: object
|
||||
type: object
|
||||
|
||||
zoneAffinity:
|
||||
description: If specified, affinity will define the pod's scheduling
|
||||
constraints
|
||||
properties:
|
||||
nodeAffinity:
|
||||
description: Describes node affinity scheduling rules for
|
||||
the pod.
|
||||
properties:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
description: The scheduler will prefer to schedule pods
|
||||
to nodes that satisfy the affinity expressions specified
|
||||
by this field, but it may choose a node that violates
|
||||
one or more of the expressions. The node that is most
|
||||
preferred is the one with the greatest sum of weights,
|
||||
i.e. for each node that meets all of the scheduling
|
||||
requirements (resource request, requiredDuringScheduling
|
||||
affinity expressions, etc.), compute a sum by iterating
|
||||
through the elements of this field and adding "weight"
|
||||
to the sum if the node matches the corresponding matchExpressions;
|
||||
the node(s) with the highest sum are the most preferred.
|
||||
items:
|
||||
description: An empty preferred scheduling term matches
|
||||
all objects with implicit weight 0 (i.e. it's a no-op).
|
||||
A null preferred scheduling term matches no objects
|
||||
(i.e. is also a no-op).
|
||||
properties:
|
||||
preference:
|
||||
description: A node selector term, associated with
|
||||
the corresponding weight.
|
||||
$ref: "#/definitions/nodeSelectorTerm"
|
||||
type: object
|
||||
weight:
|
||||
description: Weight associated with matching the
|
||||
corresponding nodeSelectorTerm, in the range 1-100.
|
||||
format: int32
|
||||
type: integer
|
||||
required:
|
||||
- preference
|
||||
- weight
|
||||
type: object
|
||||
type: array
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
description: If the affinity requirements specified by
|
||||
this field are not met at scheduling time, the pod will
|
||||
not be scheduled onto the node. If the affinity requirements
|
||||
specified by this field cease to be met at some point
|
||||
during pod execution (e.g. due to an update), the system
|
||||
may or may not try to eventually evict the pod from
|
||||
its node.
|
||||
properties:
|
||||
nodeSelectorTerms:
|
||||
description: Required. A list of node selector terms.
|
||||
The terms are ORed.
|
||||
items:
|
||||
$ref: "#/definitions/nodeSelectorTerm"
|
||||
type: array
|
||||
required:
|
||||
- nodeSelectorTerms
|
||||
type: object
|
||||
type: object
|
||||
podAffinity:
|
||||
description: Describes pod affinity scheduling rules (e.g.
|
||||
co-locate this pod in the same node, zone, etc. as some
|
||||
other pod(s)).
|
||||
properties:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
description: The scheduler will prefer to schedule pods
|
||||
to nodes that satisfy the affinity expressions specified
|
||||
by this field, but it may choose a node that violates
|
||||
one or more of the expressions. The node that is most
|
||||
preferred is the one with the greatest sum of weights,
|
||||
i.e. for each node that meets all of the scheduling
|
||||
requirements (resource request, requiredDuringScheduling
|
||||
affinity expressions, etc.), compute a sum by iterating
|
||||
through the elements of this field and adding "weight"
|
||||
to the sum if the node has pods which matches the corresponding
|
||||
podAffinityTerm; the node(s) with the highest sum are
|
||||
the most preferred.
|
||||
items:
|
||||
description:
|
||||
The weights of all of the matched WeightedPodAffinityTerm
|
||||
fields are added per-node to find the most preferred
|
||||
node(s)
|
||||
properties:
|
||||
podAffinityTerm:
|
||||
$ref: "#/definitions/podAffinityTerm"
|
||||
weight:
|
||||
description: weight associated with matching the
|
||||
corresponding podAffinityTerm, in the range 1-100.
|
||||
format: int32
|
||||
type: integer
|
||||
required:
|
||||
- podAffinityTerm
|
||||
- weight
|
||||
type: object
|
||||
type: array
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
description: If the affinity requirements specified by
|
||||
this field are not met at scheduling time, the pod will
|
||||
not be scheduled onto the node. If the affinity requirements
|
||||
specified by this field cease to be met at some point
|
||||
during pod execution (e.g. due to a pod label update),
|
||||
the system may or may not try to eventually evict the
|
||||
pod from its node. When there are multiple elements,
|
||||
the lists of nodes corresponding to each podAffinityTerm
|
||||
are intersected, i.e. all terms must be satisfied.
|
||||
items:
|
||||
$ref: "#/definitions/podAffinityTerm"
|
||||
type: array
|
||||
type: object
|
||||
podAntiAffinity:
|
||||
description: Describes pod anti-affinity scheduling rules
|
||||
(e.g. avoid putting this pod in the same node, zone, etc.
|
||||
as some other pod(s)).
|
||||
properties:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
description: The scheduler will prefer to schedule pods
|
||||
to nodes that satisfy the anti-affinity expressions
|
||||
specified by this field, but it may choose a node that
|
||||
violates one or more of the expressions. The node that
|
||||
is most preferred is the one with the greatest sum of
|
||||
weights, i.e. for each node that meets all of the scheduling
|
||||
requirements (resource request, requiredDuringScheduling
|
||||
anti-affinity expressions, etc.), compute a sum by iterating
|
||||
through the elements of this field and adding "weight"
|
||||
to the sum if the node has pods which matches the corresponding
|
||||
podAffinityTerm; the node(s) with the highest sum are
|
||||
the most preferred.
|
||||
items:
|
||||
description:
|
||||
The weights of all of the matched WeightedPodAffinityTerm
|
||||
fields are added per-node to find the most preferred
|
||||
node(s)
|
||||
properties:
|
||||
podAffinityTerm:
|
||||
$ref: "#/definitions/podAffinityTerm"
|
||||
weight:
|
||||
description: weight associated with matching the
|
||||
corresponding podAffinityTerm, in the range 1-100.
|
||||
format: int32
|
||||
type: integer
|
||||
required:
|
||||
- podAffinityTerm
|
||||
- weight
|
||||
type: object
|
||||
type: array
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
description: If the anti-affinity requirements specified
|
||||
by this field are not met at scheduling time, the pod
|
||||
will not be scheduled onto the node. If the anti-affinity
|
||||
requirements specified by this field cease to be met
|
||||
at some point during pod execution (e.g. due to a pod
|
||||
label update), the system may or may not try to eventually
|
||||
evict the pod from its node. When there are multiple
|
||||
elements, the lists of nodes corresponding to each podAffinityTerm
|
||||
are intersected, i.e. all terms must be satisfied.
|
||||
items:
|
||||
$ref: "#/definitions/podAffinityTerm"
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
|
||||
nodeSelectorTerm:
|
||||
type: object
|
||||
description: A null or empty node selector term
|
||||
matches no objects. The requirements of them are
|
||||
ANDed. The TopologySelectorTerm type implements
|
||||
a subset of the NodeSelectorTerm.
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: A list of node selector requirements
|
||||
by node's labels.
|
||||
items:
|
||||
description: A node selector requirement is
|
||||
a selector that contains values, a key,
|
||||
and an operator that relates the key and
|
||||
values.
|
||||
properties:
|
||||
key:
|
||||
description: The label key that the selector
|
||||
applies to.
|
||||
type: string
|
||||
operator:
|
||||
description: Represents a key's relationship
|
||||
to a set of values. Valid operators
|
||||
are In, NotIn, Exists, DoesNotExist.
|
||||
Gt, and Lt.
|
||||
type: string
|
||||
values:
|
||||
description: An array of string values.
|
||||
If the operator is In or NotIn, the
|
||||
values array must be non-empty. If the
|
||||
operator is Exists or DoesNotExist,
|
||||
the values array must be empty. If the
|
||||
operator is Gt or Lt, the values array
|
||||
must have a single element, which will
|
||||
be interpreted as an integer. This array
|
||||
is replaced during a strategic merge
|
||||
patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
matchFields:
|
||||
description: A list of node selector requirements
|
||||
by node's fields.
|
||||
items:
|
||||
description: A node selector requirement is
|
||||
a selector that contains values, a key,
|
||||
and an operator that relates the key and
|
||||
values.
|
||||
properties:
|
||||
key:
|
||||
description: The label key that the selector
|
||||
applies to.
|
||||
type: string
|
||||
operator:
|
||||
description: Represents a key's relationship
|
||||
to a set of values. Valid operators
|
||||
are In, NotIn, Exists, DoesNotExist.
|
||||
Gt, and Lt.
|
||||
type: string
|
||||
values:
|
||||
description: An array of string values.
|
||||
If the operator is In or NotIn, the
|
||||
values array must be non-empty. If the
|
||||
operator is Exists or DoesNotExist,
|
||||
the values array must be empty. If the
|
||||
operator is Gt or Lt, the values array
|
||||
must have a single element, which will
|
||||
be interpreted as an integer. This array
|
||||
is replaced during a strategic merge
|
||||
patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
|
||||
podAffinityTerm:
|
||||
description: Required. A pod affinity term, associated
|
||||
with the corresponding weight.
|
||||
properties:
|
||||
labelSelector:
|
||||
description: A label query over a set of resources,
|
||||
in this case pods.
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: matchExpressions is a list
|
||||
of label selector requirements. The requirements
|
||||
are ANDed.
|
||||
items:
|
||||
description: A label selector requirement
|
||||
is a selector that contains values,
|
||||
a key, and an operator that relates
|
||||
the key and values.
|
||||
properties:
|
||||
key:
|
||||
description: key is the label key
|
||||
that the selector applies to.
|
||||
type: string
|
||||
operator:
|
||||
description: operator represents a
|
||||
key's relationship to a set of values.
|
||||
Valid operators are In, NotIn, Exists
|
||||
and DoesNotExist.
|
||||
type: string
|
||||
values:
|
||||
description: values is an array of
|
||||
string values. If the operator is
|
||||
In or NotIn, the values array must
|
||||
be non-empty. If the operator is
|
||||
Exists or DoesNotExist, the values
|
||||
array must be empty. This array
|
||||
is replaced during a strategic merge
|
||||
patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
matchLabels:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: matchLabels is a map of {key,value}
|
||||
pairs. A single {key,value} in the matchLabels
|
||||
map is equivalent to an element of matchExpressions,
|
||||
whose key field is "key", the operator
|
||||
is "In", and the values array contains
|
||||
only "value". The requirements are ANDed.
|
||||
type: object
|
||||
type: object
|
||||
namespaces:
|
||||
description: namespaces specifies which namespaces
|
||||
the labelSelector applies to (matches against);
|
||||
null or empty list means "this pod's namespace"
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
topologyKey:
|
||||
description: This pod should be co-located (affinity)
|
||||
or not co-located (anti-affinity) with the
|
||||
pods matching the labelSelector in the specified
|
||||
namespaces, where co-located is defined as
|
||||
running on a node whose value of the label
|
||||
with key topologyKey matches that of any node
|
||||
on which any of the selected pods is running.
|
||||
Empty topologyKey is not allowed.
|
||||
type: string
|
||||
required:
|
||||
- topologyKey
|
||||
type: object
|
||||
|
||||
resourceQuota:
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user