Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#102 from cschwede/memcached
Browse files Browse the repository at this point in the history
Use memcached instance
  • Loading branch information
openshift-merge-bot[bot] authored Feb 1, 2024
2 parents 678ba24 + 106a63d commit 5cc95b7
Show file tree
Hide file tree
Showing 27 changed files with 170 additions and 94 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ X-Openstack-Request-Id: txbb13222da0d94527a7101-00649551fc
- [ ] Refactor conf file copying, Secret and ConfigMap usage
- [ ] Use Kolla
- [ ] Support Network isolation
- [ ] Use memcached if available within cluster

## License

Expand Down
9 changes: 5 additions & 4 deletions api/bases/swift.openstack.org_swiftproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ spec:
spec:
description: SwiftProxySpec defines the desired state of SwiftProxy
properties:
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
Expand Down Expand Up @@ -267,8 +268,8 @@ spec:
description: Name of Secret containing swift.conf
type: string
required:
- containerImageMemcached
- containerImageProxy
- memcachedServers
- replicas
- secret
- serviceUser
Expand Down
23 changes: 15 additions & 8 deletions api/bases/swift.openstack.org_swifts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ spec:
spec:
description: SwiftSpec defines the desired state of Swift
properties:
memcachedInstance:
default: memcached
description: Memcached instance name.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
Expand All @@ -67,12 +71,13 @@ spec:
description: SwiftProxy - Spec definition for the Proxy service of
this Swift deployment
properties:
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
Expand Down Expand Up @@ -294,8 +299,8 @@ spec:
description: Name of Secret containing swift.conf
type: string
required:
- containerImageMemcached
- containerImageProxy
- memcachedServers
- replicas
- secret
- serviceUser
Expand Down Expand Up @@ -333,15 +338,16 @@ spec:
containerImageContainer:
description: Image URL for Swift container service
type: string
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageObject:
description: Image URL for Swift object service
type: string
containerImageProxy:
description: Image URL for Swift proxy service
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
Expand All @@ -368,15 +374,16 @@ spec:
required:
- containerImageAccount
- containerImageContainer
- containerImageMemcached
- containerImageObject
- containerImageProxy
- memcachedServers
- replicas
- storageClass
- storageRequest
- swiftConfSecret
type: object
required:
- memcachedInstance
- storageClass
- swiftConfSecret
- swiftProxy
Expand Down
9 changes: 5 additions & 4 deletions api/bases/swift.openstack.org_swiftstorages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ spec:
containerImageContainer:
description: Image URL for Swift container service
type: string
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageObject:
description: Image URL for Swift object service
type: string
containerImageProxy:
description: Image URL for Swift proxy service
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
Expand All @@ -89,9 +90,9 @@ spec:
required:
- containerImageAccount
- containerImageContainer
- containerImageMemcached
- containerImageObject
- containerImageProxy
- memcachedServers
- replicas
- storageClass
- storageRequest
Expand Down
7 changes: 5 additions & 2 deletions api/v1beta1/swift_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const (
ContainerImageContainer = "quay.io/podified-antelope-centos9/openstack-swift-container:current-podified"
ContainerImageObject = "quay.io/podified-antelope-centos9/openstack-swift-object:current-podified"
ContainerImageProxy = "quay.io/podified-antelope-centos9/openstack-swift-proxy-server:current-podified"
ContainerImageMemcached = "quay.io/podified-antelope-centos9/openstack-memcached:current-podified"
)

// SwiftSpec defines the desired state of Swift
Expand Down Expand Up @@ -59,6 +58,11 @@ type SwiftSpec struct {
// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`

// +kubebuilder:validation:Required
// +kubebuilder:default=memcached
// Memcached instance name.
MemcachedInstance string `json:"memcachedInstance"`
}

// SwiftStatus defines the observed state of Swift
Expand Down Expand Up @@ -123,7 +127,6 @@ func SetupDefaults() {
ContainerContainerImageURL: util.GetEnvVar("RELATED_IMAGE_SWIFT_CONTAINER_IMAGE_URL_DEFAULT", ContainerImageContainer),
ObjectContainerImageURL: util.GetEnvVar("RELATED_IMAGE_SWIFT_OBJECT_IMAGE_URL_DEFAULT", ContainerImageObject),
ProxyContainerImageURL: util.GetEnvVar("RELATED_IMAGE_SWIFT_PROXY_IMAGE_URL_DEFAULT", ContainerImageProxy),
MemcachedContainerImageURL: util.GetEnvVar("RELATED_IMAGE_SWIFT_MEMCACHED_IMAGE_URL_DEFAULT", ContainerImageMemcached),
}

SetupSwiftDefaults(swiftDefaults)
Expand Down
9 changes: 0 additions & 9 deletions api/v1beta1/swift_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type SwiftDefaults struct {
ContainerContainerImageURL string
ObjectContainerImageURL string
ProxyContainerImageURL string
MemcachedContainerImageURL string
}

var swiftDefaults SwiftDefaults
Expand Down Expand Up @@ -94,18 +93,10 @@ func (spec *SwiftSpec) Default() {
spec.SwiftStorage.ContainerImageProxy = swiftDefaults.ProxyContainerImageURL
}

if spec.SwiftStorage.ContainerImageMemcached == "" {
spec.SwiftStorage.ContainerImageMemcached = swiftDefaults.MemcachedContainerImageURL
}

