Skip to content

Commit

Permalink
Remove redis
Browse files Browse the repository at this point in the history
  • Loading branch information
stuggi committed Apr 15, 2024
1 parent f4d5094 commit c102571
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount which
will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down
20 changes: 0 additions & 20 deletions api/bases/octavia.openstack.org_octavias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount
which will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -787,11 +782,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount
which will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -984,11 +974,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount
which will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -1265,11 +1250,6 @@ spec:
ContainerImage)
format: int64
type: integer
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
transportURLSecret:
description: TransportURLSecret - Secret containing RabbitMQ transportURL
type: string
Expand Down
4 changes: 0 additions & 4 deletions api/v1beta1/amphoracontroller_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ type OctaviaAmphoraControllerSpecCore struct {
// AmphoraCustomFlavors - User-defined flavors for Octavia
AmphoraCustomFlavors []OctaviaAmphoraFlavor `json:"amphoraCustomFlavors,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={}
// List of Redis Host IP addresses
RedisHostIPs []string `json:"redisHostIPs,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
// TLS - Parameters related to the TLS
TLS tls.Ca `json:"tls,omitempty"`
Expand Down
3 changes: 0 additions & 3 deletions api/v1beta1/octavia_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ type OctaviaStatus struct {
// ReadyCount of octavia HealthManager instances
OctaviaHealthManagerReadyCount int32 `json:"healthmanagerreadyCount,omitempty"`

// List of Redis Host IP addresses
RedisHostIPs []string `json:"redisHostIPs,omitempty"`

// ObservedGeneration - the most recent generation observed for this
// service. If the observed generation is less than the spec generation,
// then the controller has not processed the latest changes injected by
Expand Down
10 changes: 0 additions & 10 deletions api/v1beta1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount which
will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down
20 changes: 0 additions & 20 deletions config/crd/bases/octavia.openstack.org_octavias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount
which will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -787,11 +782,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount
which will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -984,11 +974,6 @@ spec:
description: PersistenceDatabaseAccount - name of MariaDBAccount
which will be used to connect for the persistence database
type: string
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
resources:
description: Resources - Compute Resources required by this service
(Limits/Requests). https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -1265,11 +1250,6 @@ spec:
ContainerImage)
format: int64
type: integer
redisHostIPs:
description: List of Redis Host IP addresses
items:
type: string
type: array
transportURLSecret:
description: TransportURLSecret - Secret containing RabbitMQ transportURL
type: string
Expand Down
12 changes: 0 additions & 12 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,6 @@ rules:
- list
- update
- watch
- apiGroups:
- redis.openstack.org
resources:
- redises
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- route.openshift.io
resources:
Expand Down
1 change: 0 additions & 1 deletion controllers/amphoracontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ func (r *OctaviaAmphoraControllerReconciler) generateServiceConfigMaps(
}
// TODO(gthiemonge) store keys/passwords/passphrases in a specific config file stored in a secret
templateParameters["HeartbeatKey"] = string(ospSecret.Data["OctaviaHeartbeatKey"])
templateParameters["JobboardBackendHosts"] = strings.Join(spec.RedisHostIPs[:], ",")

// TODO(beagles): populate the template parameters
cms := []util.Template{
Expand Down
61 changes: 0 additions & 61 deletions controllers/octavia_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

"github.com/go-logr/logr"
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
"github.com/openstack-k8s-operators/lib-common/modules/common"
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/deployment"
Expand Down Expand Up @@ -96,7 +95,6 @@ func (r *OctaviaReconciler) GetLogger(ctx context.Context) logr.Logger {
// +kubebuilder:rbac:groups=keystone.openstack.org,resources=keystoneendpoints,verbs=get;list;watch;create;update;patch;delete;
// +kubebuilder:rbac:groups=rabbitmq.openstack.org,resources=transporturls,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch
// +kubebuilder:rbac:groups=redis.openstack.org,resources=redises,verbs=get;list;watch;create;update;patch;delete

// service account, role, rolebinding
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update
Expand Down Expand Up @@ -248,7 +246,6 @@ func (r *OctaviaReconciler) SetupWithManager(mgr ctrl.Manager) error {
Owns(&rbacv1.RoleBinding{}).
Owns(&corev1.Service{}).
Owns(&rabbitmqv1.TransportURL{}).
Owns(&redisv1.Redis{}).
Complete(r)
}

Expand Down Expand Up @@ -476,15 +473,6 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
return rbacResult, nil
}

redis, op, err := r.redisCreateOrUpdate(ctx, instance, helper)
if err != nil {
// TODO(gthiemonge) Set conditions?
return ctrl.Result{}, err
}
if op != controllerutil.OperationResultNone {
Log.Info(fmt.Sprintf("Redis %s successfully reconciled - operation: %s", redis.Name, string(op)))
}

transportURL, op, err := r.transportURLCreateOrUpdate(instance)
if err != nil {
instance.Status.Conditions.Set(condition.FalseCondition(
Expand Down Expand Up @@ -1228,54 +1216,6 @@ func (r *OctaviaReconciler) transportURLCreateOrUpdate(
return transportURL, op, err
}

func getRedisServiceIPs(
ctx context.Context,
instance *octaviav1.Octavia,
helper *helper.Helper,
redis *redisv1.Redis,
) ([]string, error) {
getOptions := metav1.GetOptions{}
service, err := helper.GetKClient().CoreV1().Services(instance.Namespace).Get(ctx, "redis", getOptions)
if err != nil {
return []string{}, err
}
// TODO Ensure that the correct port is exposed
return service.Spec.ClusterIPs, nil
}

func (r *OctaviaReconciler) redisCreateOrUpdate(
ctx context.Context,
instance *octaviav1.Octavia,
helper *helper.Helper,
) (*redisv1.Redis, controllerutil.OperationResult, error) {
redis := &redisv1.Redis{
// Use the "global" redis instance.
ObjectMeta: metav1.ObjectMeta{
Name: "redis",
Namespace: instance.Namespace,
},
}

op, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, redis, func() error {
// We probably don't want to own the redis instance.
//err := controllerutil.SetControllerReference(instance, redis, r.Scheme)
//return err
return nil
})
if err != nil {
return nil, op, err
}

hostIPs, err := getRedisServiceIPs(ctx, instance, helper, redis)
if err != nil {
return redis, op, err
}

instance.Status.RedisHostIPs = hostIPs

return redis, op, err
}

func (r *OctaviaReconciler) amphoraControllerDaemonSetCreateOrUpdate(
instance *octaviav1.Octavia,
networkInfo octavia.NetworkProvisioningSummary,
Expand Down Expand Up @@ -1305,7 +1245,6 @@ func (r *OctaviaReconciler) amphoraControllerDaemonSetCreateOrUpdate(
daemonset.Spec.LbMgmtNetworkID = networkInfo.TenantNetworkID
daemonset.Spec.LbSecurityGroupID = networkInfo.SecurityGroupID
daemonset.Spec.AmphoraCustomFlavors = instance.Spec.AmphoraCustomFlavors
daemonset.Spec.RedisHostIPs = instance.Status.RedisHostIPs
daemonset.Spec.TLS = instance.Spec.OctaviaAPI.TLS.Ca
if len(daemonset.Spec.NodeSelector) == 0 {
daemonset.Spec.NodeSelector = instance.Spec.NodeSelector
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (

networkv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
mariadbv1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1"
ovn1beta1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1"
Expand All @@ -65,7 +64,6 @@ func init() {
utilruntime.Must(octaviav1.AddToScheme(scheme))
utilruntime.Must(ovn1beta1.AddToScheme(scheme))
utilruntime.Must(networkv1.AddToScheme(scheme))
utilruntime.Must(redisv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down
6 changes: 1 addition & 5 deletions templates/octavia/config/octavia.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ amp_boot_network_list=
client_ca=/etc/octavia/certs/ca_01.pem
[task_flow]
persistence_connection = {{ .PersistenceDatabaseConnection }}
jobboard_enabled = True
#jobboard_backend_hosts =
#jobboard_backend_port = 26379
#jobboard_backend_password = ""
#jobboard_redis_sentinel = redis
jobboard_enabled = False
[oslo_messaging]
# topic=octavia-rpc
[oslo_middleware]
Expand Down
7 changes: 1 addition & 6 deletions templates/octaviaamphoracontroller/config/octavia.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ amp_ssh_key_name={{ .NovaSshKeyPair }}
client_ca = /etc/octavia/certs/client_ca.cert.pem
[task_flow]
persistence_connection = {{ .PersistenceDatabaseConnection }}
jobboard_enabled = True
jobboard_backend_hosts = {{ .JobboardBackendHosts }}
# TODO(gthiemonge) enable sentinel when it is exposed in the redis service.
#jobboard_backend_port = 26379
#jobboard_backend_password = ""
#jobboard_redis_sentinel = redis
jobboard_enabled = False
[oslo_messaging]
topic=octavia-rpc
[oslo_middleware]
Expand Down

0 comments on commit c102571

Please sign in to comment.