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

Add Barbican #562

Merged
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
416 changes: 416 additions & 0 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions apis/core/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ const (
// OpenStackControlPlaneDesignateReadyCondition Status=True condition which indicates if Designate is configured and operational
OpenStackControlPlaneDesignateReadyCondition condition.Type = "OpenStackControlPlaneDesignateReady"

// OpenStackControlPlaneBarbicanReadyCondition Status=True condition which indicates if Barbican is configured and operational
OpenStackControlPlaneBarbicanReadyCondition condition.Type = "OpenStackControlPlaneBarbicanReady"

// OpenStackControlPlaneRedisReadyCondition Status=True condition which indicates if Redis is configured and operational
OpenStackControlPlaneRedisReadyCondition condition.Type = "OpenStackControlPlaneRedisReady"

Expand All @@ -155,6 +158,9 @@ const (

// OpenStackControlPlaneExposeDesignateReadyCondition Status=True condition which indicates if Designate is exposed via a route
OpenStackControlPlaneExposeDesignateReadyCondition condition.Type = "OpenStackControlPlaneExposeDesignateReady"

// OpenStackControlPlaneExposeBarbicanReadyCondition Status=True condition which indicates if Barbican is exposed via a route
OpenStackControlPlaneExposeBarbicanReadyCondition condition.Type = "OpenStackControlPlaneExposeBarbicanReady"
)

// OpenStackControlPlane Reasons used by API objects.
Expand Down Expand Up @@ -385,6 +391,18 @@ const (
// OpenStackControlPlaneDesignateReadyErrorMessage
OpenStackControlPlaneDesignateReadyErrorMessage = "OpenStackControlPlane Designate error occured %s"

// OpenStackControlPlaneBarbicanReadyInitMessage
OpenStackControlPlaneBarbicanReadyInitMessage = "OpenStackControlPlane Barbican not started"

// OpenStackControlPlaneBarbicanReadyMessage
OpenStackControlPlaneBarbicanReadyMessage = "OpenStackControlPlane Barbican completed"

// OpenStackControlPlaneBarbicanReadyRunningMessage
OpenStackControlPlaneBarbicanReadyRunningMessage = "OpenStackControlPlane Barbican in progress"

// OpenStackControlPlaneBarbicanReadyErrorMessage
OpenStackControlPlaneBarbicanReadyErrorMessage = "OpenStackControlPlane Barbican error occured %s"

// OpenStackControlPlaneRedisReadyInitMessage
OpenStackControlPlaneRedisReadyInitMessage = "OpenStackControlPlane Redis not started"

Expand Down
24 changes: 24 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1beta1

import (
barbicanv1 "github.com/openstack-k8s-operators/barbican-operator/api/v1beta1"
cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
designatev1 "github.com/openstack-k8s-operators/designate-operator/api/v1beta1"
glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1"
Expand Down Expand Up @@ -168,6 +169,9 @@ type OpenStackControlPlaneSpec struct {
// Designate - Parameters related to the Designate service
Designate DesignateSection `json:"designate,omitempty"`

// Barbican - Parameters related to the Barbican service
Barbican BarbicanSection `json:"barbican,omitempty"`

// Redis - Parameters related to the Redis service
Redis RedisSection `json:"redis,omitempty"`

Expand Down Expand Up @@ -621,6 +625,25 @@ type DesignateSection struct {
APIOverride Override `json:"apiOverride,omitempty"`
}

// BarbicanSection defines the desired state of Barbican service
type BarbicanSection struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Enabled - Whether Barbican service should be deployed and managed
Enabled bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Template - Overrides to use when creating the Barbican Service
Template barbicanv1.BarbicanSpec `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"`
}

// RedisSection defines the desired state of the Redis service
type RedisSection struct {
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -724,6 +747,7 @@ func (instance *OpenStackControlPlane) InitConditions() {
condition.UnknownCondition(OpenStackControlPlaneSwiftReadyCondition, condition.InitReason, OpenStackControlPlaneSwiftReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneOctaviaReadyCondition, condition.InitReason, OpenStackControlPlaneOctaviaReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneDesignateReadyCondition, condition.InitReason, OpenStackControlPlaneDesignateReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneBarbicanReadyCondition, condition.InitReason, OpenStackControlPlaneBarbicanReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneRedisReadyCondition, condition.InitReason, OpenStackControlPlaneRedisReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneCAReadyCondition, condition.InitReason, OpenStackControlPlaneCAReadyInitMessage),

Expand Down
14 changes: 14 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Memcached, Keystone"
}
case "Barbican":
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Keystone.Enabled) {
reqs = "MariaDB or Galera, Keystone"
}
case "Octavia":
// TODO(beagles): So far we haven't declared Redis as dependency for Octavia, but we might.
if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
Expand Down Expand Up @@ -291,6 +295,13 @@ func (r *OpenStackControlPlane) ValidateServiceDependencies(basePath *field.Path
}
}

if r.Spec.Barbican.Enabled {
if depErrorMsg := r.checkDepsEnabled("Barbican"); depErrorMsg != "" {
err := field.Invalid(basePath.Child("barbican").Child("enabled"), r.Spec.Barbican.Enabled, depErrorMsg)
allErrs = append(allErrs, err)
}
}

return allErrs
}

Expand Down Expand Up @@ -420,6 +431,9 @@ func (r *OpenStackControlPlane) DefaultServices() {
// Octavia
r.Spec.Octavia.Template.Default()

// Barbican
r.Spec.Barbican.Template.Default()

// Redis
for key, template := range r.Spec.Redis.Templates {
template.Default()
Expand Down
18 changes: 18 additions & 0 deletions apis/core/v1beta1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions apis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.19
require (
github.com/onsi/ginkgo/v2 v2.13.1
github.com/onsi/gomega v1.30.0
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20231122193628-96ca1e05d8ad
github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231121084647-689b50f424d8
github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231121201004-def8670ef7e9
github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20231121125418-e3f2a877f48c
Expand Down
2 changes: 2 additions & 0 deletions apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4=
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20231122193628-96ca1e05d8ad h1:qBfLa7kRWzTCitV32Zvi89knSNMQgd4bCSGlA4baLHI=
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20231122193628-96ca1e05d8ad/go.mod h1:cW498Nb/C86IqMJSyP6QLmeo0MS7rEL7dUTm4iBZlxM=
github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231121084647-689b50f424d8 h1:zkKuC5JIiQB6AezfKBwUJfgNir/w9jSaeFT+naZgC6c=
github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20231121084647-689b50f424d8/go.mod h1:wV6KRR6y+QCJf5R6nQ7dSRQenKEFWV6TIHWhh9wTbMc=
github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20231121201004-def8670ef7e9 h1:mdaBbHhIqN5uUhL9z3gmNdRlCg3F3aDtvUZIXTcozQc=
Expand Down
2 changes: 2 additions & 0 deletions cmd/csv-merger/csv-merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ var (
swiftCsv = flag.String("swift-csv", "", "Swift CSV filename")
octaviaCsv = flag.String("octavia-csv", "", "Octavia CSV filename")
designateCsv = flag.String("designate-csv", "", "Designate CSV filename")
barbicanCsv = flag.String("barbican-csv", "", "Barbican CSV filename")
csvOverrides = flag.String("csv-overrides", "", "CSV like string with punctual changes that will be recursively applied (if possible)")
importEnvFiles = flag.String("import-env-files", "", "Comma separated list of file names to read default operator ENVs from. Used for inter-bundle ENV merging.")
exportEnvFile = flag.String("export-env-file", "", "Name the external file to write operator ENVs to. Used for inter-bundle ENV merging.")
Expand Down Expand Up @@ -142,6 +143,7 @@ func main() {
*swiftCsv,
*octaviaCsv,
*designateCsv,
*barbicanCsv,
}

csvVersion := os.Getenv("CSV_VERSION")
Expand Down
Loading