Skip to content

Commit 8a888f7

Browse files
committed
Application Credential support
Signed-off-by: Veronika Fisarova <[email protected]>
1 parent c0eab4b commit 8a888f7

File tree

9 files changed

+222
-19
lines changed

9 files changed

+222
-19
lines changed

api/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ require (
7575

7676
// mschuppert: map to latest commit from release-4.18 tag
7777
// must consistent within modules and service operators
78-
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e //allow-merging
78+
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 //allow-merging
79+
80+
replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/Deydra71/keystone-operator/api v0.0.0-20250922101113-f41006b2859b

config/rbac/role.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ rules:
3434
- get
3535
- list
3636
- watch
37+
- apiGroups:
38+
- ""
39+
resources:
40+
- secrets
41+
verbs:
42+
- get
43+
- list
44+
- watch
3745
- apiGroups:
3846
- ""
3947
resources:
@@ -106,6 +114,14 @@ rules:
106114
- get
107115
- list
108116
- watch
117+
- apiGroups:
118+
- keystone.openstack.org
119+
resources:
120+
- keystoneapplicationcredentials
121+
verbs:
122+
- get
123+
- list
124+
- watch
109125
- apiGroups:
110126
- keystone.openstack.org
111127
resources:

controllers/swift_common.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ import (
2828
"k8s.io/apimachinery/pkg/types"
2929

3030
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
31+
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
3132
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
33+
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
34+
"github.com/openstack-k8s-operators/lib-common/modules/common/secret"
35+
3236
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
37+
"k8s.io/apimachinery/pkg/types"
3338
ctrl "sigs.k8s.io/controller-runtime"
3439
"sigs.k8s.io/controller-runtime/pkg/client"
3540
"sigs.k8s.io/controller-runtime/pkg/log"

controllers/swift_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ func (r *SwiftReconciler) GetLogger(ctx context.Context) logr.Logger {
5959
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts,verbs=get;list;watch;create;update;patch;delete
6060
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts/status,verbs=get;update;patch
6161
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts/finalizers,verbs=update;patch
62+
//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
63+
//+kubebuilder:rbac:groups=keystone.openstack.org,resources=keystoneapplicationcredentials,verbs=get;list;watch
6264

6365
// service account, role, rolebinding
6466
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch

controllers/swiftproxy_controller.go

Lines changed: 154 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
appsv1 "k8s.io/api/apps/v1"
4040
corev1 "k8s.io/api/core/v1"
4141
apierrors "k8s.io/apimachinery/pkg/api/errors"
42+
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
4243
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4344
ctrl "sigs.k8s.io/controller-runtime"
4445

@@ -510,6 +511,19 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
510511
return ctrlResult, err
511512
}
512513

514+
// Check for Application Credentials
515+
ctrlResult, err = r.verifyApplicationCredentials(
516+
ctx,
517+
r.GetLogger(ctx),
518+
helper.GetClient(),
519+
instance.Namespace,
520+
"swift",
521+
&envVars,
522+
)
523+
if (err != nil || ctrlResult != ctrl.Result{}) {
524+
return ctrlResult, err
525+
}
526+
513527
// Get the service password and pass it to the template
514528
sps, _, err := secret.GetSecret(ctx, helper, instance.Spec.Secret, instance.Namespace)
515529
if err != nil {
@@ -569,6 +583,20 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
569583
return ctrl.Result{}, err
570584
}
571585

586+
// Get Application Credential data if available
587+
useAC := false
588+
acID := ""
589+
acSecret := ""
590+
// Try to get Application Credential for this service (via keystone api helper)
591+
if acData, err := keystonev1.GetApplicationCredentialFromSecret(ctx, r.Client, instance.Namespace, swift.ServiceName); err != nil {
592+
Log.Error(err, "Failed to get ApplicationCredential for service", "service", swift.ServiceName)
593+
} else if acData != nil {
594+
useAC = true
595+
acID = acData.ID
596+
acSecret = acData.Secret
597+
Log.Info("Using ApplicationCredentials auth", "service", swift.ServiceName)
598+
}
599+
572600
// Create a Secret populated with content from templates/
573601
tpl := swiftproxy.SecretTemplates(
574602
instance,
@@ -581,7 +609,13 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
581609
secretRef,
582610
os.GetRegion(),
583611
transportURLString,
612+
<<<<<<< HEAD
584613
instance.Spec.APITimeout,
614+
=======
615+
useAC,
616+
acID,
617+
acSecret,
618+
>>>>>>> d1ed12b (Application Credential support)
585619
)
586620
err = secret.EnsureSecrets(ctx, helper, instance, tpl, &envVars)
587621
if err != nil {
@@ -835,7 +869,43 @@ func (r *SwiftProxyReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
835869
return nil
836870
}
837871

838-
return ctrl.NewControllerManagedBy(mgr).
872+
// Application Credential secret watching function
873+
acSecretFn := func(_ context.Context, o client.Object) []reconcile.Request {
874+
name := o.GetName()
875+
ns := o.GetNamespace()
876+
result := []reconcile.Request{}
877+
878+
// Only handle Secret objects
879+
if _, isSecret := o.(*corev1.Secret); !isSecret {
880+
return nil
881+
}
882+
883+
// Check if this is a swift AC secret by name pattern (ac-swift-secret)
884+
expectedSecretName := keystonev1.GetACSecretName("swift")
885+
if name == expectedSecretName {
886+
// get all SwiftProxy CRs in this namespace
887+
swiftProxies := &swiftv1beta1.SwiftProxyList{}
888+
listOpts := []client.ListOption{
889+
client.InNamespace(ns),
890+
}
891+
if err := r.Client.List(context.Background(), swiftProxies, listOpts...); err != nil {
892+
return nil
893+
}
894+
895+
// Enqueue reconcile for all swift proxy instances
896+
for _, cr := range swiftProxies.Items {
897+
objKey := client.ObjectKey{
898+
Namespace: ns,
899+
Name: cr.Name,
900+
}
901+
result = append(result, reconcile.Request{NamespacedName: objKey})
902+
}
903+
}
904+
905+
return result
906+
}
907+
908+
b := ctrl.NewControllerManagedBy(mgr).
839909
For(&swiftv1beta1.SwiftProxy{}).
840910
Owns(&corev1.Secret{}).
841911
Owns(&keystonev1.KeystoneService{}).
@@ -848,15 +918,17 @@ func (r *SwiftProxyReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
848918
handler.EnqueueRequestsFromMapFunc(r.findObjectsForSrc),
849919
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
850920
).
921+
Watches(&corev1.Secret{},
922+
handler.EnqueueRequestsFromMapFunc(acSecretFn)).
851923
Watches(&memcachedv1.Memcached{},
852924
handler.EnqueueRequestsFromMapFunc(memcachedFn)).
853925
Watches(&topologyv1.Topology{},
854926
handler.EnqueueRequestsFromMapFunc(r.findObjectsForSrc),
855927
builder.WithPredicates(predicate.GenerationChangedPredicate{})).
856928
Watches(&keystonev1.KeystoneAPI{},
857929
handler.EnqueueRequestsFromMapFunc(r.findObjectForSrc),
858-
builder.WithPredicates(keystonev1.KeystoneAPIStatusChangedPredicate)).
859-
Complete(r)
930+
builder.WithPredicates(keystonev1.KeystoneAPIStatusChangedPredicate))
931+
return b.Complete(r)
860932
}
861933

862934
func (r *SwiftProxyReconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request {
@@ -1020,3 +1092,82 @@ func (r *SwiftProxyReconciler) transportURLCreateOrUpdate(
10201092

10211093
return transportURL, op, err
10221094
}
1095+
1096+
// verifyApplicationCredentials handles Application Credentials validation
1097+
// It only uses AC if it's in a complete/ready state, otherwise continues with password auth
1098+
func (r *SwiftProxyReconciler) verifyApplicationCredentials(
1099+
ctx context.Context,
1100+
log logr.Logger,
1101+
client client.Client,
1102+
namespace string,
1103+
serviceName string,
1104+
configVars *map[string]env.Setter,
1105+
) (ctrl.Result, error) {
1106+
// Check for Application Credential - only use it if it's fully ready
1107+
acName := fmt.Sprintf("ac-%s", serviceName)
1108+
ac := &keystonev1.KeystoneApplicationCredential{}
1109+
1110+
if err := client.Get(ctx, types.NamespacedName{Namespace: namespace, Name: acName}, ac); err == nil {
1111+
// AC CR exists - check if it's in ready state
1112+
if r.isACReady(ctx, log, client, ac) {
1113+
// AC is ready - add it to configVars for hash tracking
1114+
secretKey := types.NamespacedName{Namespace: namespace, Name: ac.Status.SecretName}
1115+
hash, res, err := secret.VerifySecret(
1116+
ctx,
1117+
secretKey,
1118+
[]string{"AC_ID", "AC_SECRET"},
1119+
client,
1120+
10*time.Second,
1121+
)
1122+
if err != nil {
1123+
log.Info("ApplicationCredential secret verification failed, continuing with password auth", "error", err.Error())
1124+
} else if res.RequeueAfter > 0 {
1125+
return res, nil
1126+
} else {
1127+
// AC is ready and verified - add to configVars for change tracking
1128+
(*configVars)["secret-"+ac.Status.SecretName] = env.SetValue(hash)
1129+
log.Info("Using ApplicationCredential authentication")
1130+
}
1131+
} else {
1132+
// AC exists but not ready - wait for it
1133+
log.Info("ApplicationCredential exists but not ready, waiting")
1134+
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
1135+
}
1136+
} else if !k8s_errors.IsNotFound(err) {
1137+
return ctrl.Result{}, err
1138+
}
1139+
1140+
return ctrl.Result{}, nil
1141+
}
1142+
1143+
// isACReady checks if ApplicationCredential is in a ready state with all required components
1144+
func (r *SwiftProxyReconciler) isACReady(ctx context.Context, log logr.Logger, client client.Client, ac *keystonev1.KeystoneApplicationCredential) bool {
1145+
// Check if AC has completed setup (secret name is populated)
1146+
if ac.Status.SecretName == "" {
1147+
log.V(1).Info("AC not ready: SecretName not populated", "ac", ac.Name)
1148+
return false
1149+
}
1150+
1151+
secret := &corev1.Secret{}
1152+
secretKey := types.NamespacedName{Namespace: ac.Namespace, Name: ac.Status.SecretName}
1153+
if err := client.Get(ctx, secretKey, secret); err != nil {
1154+
log.V(1).Info("AC not ready: Secret not found", "secret", secretKey, "error", err)
1155+
return false
1156+
}
1157+
1158+
acID, acIDExists := secret.Data["AC_ID"]
1159+
acSecret, acSecretExists := secret.Data["AC_SECRET"]
1160+
1161+
if !acIDExists || !acSecretExists {
1162+
log.V(1).Info("AC not ready: Missing required fields", "secret", secretKey)
1163+
return false
1164+
}
1165+
1166+
if len(acID) == 0 || len(acSecret) == 0 {
1167+
log.V(1).Info("AC not ready: Empty required fields", "secret", secretKey)
1168+
return false
1169+
}
1170+
1171+
log.V(1).Info("AC is ready", "secret", secretKey)
1172+
return true
1173+
}

go.mod

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ require (
88
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.7.7
99
github.com/onsi/ginkgo/v2 v2.20.1
1010
github.com/onsi/gomega v1.34.1
11-
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20250922094404-abaedfb5fe2d
11+
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20250804160755-893ae5639aec
1212
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250922155301-057562fb7182
13-
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250916093250-82a76386143d
14-
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20250922082314-c83d83092a04
13+
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250802061907-896a24e4fc36
14+
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20250730071847-837b07f8d72f
1515
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250922082314-c83d83092a04
16-
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250922082314-c83d83092a04
16+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250823121217-7e1cd2e3dd03
1717
github.com/openstack-k8s-operators/swift-operator/api v0.3.1-0.20240523121736-379011b2cfac
1818
k8s.io/api v0.31.12
1919
k8s.io/apimachinery v0.31.12
@@ -51,7 +51,7 @@ require (
5151
github.com/modern-go/reflect2 v1.0.2 // indirect
5252
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5353
github.com/openshift/api v3.9.0+incompatible // indirect
54-
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250922082314-c83d83092a04 // indirect
54+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250823121217-7e1cd2e3dd03 // indirect
5555
github.com/pkg/errors v0.9.1 // indirect
5656
github.com/prometheus/client_golang v1.19.1 // indirect
5757
github.com/prometheus/client_model v0.6.1 // indirect
@@ -91,3 +91,5 @@ replace github.com/openshift/api => github.com/openshift/api v0.0.0-202507112000
9191

9292
// custom RabbitmqClusterSpecCore for OpenStackControlplane (v2.6.0_patches_tag)
9393
replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250717122149-12f70b7f3d8d //allow-merging
94+
95+
replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/Deydra71/keystone-operator/api v0.0.0-20250922101113-f41006b2859b

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/Deydra71/keystone-operator/api v0.0.0-20250922101113-f41006b2859b h1:PqXvGTQAwst+hmWDUod6yClfK3pgGVHBDYObjIQldKU=
2+
github.com/Deydra71/keystone-operator/api v0.0.0-20250922101113-f41006b2859b/go.mod h1:7ZuNZNtwRYklS2H5E5YSjsHOI2sYbAl1AD+N0W/G+8A=
13
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
24
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
35
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -77,20 +79,18 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
7779
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
7880
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyUt0GEdoAE+r5TXy7YS21yNEo+2U=
7981
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
80-
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20250922094404-abaedfb5fe2d h1:3YV9Js9Gf4lsbYD8D66WVlwlxjrcZ2qmrdEXUE3703Q=
81-
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20250922094404-abaedfb5fe2d/go.mod h1:t1OgOfbkr5e0GnYb/8DVF7ipTBvnkTiaajshsX/lEGc=
82+
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20250804160755-893ae5639aec h1:/It+6NDGWlnVmtWyFRuTTz30lZ9F36fULFzUlTccIHg=
83+
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20250804160755-893ae5639aec/go.mod h1:Yns9+BfjPFaHNdDgSH1hmCYGl3V6/HTBHlKS9K82Js8=
8284
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250922155301-057562fb7182 h1:Ea+FZQOW0Eha1jorgSECFeqI9UrKz8TZlGnSM7X8Yf4=
8385
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250922155301-057562fb7182/go.mod h1:3Im8PFiRKPaOZpOuqYShJRN2O2pfjUuhDTUpW4KMHZw=
84-
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250916093250-82a76386143d h1:lSRMftk/MbN4qd8ihHh9ucdX4sfR/HUudEcy2h/BNhQ=
85-
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250916093250-82a76386143d/go.mod h1:7ZuNZNtwRYklS2H5E5YSjsHOI2sYbAl1AD+N0W/G+8A=
86-
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20250922082314-c83d83092a04 h1:LJ8HkJVBvsO5sQSN+2u12wVE97KSrRpdVwc35LHGWJg=
87-
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20250922082314-c83d83092a04/go.mod h1:/t8UOevAIOdAu7SAkfwfyZj6p2pkuupl3mZJPMNqNOo=
86+
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20250730071847-837b07f8d72f h1:7w9WseH9LSKnLX3UW1AfWPaozN7fimdVoUtOYHnsQKY=
87+
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20250730071847-837b07f8d72f/go.mod h1:0bajRHochTUT6Ecfriw27l3vL0yezVrnUmt3bcIpu4w=
8888
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250922082314-c83d83092a04 h1:JqJd39rF8rD9KIHmOEFbHP8UyYgttfuouj+kAFNtymU=
8989
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250922082314-c83d83092a04/go.mod h1:SmKRclrynSSRCXSLOoWlETalJPvt62ObHsfW8iPvtDA=
90-
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250922082314-c83d83092a04 h1:1t4qZshLvaTzytFb9foCBtTtKT4uXzYtVaYTlgYbt+4=
91-
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250922082314-c83d83092a04/go.mod h1:IO6+EHBk1Ttd4L8mfnMtG58cc36tDyvdxzCytn+hKeE=
92-
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250922082314-c83d83092a04 h1:j5P/ehO4bQ+VqNvqNiX7N/R8wnBweFy7MX685nh4mmY=
93-
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250922082314-c83d83092a04/go.mod h1:WbDAhyvX2UTyK9LzYZKjRvEGdn2fsQJHUo5l2J5q/vg=
90+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250823121217-7e1cd2e3dd03 h1:tSMLVApQ4j4YJ56TGIYzaNo2Zh/ruDAY0wCcOEVKoIQ=
91+
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250823121217-7e1cd2e3dd03/go.mod h1:nachFP0Yicw/e8ZlqZzvnBN6w9kjMcnqrhaDw36PGjw=
92+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250823121217-7e1cd2e3dd03 h1:DrKbzsweRx8VBNb5ur+/XcHSi+MR3VdzCsIEXYGc5SM=
93+
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250823121217-7e1cd2e3dd03/go.mod h1:U3LQ4Nz2+syTPfW66bSLv6OzefLpsqxWLdX9AFotRPA=
9494
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250717122149-12f70b7f3d8d h1:0KCWljk2IEJ+aWNK+RiGpIdu51KPXrYA5RfyUcV4Mb4=
9595
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250717122149-12f70b7f3d8d/go.mod h1:6Mq2N/KtNFW20L+PQC5qkeK8R8UGadmGBXL8HDY6lcg=
9696
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

pkg/swiftproxy/templates.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ func SecretTemplates(
3939
secretRef string,
4040
keystoneRegion string,
4141
transportURL string,
42+
<<<<<<< HEAD
4243
apiTimeout int,
44+
=======
45+
useApplicationCredentials bool,
46+
applicationCredentialID string,
47+
applicationCredentialSecret string,
48+
>>>>>>> d1ed12b (Application Credential support)
4349
) []util.Template {
4450
templateParameters := make(map[string]any)
4551
templateParameters["ServiceUser"] = instance.Spec.ServiceUser
@@ -54,6 +60,13 @@ func SecretTemplates(
5460
templateParameters["TransportURL"] = transportURL
5561
templateParameters["APITimeout"] = apiTimeout
5662

63+
// Application Credential parameters
64+
templateParameters["UseApplicationCredentials"] = useApplicationCredentials
65+
if useApplicationCredentials {
66+
templateParameters["ApplicationCredentialID"] = applicationCredentialID
67+
templateParameters["ApplicationCredentialSecret"] = applicationCredentialSecret
68+
}
69+
5770
// MTLS params
5871
if mc.Status.MTLSCert != "" {
5972
templateParameters["MemcachedAuthCert"] = fmt.Sprint(memcachedv1.CertMountPath())

0 commit comments

Comments
 (0)