Skip to content

Commit c75f89c

Browse files
committed
consume ldap bindpwd and external edb certs SPCs
1 parent 3d879f7 commit c75f89c

File tree

11 files changed

+382
-164
lines changed

11 files changed

+382
-164
lines changed

bundle/manifests/ibm-iam-operator.clusterserviceversion.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,14 @@ spec:
589589
- patch
590590
- update
591591
- watch
592+
- apiGroups:
593+
- secrets-store.csi.x-k8s.io
594+
resources:
595+
- secretproviderclasses
596+
verbs:
597+
- get
598+
- list
599+
- watch
592600
serviceAccountName: ibm-iam-operator
593601
strategy: deployment
594602
installModes:

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ rules:
258258
- patch
259259
- update
260260
- watch
261+
- apiGroups:
262+
- secrets-store.csi.x-k8s.io
263+
resources:
264+
- secretproviderclasses
265+
verbs:
266+
- get
267+
- list
268+
- watch
261269
---
262270
apiVersion: rbac.authorization.k8s.io/v1
263271
kind: ClusterRole

controllers/common/constants.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ const MongoStatefulsetName string = "icp-mongodb"
3737
// Name of CommonService created by IM Operator to provision EDB share
3838
const DatastoreEDBCSName string = "im-common-service"
3939

40+
// Name of SecretProvoderClass created by Paks that contains ldap bindpassword
41+
const IMLdapBindPwdSpc string = "im-ldap-bind-pwd-spc"
42+
43+
// Name of SecretProvoderClass created by Paks that contains external edb certs
44+
const IMExtEDBSecretSpc string = "im-external-edb-certs-spc"
45+
46+
// Name of volume that holds ldap bindpassword spc
47+
const IMLdapBindPwdVolume string = "ldap-bind-cred-vol"
48+
4049
type DeploymentName string
4150

4251
// The current names of Deployments managed by this Operator

controllers/common/utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
ctrl "sigs.k8s.io/controller-runtime"
3838
"sigs.k8s.io/controller-runtime/pkg/client"
3939
"sigs.k8s.io/controller-runtime/pkg/client/config"
40+
sscsidriverv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
4041

4142
operatorv1alpha1 "github.com/IBM/ibm-iam-operator/apis/operator/v1alpha1"
4243
zenv1 "github.com/IBM/ibm-iam-operator/apis/zen.cpd.ibm.com/v1"
@@ -190,6 +191,11 @@ func ClusterHasZenExtensionGroupVersion(dc *discovery.DiscoveryClient) (found bo
190191
return
191192
}
192193

194+
func ClusterHasCSIGroupVersion(dc *discovery.DiscoveryClient) (found bool) {
195+
found, _ = clusterHasGroupVersion(dc, sscsidriverv1.SchemeGroupVersion)
196+
return
197+
}
198+
193199
func ClusterHasOperandRequestAPIResource(dc *discovery.DiscoveryClient) (found bool) {
194200
found, _ = clusterHasAPIResource(dc, operatorv1alpha1.GroupVersion, "operandrequests")
195201
return

controllers/operator/authentication_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
handler "sigs.k8s.io/controller-runtime/pkg/handler"
4949
"sigs.k8s.io/controller-runtime/pkg/predicate"
5050
"sigs.k8s.io/controller-runtime/pkg/reconcile"
51+
sscsidriverv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
5152

5253
certmgr "github.com/IBM/ibm-iam-operator/apis/certmanager/v1"
5354
operatorv1alpha1 "github.com/IBM/ibm-iam-operator/apis/operator/v1alpha1"
@@ -382,7 +383,8 @@ func (r *AuthenticationReconciler) SetupWithManager(mgr ctrl.Manager) error {
382383
Watches(&corev1.Service{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner())).
383384
Watches(&netv1.Ingress{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner())).
384385
Watches(&appsv1.Deployment{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner())).
385-
Watches(&autoscalingv2.HorizontalPodAutoscaler{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner()))
386+
Watches(&autoscalingv2.HorizontalPodAutoscaler{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner())).
387+
Watches(&sscsidriverv1.SecretProviderClass{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner()))
386388

387389
//Add routes
388390
if ctrlcommon.ClusterHasOpenShiftConfigGroupVerison(&r.DiscoveryClient) {
@@ -397,6 +399,9 @@ func (r *AuthenticationReconciler) SetupWithManager(mgr ctrl.Manager) error {
397399
if ctrlcommon.ClusterHasOperandBindInfoAPIResource(&r.DiscoveryClient) {
398400
authCtrl.Watches(&operatorv1alpha1.OperandBindInfo{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner()))
399401
}
402+
if ctrlcommon.ClusterHasCSIGroupVersion(&r.DiscoveryClient) {
403+
authCtrl.Watches(&sscsidriverv1.SecretProviderClass{}, handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &operatorv1alpha1.Authentication{}, handler.OnlyControllerOwner()))
404+
}
400405

401406
productCMPred := predicate.Funcs{
402407
UpdateFunc: func(e event.UpdateEvent) bool {

0 commit comments

Comments
 (0)