Skip to content

Commit

Permalink
[tlse] memcached tls client config
Browse files Browse the repository at this point in the history
Depends-On: openstack-k8s-operators/infra-operator#192

Jira: OSPRH-5283
  • Loading branch information
stuggi committed Mar 7, 2024
1 parent c2e2433 commit 014e0ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
27 changes: 3 additions & 24 deletions controllers/cinder_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ package controllers
import (
"context"
"fmt"
"strings"
"time"

k8s_errors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -500,7 +498,7 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder
//
// Check for required memcached used for caching
//
memcached, err := r.getCinderMemcached(ctx, helper, instance)
memcached, err := memcachedv1.GetMemcachedByName(ctx, helper, instance.Spec.MemcachedInstance, instance.Namespace)
if err != nil {
if k8s_errors.IsNotFound(err) {
instance.Status.Conditions.Set(condition.FalseCondition(
Expand Down Expand Up @@ -925,7 +923,8 @@ func (r *CinderReconciler) generateServiceConfigs(
string(dbSecret.Data[mariadbv1.DatabasePasswordSelector]),
instance.Status.DatabaseHostname,
cinder.DatabaseName)
templateParameters["MemcachedServersWithInet"] = strings.Join(memcached.Status.ServerListWithInet, ",")
templateParameters["MemcachedServersWithInet"] = memcached.GetMemcachedServerListWithInetString()
templateParameters["MemcachedTLS"] = memcached.GetMemcachedTLSSupport()

// create httpd vhost template parameters
httpdVhostConfig := map[string]interface{}{}
Expand Down Expand Up @@ -1012,26 +1011,6 @@ func (r *CinderReconciler) transportURLCreateOrUpdate(
return transportURL, op, err
}

// getCinderMemcached - gets the Memcached instance used for Cinder cache backend
func (r *CinderReconciler) getCinderMemcached(
ctx context.Context,
h *helper.Helper,
instance *cinderv1beta1.Cinder,
) (*memcachedv1.Memcached, error) {
memcached := &memcachedv1.Memcached{}
err := h.GetClient().Get(
ctx,
types.NamespacedName{
Name: instance.Spec.MemcachedInstance,
Namespace: instance.Namespace,
},
memcached)
if err != nil {
return nil, err
}
return memcached, err
}

func (r *CinderReconciler) apiDeploymentCreateOrUpdate(ctx context.Context, instance *cinderv1beta1.Cinder) (*cinderv1beta1.CinderAPI, controllerutil.OperationResult, error) {
cinderAPISpec := cinderv1beta1.CinderAPISpec{
CinderTemplate: instance.Spec.CinderTemplate,
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ replace github.com/openshift/api => github.com/openshift/api v0.0.0-202304141430
// needed to to cert-manager v1.11.4 see https://github.com/cert-manager/cert-manager/blob/v1.11.4/go.mod#L263C1-L264C104
// remove this once we bump to cert-manager v1.12.x
replace github.com/Venafi/vcert/v4 => github.com/jetstack/vcert/v4 v4.9.6-0.20230519122548-219f317ae107 //allow-merging

replace github.com/openstack-k8s-operators/infra-operator/apis => github.com/stuggi/infra-operator/apis v0.0.0-20240307080001-2c64377dc93a
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4=
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240219072823-a587b364203f h1:suf/08227pC+qQRbsUPLMOSw3mJ82b0o9Hs7MO/g9BY=
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240219072823-a587b364203f/go.mod h1:FGKwlmAIgTsvvz2+uusWqNYFKHNAm4uzVyKao+emeu0=
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240219094943-9bbb46c9afba h1:E/4DVkBwTxAgea7NRtkStoz66cUXZacZmEJlGcr5/0o=
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240219094943-9bbb46c9afba/go.mod h1:YyoDWNxCFstwhVRAcEh2X6bXBG0ML5iEhOYQhltgqi4=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240216173409-86913e6d5885 h1:o7KZaxKt8Dr97ZJIBPW0P482gLyFEURKF89fizcJCBQ=
Expand Down Expand Up @@ -131,6 +129,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stuggi/infra-operator/apis v0.0.0-20240307080001-2c64377dc93a h1:E4tn8kyOQz9EEQ3qi9G+dP5f6Wj8IRzqlKXtk3EUn5k=
github.com/stuggi/infra-operator/apis v0.0.0-20240307080001-2c64377dc93a/go.mod h1:yPqJ+WU8jApuDXNUjpTxMafihuZpX3Yik9ZXqGaxYBQ=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
Expand Down

0 comments on commit 014e0ee

Please sign in to comment.