Skip to content

Commit

Permalink
Merge pull request #155 from dprince/core_api
Browse files Browse the repository at this point in the history
Add Swift*SpecCore struct
  • Loading branch information
openshift-merge-bot[bot] authored Mar 4, 2024
2 parents 0199a0c + d1d1a65 commit 52d0be4
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 59 deletions.
23 changes: 23 additions & 0 deletions api/v1beta1/swift_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const (

// SwiftSpec defines the desired state of Swift
type SwiftSpec struct {
SwiftSpecBase `json:",inline"`

// +kubebuilder:validation:Required
// SwiftRing - Spec definition for the Ring service of this Swift deployment
SwiftRing SwiftRingSpec `json:"swiftRing"`
Expand All @@ -43,6 +45,27 @@ type SwiftSpec struct {
// +kubebuilder:validation:Required
// SwiftProxy - Spec definition for the Proxy service of this Swift deployment
SwiftProxy SwiftProxySpec `json:"swiftProxy"`
}

// SwiftSpecCore defines the desired state of Swift (this version is used by OpenStackControlplane)
type SwiftSpecCore struct {
SwiftSpecBase `json:",inline"`

// +kubebuilder:validation:Required
// SwiftRing - Spec definition for the Ring service of this Swift deployment
SwiftRing SwiftRingSpecCore `json:"swiftRing"`

// +kubebuilder:validation:Required
// SwiftStorage - Spec definition for the Storage service of this Swift deployment
SwiftStorage SwiftStorageSpecCore `json:"swiftStorage"`

// +kubebuilder:validation:Required
// SwiftProxy - Spec definition for the Proxy service of this Swift deployment
SwiftProxy SwiftProxySpecCore `json:"swiftProxy"`
}

// SwiftSpecBase -
type SwiftSpecBase struct {

// +kubebuilder:validation:Required
// +kubebuilder:default=swift-conf
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/swift_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func (spec *SwiftSpec) Default() {
}
}

// Default - set defaults for this Swift core spec (this version is used by OpenStackControlplane webhooks)
func (spec *SwiftSpecCore) Default() {
// nothing here yet
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-swift-openstack-org-v1beta1-swift,mutating=false,failurePolicy=fail,sideEffects=None,groups=swift.openstack.org,resources=swifts,verbs=create;update,versions=v1beta1,name=vswift.kb.io,admissionReviewVersions=v1

Expand Down
13 changes: 9 additions & 4 deletions api/v1beta1/swiftproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ type PasswordSelector struct {

// SwiftProxySpec defines the desired state of SwiftProxy
type SwiftProxySpec struct {
SwiftProxySpecCore `json:",inline"`

// +kubebuilder:validation:Required
// Swift Proxy Container Image URL
ContainerImageProxy string `json:"containerImageProxy"`
}

// SwiftProxySpecCore -
type SwiftProxySpecCore struct {
// +kubebuilder:validation:Required
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=0
// Replicas of Swift Proxy
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Required
// Swift Proxy Container Image URL
ContainerImageProxy string `json:"containerImageProxy"`

// +kubebuilder:default=swift
// ServiceUser - optional username used for this service to register in Swift
ServiceUser string `json:"serviceUser"`
Expand Down
15 changes: 10 additions & 5 deletions api/v1beta1/swiftring_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ type SwiftRingSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

SwiftRingSpecCore `json:",inline"`

// +kubebuilder:validation:Required
// Image URL for Swift proxy service
ContainerImage string `json:"containerImage"`
}

// SwiftRingSpec defines the desired state of SwiftRing
type SwiftRingSpecCore struct {

// +kubebuilder:validation:Required
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=1
Expand All @@ -53,10 +63,6 @@ type SwiftRingSpec struct {
// Minimum numbeir of hours to restrict moving a partition more than once
MinPartHours *int64 `json:"minPartHours"`

// +kubebuilder:validation:Required
// Image URL for Swift proxy service
ContainerImage string `json:"containerImage"`

// +kubebuilder:validation:Required
// +kubebuilder:default=swift-conf
// Name of Secret containing swift.conf
Expand Down Expand Up @@ -100,7 +106,6 @@ type SwiftRingList struct {
Items []SwiftRing `json:"items"`
}


type SwiftDisk struct {
Device string `json:"device"`
Path string `json:"path"`
Expand Down
33 changes: 19 additions & 14 deletions api/v1beta1/swiftstorage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,7 @@ import (

// SwiftStorageSpec defines the desired state of SwiftStorage
type SwiftStorageSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=0
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Required
// Name of StorageClass to use for Swift PVs
// +kubebuilder:default=""
StorageClass string `json:"storageClass"`

// +kubebuilder:validation:Required
// +kubebuilder:default="10Gi"
// Minimum size for Swift PVs
StorageRequest string `json:"storageRequest"`
SwiftStorageSpecCore `json:",inline"`

// +kubebuilder:validation:Required
// Image URL for Swift account service
Expand All @@ -56,6 +43,24 @@ type SwiftStorageSpec struct {
// +kubebuilder:validation:Required
// Image URL for Swift proxy service
ContainerImageProxy string `json:"containerImageProxy"`
}

// SwiftStorageSpecCore -
type SwiftStorageSpecCore struct {
// +kubebuilder:validation:Required
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=0
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Required
// Name of StorageClass to use for Swift PVs
// +kubebuilder:default=""
StorageClass string `json:"storageClass"`

// +kubebuilder:validation:Required
// +kubebuilder:default="10Gi"
// Minimum size for Swift PVs
StorageRequest string `json:"storageRequest"`

// +kubebuilder:validation:Required
// +kubebuilder:default=swift-conf
Expand Down
107 changes: 95 additions & 12 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 52d0be4

Please sign in to comment.