Skip to content

Commit 869ded0

Browse files
Merge pull request #374 from gthiemonge/redis
Add redis jobboard support
2 parents 61eebca + a3c909f commit 869ded0

17 files changed

+208
-9
lines changed

api/bases/octavia.openstack.org_octaviaamphoracontrollers.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ spec:
168168
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
169169
to connect for the persistence database
170170
type: string
171+
redisHosts:
172+
default: []
173+
description: List of Redis Hosts
174+
items:
175+
type: string
176+
type: array
177+
x-kubernetes-list-type: atomic
171178
resources:
172179
description: |-
173180
Resources - Compute Resources required by this service (Limits/Requests).

api/bases/octavia.openstack.org_octavias.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,13 @@ spec:
668668
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
669669
to connect for the persistence database
670670
type: string
671+
redisHosts:
672+
default: []
673+
description: List of Redis Hosts
674+
items:
675+
type: string
676+
type: array
677+
x-kubernetes-list-type: atomic
671678
resources:
672679
description: |-
673680
Resources - Compute Resources required by this service (Limits/Requests).
@@ -907,6 +914,13 @@ spec:
907914
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
908915
to connect for the persistence database
909916
type: string
917+
redisHosts:
918+
default: []
919+
description: List of Redis Hosts
920+
items:
921+
type: string
922+
type: array
923+
x-kubernetes-list-type: atomic
910924
resources:
911925
description: |-
912926
Resources - Compute Resources required by this service (Limits/Requests).
@@ -1319,6 +1333,13 @@ spec:
13191333
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
13201334
to connect for the persistence database
13211335
type: string
1336+
redisHosts:
1337+
default: []
1338+
description: List of Redis Hosts
1339+
items:
1340+
type: string
1341+
type: array
1342+
x-kubernetes-list-type: atomic
13221343
resources:
13231344
description: |-
13241345
Resources - Compute Resources required by this service (Limits/Requests).
@@ -1473,6 +1494,10 @@ spec:
14731494
RabbitMQ instance name
14741495
Needed to request a transportURL that is created and used in Octavia
14751496
type: string
1497+
redisServiceName:
1498+
default: octavia-redis
1499+
description: Name of the Redis database for Jobboard
1500+
type: string
14761501
resources:
14771502
description: |-
14781503
Resources - Compute Resources required by this service (Limits/Requests).
@@ -1659,6 +1684,12 @@ spec:
16591684
the opentack-operator in the top-level CR (e.g. the ContainerImage)
16601685
format: int64
16611686
type: integer
1687+
redisHosts:
1688+
description: List of Redis Hosts
1689+
items:
1690+
type: string
1691+
type: array
1692+
x-kubernetes-list-type: atomic
16621693
rsyslogreadyCount:
16631694
description: ReadyCount of octavia Rsyslog instances
16641695
format: int32

