Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGMT-9797: Implementation for new Ingress API introduced in Single Node + Workers enhancement #1151

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/v1/0000_10_config-operator_01_ingress.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ spec:
resource:
description: resource of the referent.
type: string
defaultPlacement:
description: "defaultPlacement is set at installation time to control which nodes will host the ingress router pods by default. The options are control-plane nodes or worker nodes. \n This field works by dictating how the Cluster Ingress Operator will consider unset replicas and nodePlacement fields in IngressController resources when creating the corresponding Deployments. \n See the documentation for the IngressController replicas and nodePlacement fields for more information. \n When omitted, the default value is Workers"
type: string
default: Workers
enum:
- ControlPlane
- Workers
served: true
storage: true
subresources:
Expand Down
29 changes: 29 additions & 0 deletions config/v1/types_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ type IngressStatus struct {
// hostnames and serving certificates can be customized by the cluster-admin.
// +optional
ComponentRoutes []ComponentRouteStatus `json:"componentRoutes,omitempty"`

// defaultPlacement is set at installation time to control which
// nodes will host the ingress router pods by default. The options are
// control-plane nodes or worker nodes.
//
// This field works by dictating how the Cluster Ingress Operator will
// consider unset replicas and nodePlacement fields in IngressController
// resources when creating the corresponding Deployments.
//
// See the documentation for the IngressController replicas and nodePlacement
// fields for more information.
//
// When omitted, the default value is Workers
//
// +kubebuilder:validation:Enum:="ControlPlane";"Workers"
// +kubebuilder:default:="Workers"
// +optional
DefaultPlacement DefaultPlacement `json:"defaultPlacement"`
}

// ComponentRouteSpec allows for configuration of a route's hostname and serving certificate.
Expand Down Expand Up @@ -222,3 +240,14 @@ type IngressList struct {

Items []Ingress `json:"items"`
}

// DefaultPlacement defines the default placement of ingress router pods.
type DefaultPlacement string

const (
// "Workers" is for having router pods placed on worker nodes by default.
DefaultPlacementWorkers DefaultPlacement = "Workers"

// "ControlPlane" is for having router pods placed on control-plane nodes by default.
DefaultPlacementControlPlane DefaultPlacement = "ControlPlane"
)
3 changes: 2 additions & 1 deletion config/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,14 @@ spec:
properties:
nodeSelector:
description: "nodeSelector is the node selector applied to ingress
controller deployments. \n If unset, the default is: \n kubernetes.io/os:
linux node-role.kubernetes.io/worker: '' \n If set, the specified
selector is used and replaces the default."
controller deployments. \n If set, the specified selector is
used and replaces the default. \n If unset, the default depends
on the value of the defaultPlacement field in the cluster config.openshift.io/v1/ingresses
status. \n When defaultPlacement is Workers, the default is:
\n kubernetes.io/os: linux node-role.kubernetes.io/worker:
'' \n When defaultPlacement is ControlPlane, the default is:
\n kubernetes.io/os: linux node-role.kubernetes.io/master:
'' \n These defaults are subject to change."
properties:
matchExpressions:
description: matchExpressions is a list of label selector
Expand Down Expand Up @@ -896,8 +901,16 @@ spec:
type: array
type: object
replicas:
description: replicas is the desired number of ingress controller
replicas. If unset, defaults to 2.
description: "replicas is the desired number of ingress controller
replicas. If unset, the default depends on the value of the defaultPlacement
field in the cluster config.openshift.io/v1/ingresses status. \n
The value of replicas is set based on the value of a chosen field
in the Infrastructure CR. If defaultPlacement is set to ControlPlane,
the chosen field will be controlPlaneTopology. If it is set to Workers
the chosen field will be infrastructureTopology. Replicas will then
be set to 1 or 2 based whether the chosen field's value is SingleReplica
or HighlyAvailable, respectively. \n These defaults are subject
to change."
format: int32
type: integer
routeAdmission:
Expand Down
26 changes: 23 additions & 3 deletions operator/v1/types_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,17 @@ type IngressControllerSpec struct {
HttpErrorCodePages configv1.ConfigMapNameReference `json:"httpErrorCodePages,omitempty"`

// replicas is the desired number of ingress controller replicas. If unset,
// defaults to 2.
// the default depends on the value of the defaultPlacement field in the
// cluster config.openshift.io/v1/ingresses status.
//
// The value of replicas is set based on the value of a chosen field in the
// Infrastructure CR. If defaultPlacement is set to ControlPlane, the
// chosen field will be controlPlaneTopology. If it is set to Workers the
// chosen field will be infrastructureTopology. Replicas will then be set to 1
// or 2 based whether the chosen field's value is SingleReplica or
// HighlyAvailable, respectively.
//
// These defaults are subject to change.
//
// +optional
Replicas *int32 `json:"replicas,omitempty"`
Expand Down Expand Up @@ -292,12 +302,22 @@ type NodePlacement struct {
// nodeSelector is the node selector applied to ingress controller
// deployments.
//
// If unset, the default is:
// If set, the specified selector is used and replaces the default.
//
// If unset, the default depends on the value of the defaultPlacement
// field in the cluster config.openshift.io/v1/ingresses status.
//
// When defaultPlacement is Workers, the default is:
//
// kubernetes.io/os: linux
// node-role.kubernetes.io/worker: ''
//
// If set, the specified selector is used and replaces the default.
// When defaultPlacement is ControlPlane, the default is:
//
// kubernetes.io/os: linux
// node-role.kubernetes.io/master: ''
//
// These defaults are subject to change.
//
// +optional
NodeSelector *metav1.LabelSelector `json:"nodeSelector,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.