Skip to content

feat: conversion for ControlPlane from v1beta1 to v2alpha1 #488

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,29 @@ import (
corev1 "k8s.io/api/core/v1"
)

// +kubebuilder:validation:XValidation:message="Using both replicas and scaling fields is not allowed.",rule="!(has(self.scaling) && has(self.replicas))"
// DataPlaneDeploymentOptions specifies options for the Deployments (as in the Kubernetes
// resource "Deployment") which are created and managed for the DataPlane resource.
//
// +apireference:kgo:include
// +kubebuilder:object:generate=true
type DataPlaneDeploymentOptions struct {
// Rollout describes a custom rollout strategy.
//
// +optional
Rollout *Rollout `json:"rollout,omitempty"`

DeploymentOptions `json:",inline"`
}

// DeploymentOptions is a shared type used on objects to indicate that their
// configuration results in a Deployment which is managed by the Operator and
// includes options for managing Deployments such as the number of replicas
// or pod options like container image and resource requirements.
// version, as well as Env variable overrides.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
// +kubebuilder:validation:XValidation:message="Using both replicas and scaling fields is not allowed.",rule="!(has(self.scaling) && has(self.replicas))"
type DeploymentOptions struct {
// Replicas describes the number of desired pods.
// This is a pointer to distinguish between explicit zero and not specified.
Expand All @@ -38,6 +52,8 @@ type DeploymentOptions struct {
}

// Scaling defines the scaling options for the deployment.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
type Scaling struct {
// HorizontalScaling defines horizontal scaling options for the deployment.
Expand All @@ -48,6 +64,8 @@ type Scaling struct {
// HorizontalScaling defines horizontal scaling options for the deployment.
// It holds all the options from the HorizontalPodAutoscalerSpec besides the
// ScaleTargetRef which is being controlled by the Operator.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
type HorizontalScaling struct {
// minReplicas is the lower limit for the number of replicas to which the autoscaler
Expand Down Expand Up @@ -82,13 +100,17 @@ type HorizontalScaling struct {
}

// Rollout defines options for rollouts.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
type Rollout struct {
// Strategy contains the deployment strategy for rollout.
Strategy RolloutStrategy `json:"strategy"`
}

// RolloutStrategy holds the rollout strategy options.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
type RolloutStrategy struct {
// BlueGreen holds the options specific for Blue Green Deployments.
Expand All @@ -98,6 +120,8 @@ type RolloutStrategy struct {
}

// BlueGreenStrategy defines the Blue Green deployment strategy.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
type BlueGreenStrategy struct {
// Promotion defines how the operator handles promotion of resources.
Expand All @@ -113,6 +137,8 @@ type BlueGreenStrategy struct {

// Promotion is a type that contains fields that define how the operator handles
// promotion of resources during a blue/green rollout.
//
// +kubebuilder:object:generate=true
// +apireference:kgo:include
type Promotion struct {
// TODO: implement AutomaticPromotion https://github.com/Kong/gateway-operator/issues/164
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1beta1

// WatchNamespaces defines the namespaces to watch for resources
//
// +kubebuilder:object:generate=true
// +kubebuilder:validation:XValidation:message="list is required when type is 'list'", rule="self.type == 'list' ? has(self.list) : true"
// +kubebuilder:validation:XValidation:message="list must not be specified when type is not 'list'", rule="self.type != 'list' ? !has(self.list) : true"
// +apireference:kgo:include
Expand Down
217 changes: 217 additions & 0 deletions api/common/v1beta1/zz_generated.deepcopy.go

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

Loading