api/v1beta1/amphoracontroller_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ type OctaviaAmphoraControllerSpecCore struct {
146146
// +kubebuilder:default=""
147147
AmphoraImageOwnerID string `json:"amphoraImageOwnerID,omitempty"`
148148

149+
// +kubebuilder:default={}
150+
// +listType:=atomic
151+
// List of Redis Hosts
152+
RedisHosts []string `json:"redisHosts,omitempty"`
153+
149154
// +operator-sdk:csv:customresourcedefinitions:type=spec
150155
// TLS - Parameters related to the TLS
151156
TLS tls.Ca `json:"tls,omitempty"`

api/v1beta1/octavia_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ type OctaviaSpecBase struct {
227227
// TopologyRef to apply the Topology defined by the associated CR referenced
228228
// by name
229229
TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"`
230+
231+
// +kubebuilder:validation:Optional
232+
// +kubebuilder:default=octavia-redis
233+
// Name of the Redis database for Jobboard
234+
RedisServiceName string `json:"redisServiceName"`
230235
}
231236

232237
// PasswordSelector to identify the DB and AdminUser password from the Secret
@@ -322,6 +327,10 @@ type OctaviaStatus struct {
322327
// ReadyCount of octavia Rsyslog instances
323328
OctaviaRsyslogReadyCount int32 `json:"rsyslogreadyCount,omitempty"`
324329

330+
// List of Redis Hosts
331+
// +listType:=atomic
332+
RedisHosts []string `json:"redisHosts,omitempty"`
333+
325334
// ObservedGeneration - the most recent generation observed for this
326335
// service. If the observed generation is less than the spec generation,
327336
// then the controller has not processed the latest changes injected by

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/octavia.openstack.org_octaviaamphoracontrollers.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ spec:
168168
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
169169
to connect for the persistence database
170170
type: string
171+
redisHosts:
172+
default: []
173+
description: List of Redis Hosts
174+
items:
175+
type: string
176+
type: array
177+
x-kubernetes-list-type: atomic
171178
resources:
172179
description: |-
173180
Resources - Compute Resources required by this service (Limits/Requests).

config/crd/bases/octavia.openstack.org_octavias.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,13 @@ spec:
668668
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
669669
to connect for the persistence database
670670
type: string
671+
redisHosts:
672+
default: []
673+
description: List of Redis Hosts
674+
items:
675+
type: string
676+
type: array
677+
x-kubernetes-list-type: atomic
671678
resources:
672679
description: |-
673680
Resources - Compute Resources required by this service (Limits/Requests).
@@ -907,6 +914,13 @@ spec:
907914
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
908915
to connect for the persistence database
909916
type: string
917+
redisHosts:
918+
default: []
919+
description: List of Redis Hosts
920+
items:
921+
type: string
922+
type: array
923+
x-kubernetes-list-type: atomic
910924
resources:
911925
description: |-
912926
Resources - Compute Resources required by this service (Limits/Requests).
@@ -1319,6 +1333,13 @@ spec:
13191333
PersistenceDatabaseAccount - name of MariaDBAccount which will be used
13201334
to connect for the persistence database
13211335
type: string
1336+
redisHosts:
1337+
default: []
1338+
description: List of Redis Hosts
1339+
items:
1340+
type: string
1341+
type: array
1342+
x-kubernetes-list-type: atomic
13221343
resources:
13231344
description: |-
13241345
Resources - Compute Resources required by this service (Limits/Requests).
@@ -1473,6 +1494,10 @@ spec:
14731494
RabbitMQ instance name
14741495
Needed to request a transportURL that is created and used in Octavia
14751496
type: string
1497+
redisServiceName:
1498+
default: octavia-redis
1499+
description: Name of the Redis database for Jobboard
1500+
type: string
14761501
resources:
14771502
description: |-
14781503
Resources - Compute Resources required by this service (Limits/Requests).
@@ -1659,6 +1684,12 @@ spec:
16591684
the opentack-operator in the top-level CR (e.g. the ContainerImage)
16601685
format: int64
16611686
type: integer
1687+
redisHosts:
1688+
description: List of Redis Hosts
1689+
items:
1690+
type: string
1691+
type: array
1692+
x-kubernetes-list-type: atomic
16621693
rsyslogreadyCount:
16631694
description: ReadyCount of octavia Rsyslog instances
16641695
format: int32

config/rbac/role.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,18 @@ rules:
333333
- patch
334334
- update
335335
- watch
336+
- apiGroups:
337+
- redis.openstack.org
338+
resources:
339+
- redises
340+
verbs:
341+
- create
342+
- delete
343+
- get
344+
- list
345+
- patch
346+
- update
347+
- watch
336348
- apiGroups:
337349
- route.openshift.io
338350
resources:

config/samples/octavia_v1beta1_octavia.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
spec:
66
databaseInstance: openstack
77
databaseAccount: octavia
8+
redisServiceName: octavia-redis
89
persistenceDatabaseAccount: octavia-persistence
910
serviceUser: octavia
1011
rabbitMqClusterName: rabbitmq

controllers/amphoracontroller_controller.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,21 @@ func (r *OctaviaAmphoraControllerReconciler) generateServiceSecrets(
708708
}
709709
templateParameters["HeartbeatKey"] = string(ospSecret.Data["OctaviaHeartbeatKey"])
710710

711+
if len(spec.RedisHosts) > 0 {
712+
templateParameters["JobboardEnable"] = true
713+
templateParameters["JobboardBackendHosts"] = strings.Join(spec.RedisHosts[:], ",")
714+
templateParameters["GracefulShutdownTimeout"] = 25
715+
} else {
716+
templateParameters["JobboardEnable"] = false
717+
templateParameters["JobboardBackendHosts"] = ""
718+
templateParameters["GracefulShutdownTimeout"] = 600
719+
}
720+
if tlsCfg != nil {
721+
templateParameters["JobboardBackendSSLOptions"] = "ssl:true"
722+
} else {
723+
templateParameters["JobboardBackendSSLOptions"] = ""
724+
}
725+
711726
// TODO(beagles): populate the template parameters
712727
cms := []util.Template{
713728
{

0 commit comments

Comments
 (0)