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

Create several services route and svc endpoint overrides #416

Closed
wants to merge 11 commits into from
2,465 changes: 2,065 additions & 400 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions apis/core/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ const (
// OpenStackControlPlaneCeilometerReadyCondition Status=True condition which indicates if OpenStack Ceilometer service is configured and operational
OpenStackControlPlaneCeilometerReadyCondition condition.Type = "OpenStackControlPlaneCeilometerReady"

// OpenStackControlPlaneServiceOverrideReadyCondition Status=True condition which indicates if OpenStack service override has created ok
OpenStackControlPlaneServiceOverrideReadyCondition condition.Type = "OpenStackControlPlaneServiceOverrideReady"

// OpenStackControlPlaneManilaReadyInitMessage
OpenStackControlPlaneManilaReadyInitMessage = "OpenStackControlPlane Manila not started"

Expand Down Expand Up @@ -321,4 +324,13 @@ const (

// OpenStackControlPlaneCeilometerReadyErrorMessage
OpenStackControlPlaneCeilometerReadyErrorMessage = "OpenStackControlPlane Ceilometer error occured %s"

// OpenStackControlPlaneServiceOverrideReadyInitMessage
OpenStackControlPlaneServiceOverrideReadyInitMessage = "OpenStackControlPlane service override not started"

// OpenStackControlPlaneServiceOverrideReadyMessage
OpenStackControlPlaneServiceOverrideReadyMessage = "OpenStackControlPlane service override completed"

// OpenStackControlPlaneServiceOverrideReadyErrorMessage
OpenStackControlPlaneServiceOverrideReadyErrorMessage = "OpenStackControlPlane %s %s service override error occured %s"
)
123 changes: 87 additions & 36 deletions apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ import (
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/route"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are moving all the route logic here would it potentially make sense to remove common/route from lib-common and instead just host it within this operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we can do that as a follow up, otherwise we'd have to first migrate all service operators before we can land other things in lib-common

"github.com/openstack-k8s-operators/lib-common/modules/common/util"
"github.com/openstack-k8s-operators/lib-common/modules/storage"
manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1"
mariadbv1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1"
neutronv1 "github.com/openstack-k8s-operators/neutron-operator/api/v1beta1"
novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1"
octaviav1 "github.com/openstack-k8s-operators/octavia-operator/api/v1beta1"
ovnv1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1"
placementv1 "github.com/openstack-k8s-operators/placement-operator/api/v1beta1"
swiftv1 "github.com/openstack-k8s-operators/swift-operator/api/v1beta1"
telemetryv1 "github.com/openstack-k8s-operators/telemetry-operator/api/v1beta1"
rabbitmqv1 "github.com/rabbitmq/cluster-operator/api/v1beta1"
octaviav1 "github.com/openstack-k8s-operators/octavia-operator/api/v1beta1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -188,9 +189,21 @@ type KeystoneSection struct {
Enabled bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Keystone service
Template keystonev1.KeystoneAPISpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`
}

// Override to override the generated manifest of several child resources.
type Override struct {
// +kubebuilder:validation:Optional
// Route overrides to use when creating the public service endpoint
Route *route.OverrideSpec `json:"route,omitempty"`
}

// PlacementSection defines the desired state of Placement service
Expand All @@ -205,6 +218,11 @@ type PlacementSection struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Placement API
Template placementv1.PlacementAPISpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`
}

// GlanceSection defines the desired state of Glance service
Expand All @@ -219,6 +237,11 @@ type GlanceSection struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Glance Service
Template glancev1.GlanceSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`
}

// CinderSection defines the desired state of Cinder service
Expand All @@ -233,6 +256,11 @@ type CinderSection struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating Cinder Resources
Template cinderv1.CinderSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`
}

