Skip to content

Commit

Permalink
Merge pull request #34 from mauricioharley/barbican_keystone_listener
Browse files Browse the repository at this point in the history
Create barbican keystone listener deployment
  • Loading branch information
vakwetu authored Oct 31, 2023
2 parents 4833afe + ed1aa45 commit ba23837
Show file tree
Hide file tree
Showing 22 changed files with 1,585 additions and 14 deletions.
13 changes: 11 additions & 2 deletions api/v1beta1/barbican_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const (

// BarbicanWorkerContainerImage is the fall-back container image for BarbicanAPI
BarbicanWorkerContainerImage = "quay.io/podified-antelope-centos9/openstack-barbican-worker:current-podified"

// BarbicanKeystoneListenerContainerImage is the fall-back container image for BarbicanAPI
BarbicanKeystoneListenerContainerImage = "quay.io/podified-antelope-centos9/openstack-barbican-keystone-listener:current-podified"
)

// BarbicanSpec defines the desired state of Barbican
Expand Down Expand Up @@ -67,6 +70,8 @@ type BarbicanSpec struct {
BarbicanAPI BarbicanAPITemplate `json:"barbicanAPI"`

BarbicanWorker BarbicanWorkerTemplate `json:"barbicanWorker"`

BarbicanKeystoneListener BarbicanKeystoneListenerTemplate `json:"barbicanKeystoneListener"`
}

// BarbicanStatus defines the observed state of Barbican
Expand All @@ -86,6 +91,9 @@ type BarbicanStatus struct {
// ReadyCount of Barbican Worker instances
BarbicanWorkerReadyCount int32 `json:"barbicanWorkerReadyCount,omitempty"`

// ReadyCount of Barbican KeystoneListener instances
BarbicanKeystoneListenerReadyCount int32 `json:"barbicanKeystoneListenerReadyCount,omitempty"`

// TransportURLSecret - Secret containing RabbitMQ transportURL
TransportURLSecret string `json:"transportURLSecret,omitempty"`

Expand Down Expand Up @@ -142,8 +150,9 @@ func init() {
func SetupDefaults() {
// Acquire environmental defaults and initialize Barbican defaults with them
barbicanDefaults := BarbicanDefaults{
APIContainerImageURL: util.GetEnvVar("BARBICAN_API_IMAGE_URL_DEFAULT", BarbicanAPIContainerImage),
WorkerContainerImageURL: util.GetEnvVar("BARBICAN_WORKER_IMAGE_URL_DEFAULT", BarbicanWorkerContainerImage),
APIContainerImageURL: util.GetEnvVar("BARBICAN_API_IMAGE_URL_DEFAULT", BarbicanAPIContainerImage),
WorkerContainerImageURL: util.GetEnvVar("BARBICAN_WORKER_IMAGE_URL_DEFAULT", BarbicanWorkerContainerImage),
KeystoneListenerContainerImageURL: util.GetEnvVar("BARBICAN_KEYSTONE_LISTENER_IMAGE_URL_DEFAULT", BarbicanKeystoneListenerContainerImage),
}

SetupBarbicanDefaults(barbicanDefaults)
Expand Down
9 changes: 7 additions & 2 deletions api/v1beta1/barbican_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ import (

// BarbicanDefaults -
type BarbicanDefaults struct {
APIContainerImageURL string
WorkerContainerImageURL string
APIContainerImageURL string
WorkerContainerImageURL string
KeystoneListenerContainerImageURL string
}

var barbicanDefaults BarbicanDefaults
Expand Down Expand Up @@ -73,6 +74,10 @@ func (spec *BarbicanSpec) Default() {
if spec.BarbicanWorker.ContainerImage == "" {
spec.BarbicanWorker.ContainerImage = barbicanDefaults.WorkerContainerImageURL
}

if spec.BarbicanKeystoneListener.ContainerImage == "" {
spec.BarbicanKeystoneListener.ContainerImage = barbicanDefaults.KeystoneListenerContainerImageURL
}
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
Expand Down
85 changes: 85 additions & 0 deletions api/v1beta1/barbicankeystonelistener_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
Copyright 2023.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1

import (
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// BarbicanKeystoneListenerTemplate defines common Spec elements for the KeystoneListener process
type BarbicanKeystoneListenerTemplate struct {
BarbicanComponentTemplate `json:",inline"`

// TODO(dmendiza): Do we need a setting for number of keystone listener processes
// or is replica scaling good enough?
}

// BarbicanKeystoneListenerSpec defines the desired state of BarbicanKeystoneListener
type BarbicanKeystoneListenerSpec struct {
BarbicanTemplate `json:",inline"`

BarbicanKeystoneListenerTemplate `json:",inline"`
DatabaseHostname string `json:"databaseHostname"`

TransportURLSecret string `json:"transportURLSecret,omitempty"`
}

// BarbicanKeystoneListenerStatus defines the observed state of BarbicanKeystoneListener
type BarbicanKeystoneListenerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// ReadyCount of barbican API instances
ReadyCount int32 `json:"readyCount,omitempty"`

// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`

// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

// Barbican Database Hostname
DatabaseHostname string `json:"databaseHostname,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// BarbicanKeystoneListener is the Schema for the barbicankeystonelistener API
type BarbicanKeystoneListener struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec BarbicanKeystoneListenerSpec `json:"spec,omitempty"`
Status BarbicanKeystoneListenerStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// BarbicanKeystoneListenerList contains a list of BarbicanKeystoneListener
type BarbicanKeystoneListenerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BarbicanKeystoneListener `json:"items"`
}

func init() {
SchemeBuilder.Register(&BarbicanKeystoneListener{}, &BarbicanKeystoneListenerList{})
}
8 changes: 8 additions & 0 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const (

// BarbicanWorkerReadyCondition -
BarbicanWorkerReadyCondition condition.Type = "BarbicanWorkerReady"

// BarbicanKeystoneListenerReadyCondition -
BarbicanKeystoneListenerReadyCondition condition.Type = "BarbicanKeystoneListenerReady"

// BarbicanRabbitMQTransportURLReadyCondition -
BarbicanRabbitMQTransportURLReadyCondition condition.Type = "BarbicanRabbitMQTransportURLReady"
)
Expand All @@ -21,6 +25,10 @@ const (
BarbicanWorkerReadyInitMessage = "BarbicanWorker not started"
// BarbicanWorkerReadyErrorMessage -
BarbicanWorkerReadyErrorMessage = "BarbicanWorker error occured %s"
// BarbicanKeystoneListenerReadyInitMessage -
BarbicanKeystoneListenerReadyInitMessage = "BarbicanKeystoneListener not started"
// BarbicanKeystoneListenerReadyErrorMessage -
BarbicanKeystoneListenerReadyErrorMessage = "BarbicanKeystoneListener error occured %s"

// BarbicanRabbitMQTransportURLReadyRunningMessage -
BarbicanRabbitMQTransportURLReadyRunningMessage = "BarbicanRabbitMQTransportURL creation in progress"
Expand Down
137 changes: 137 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

Loading

0 comments on commit ba23837

Please sign in to comment.