// proxy
if spec.SwiftProxy.ContainerImageProxy == "" {
spec.SwiftProxy.ContainerImageProxy = swiftDefaults.ProxyContainerImageURL
}

if spec.SwiftProxy.ContainerImageMemcached == "" {
spec.SwiftProxy.ContainerImageMemcached = swiftDefaults.MemcachedContainerImageURL
}
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
Expand Down
10 changes: 5 additions & 5 deletions api/v1beta1/swiftproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ type SwiftProxySpec struct {
// Swift Proxy Container Image URL
ContainerImageProxy string `json:"containerImageProxy"`

// +kubebuilder:validation:Required
// Image URL for Memcache servicd
ContainerImageMemcached string `json:"containerImageMemcached"`

// +kubebuilder:validation:Required
// +kubebuilder:default=swift
// ServiceUser - optional username used for this service to register in Swift
ServiceUser string `json:"serviceUser"`
Expand All @@ -76,6 +71,11 @@ type SwiftProxySpec struct {
// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`

// +kubebuilder:validation:Required
// +kubebuilder:default=""
// List of memcached servers.
MemcachedServers string `json:"memcachedServers"`
}

// ProxyOverrideSpec to override the generated manifest of several child resources.
Expand Down
9 changes: 5 additions & 4 deletions api/v1beta1/swiftstorage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ type SwiftStorageSpec struct {
// Image URL for Swift proxy service
ContainerImageProxy string `json:"containerImageProxy"`

// +kubebuilder:validation:Required
// Image URL for Memcache servicd
ContainerImageMemcached string `json:"containerImageMemcached"`

// +kubebuilder:validation:Required
// +kubebuilder:default=swift-conf
// Name of Secret containing swift.conf
Expand All @@ -69,6 +65,11 @@ type SwiftStorageSpec struct {
// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`

// +kubebuilder:validation:Required
// +kubebuilder:default=""
// List of memcached servers.
MemcachedServers string `json:"memcachedServers"`
}

// SwiftStorageStatus defines the observed state of SwiftStorage
Expand Down
9 changes: 5 additions & 4 deletions config/crd/bases/swift.openstack.org_swiftproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ spec:
spec:
description: SwiftProxySpec defines the desired state of SwiftProxy
properties:
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
Expand Down Expand Up @@ -267,8 +268,8 @@ spec:
description: Name of Secret containing swift.conf
type: string
required:
- containerImageMemcached
- containerImageProxy
- memcachedServers
- replicas
- secret
- serviceUser
Expand Down
23 changes: 15 additions & 8 deletions config/crd/bases/swift.openstack.org_swifts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ spec:
spec:
description: SwiftSpec defines the desired state of Swift
properties:
memcachedInstance:
default: memcached
description: Memcached instance name.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
Expand All @@ -67,12 +71,13 @@ spec:
description: SwiftProxy - Spec definition for the Proxy service of
this Swift deployment
properties:
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageProxy:
description: Swift Proxy Container Image URL
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
Expand Down Expand Up @@ -294,8 +299,8 @@ spec:
description: Name of Secret containing swift.conf
type: string
required:
- containerImageMemcached
- containerImageProxy
- memcachedServers
- replicas
- secret
- serviceUser
Expand Down Expand Up @@ -333,15 +338,16 @@ spec:
containerImageContainer:
description: Image URL for Swift container service
type: string
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageObject:
description: Image URL for Swift object service
type: string
containerImageProxy:
description: Image URL for Swift proxy service
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment
resource names to expose the services to the given network
Expand All @@ -368,15 +374,16 @@ spec:
required:
- containerImageAccount
- containerImageContainer
- containerImageMemcached
- containerImageObject
- containerImageProxy
- memcachedServers
- replicas
- storageClass
- storageRequest
- swiftConfSecret
type: object
required:
- memcachedInstance
- storageClass
- swiftConfSecret
- swiftProxy
Expand Down
9 changes: 5 additions & 4 deletions config/crd/bases/swift.openstack.org_swiftstorages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ spec:
containerImageContainer:
description: Image URL for Swift container service
type: string
containerImageMemcached:
description: Image URL for Memcache servicd
type: string
containerImageObject:
description: Image URL for Swift object service
type: string
containerImageProxy:
description: Image URL for Swift proxy service
type: string
memcachedServers:
default: ""
description: List of memcached servers.
type: string
networkAttachments:
description: NetworkAttachments is a list of NetworkAttachment resource
names to expose the services to the given network
Expand All @@ -89,9 +90,9 @@ spec:
required:
- containerImageAccount
- containerImageContainer
- containerImageMemcached
- containerImageObject
- containerImageProxy
- memcachedServers
- replicas
- storageClass
- storageRequest
Expand Down
2 changes: 0 additions & 2 deletions config/default/manager_default_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ spec:
value: quay.io/podified-antelope-centos9/openstack-swift-container:current-podified
- name: RELATED_IMAGE_SWIFT_OBJECT_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-swift-object:current-podified
- name: RELATED_IMAGE_SWIFT_MEMCACHED_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-memcached:current-podified
8 changes: 8 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ rules:
- patch
- update
- watch
- apiGroups:
- memcached.openstack.org
resources:
- memcacheds
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
Expand Down
Loading

0 comments on commit 5cc95b7

Please sign in to comment.