// MariadbSection defines the desired state of MariaDB service
Expand Down Expand Up @@ -297,39 +325,6 @@ type RabbitmqTemplate struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Overrides to use when creating the Rabbitmq clusters
rabbitmqv1.RabbitmqClusterSpec `json:",inline"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// ExternalEndpoint, expose a VIP via MetalLB on the pre-created address pool
ExternalEndpoint *MetalLBConfig `json:"externalEndpoint,omitempty"`
}

// MetalLBConfig to configure the MetalLB loadbalancer service
type MetalLBConfig struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
//+operator-sdk:csv:customresourcedefinitions:type=spec
// IPAddressPool expose VIP via MetalLB on the IPAddressPool
IPAddressPool string `json:"ipAddressPool"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// SharedIP if true, VIP/VIPs get shared with multiple services
SharedIP bool `json:"sharedIP"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=""
//+operator-sdk:csv:customresourcedefinitions:type=spec
// SharedIPKey specifies the sharing key which gets set as the annotation on the LoadBalancer service.
// Services which share the same VIP must have the same SharedIPKey. Defaults to the IPAddressPool if
// SharedIP is true, but no SharedIPKey specified.
SharedIPKey string `json:"sharedIPKey"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// LoadBalancerIPs, request given IPs from the pool if available. Using a list to allow dual stack (IPv4/IPv6) support
LoadBalancerIPs []string `json:"loadBalancerIPs"`
}

// OvnSection defines the desired state of OVN services
Expand Down Expand Up @@ -374,8 +369,13 @@ type NeutronSection struct {

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Neutron service
// Template - Overrides to use when creating the Neutron Service
Template neutronv1.NeutronAPISpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`
}

// NovaSection defines the desired state of Nova services
Expand All @@ -390,6 +390,23 @@ type NovaSection struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Nova services
Template novav1.NovaSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// CellOverride, provides the ability to override the generated manifest of several child resources
// for a nova cell.
CellOverride map[string]NovaCellOverrideSpec `json:"cellOverride,omitempty"`
}

// NovaCellOverrideSpec to override the generated manifest of several child resources.
type NovaCellOverrideSpec struct {
// +kubebuilder:validation:Optional
NoVNCProxy Override `json:"noVNCProxy,omitempty"`
}

// HeatSection defines the desired state of Heat services
Expand All @@ -404,6 +421,16 @@ type HeatSection struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Heat services
Template heatv1.HeatSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// CnfAPIOverride, provides the ability to override the generated manifest of several child resources.
CnfAPIOverride Override `json:"cnfAPIOverride,omitempty"`
}

// IronicSection defines the desired state of Ironic services
Expand Down Expand Up @@ -431,6 +458,11 @@ type ManilaSection struct {
// +kubebuilder:validation:Optional
// Template - Overrides to use when creating Manila Resources
Template manilav1.ManilaSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride Override `json:"apiOverride,omitempty"`
}

// HorizonSection defines the desired state of Horizon services
Expand All @@ -443,6 +475,18 @@ type HorizonSection struct {
// +kubebuilder:validation:Optional
// Template - Overrides to use when creating the Horizon services
Template horizonv1.HorizonSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// APIOverride, provides the ability to override the generated manifest of several child resources.
APIOverride HorizonOverride `json:"apiOverride,omitempty"`
}

// HorizonOverride to override the generated manifest of several child resources.
type HorizonOverride struct {
// +kubebuilder:validation:Optional
// Route overrides to use when creating the public service endpoint
Route *route.OverrideSpec `json:"route,omitempty"`
}

// CeilometerSection defines the desired state of OpenStack Telemetry services
Expand Down Expand Up @@ -471,6 +515,11 @@ type SwiftSection struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating Swift Resources
Template swiftv1.SwiftSpec `json:"template,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// ProxyOverride, provides the ability to override the generated manifest of several child resources.
ProxyOverride Override `json:"proxyOverride,omitempty"`
}

// OctaviaSection defines the desired state of the Octavia service
Expand Down Expand Up @@ -556,6 +605,8 @@ func (instance *OpenStackControlPlane) InitConditions() {
instance.Status.Conditions = condition.Conditions{}
}
cl := condition.CreateList(
condition.UnknownCondition(OpenStackControlPlaneServiceOverrideReadyCondition, condition.InitReason, OpenStackControlPlaneServiceOverrideReadyInitMessage),
condition.UnknownCondition(condition.ExposeServiceReadyCondition, condition.InitReason, condition.ExposeServiceReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneRabbitMQReadyCondition, condition.InitReason, OpenStackControlPlaneRabbitMQReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneOVNReadyCondition, condition.InitReason, OpenStackControlPlaneOVNReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneNeutronReadyCondition, condition.InitReason, OpenStackControlPlaneNeutronReadyInitMessage),
Expand Down
2 changes: 1 addition & 1 deletion apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {
case "Octavia":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled && r.Spec.Nova.Enabled &&
r.Spec.Ovn.Enabled) {
r.Spec.Ovn.Enabled) {
reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone, Glance, Neutron, Nova, OVN"
}
}
Expand Down
Loading
Loading