-
Notifications
You must be signed in to change notification settings - Fork 28
[Audit log forwarding] - update audit-tls secret to IM deployments for audit forwarding support #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Audit log forwarding] - update audit-tls secret to IM deployments for audit forwarding support #1061
Changes from 5 commits
65f2e31
a4aa178
27ae7e0
4995af4
08ebc79
c5b6d91
26a0204
1d61bf7
6f0ab93
1557b97
6a99b9c
26233d1
e6eb35b
91dafe2
a76590a
f16e9b9
b29c9f2
624a0e6
6e9b29d
e80e1ec
4f28c8f
0219e5c
4e7bb98
c5fcbe0
9fbbcdb
293361b
3ba1075
6081e6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,7 +414,7 @@ func buildAuthServiceContainer(instance *operatorv1alpha1.Authentication, authSe | |
|
||
} | ||
|
||
func buildIdentityProviderContainer(instance *operatorv1alpha1.Authentication, identityProviderImage string, _ string, saasCRNId string) corev1.Container { | ||
func buildIdentityProviderContainer(instance *operatorv1alpha1.Authentication, identityProviderImage string, _ string, saasCRNId string, auditSecretName string) corev1.Container { | ||
rashmi43 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
resources := instance.Spec.IdentityProvider.Resources | ||
if resources == nil { | ||
|
@@ -632,7 +632,7 @@ func buildIdentityProviderContainer(instance *operatorv1alpha1.Authentication, i | |
"LDAP_SEARCH_CACHE_SIZE", "LDAP_SEARCH_CACHE_TIMEOUT", "LDAP_CTX_POOL_INITSIZE", "LDAP_CTX_POOL_MAXSIZE", | ||
"LDAP_CTX_POOL_TIMEOUT", "LDAP_CTX_POOL_WAITTIME", "LDAP_CTX_POOL_PREFERREDSIZE", "LDAP_SEARCH_CACHE_ENABLED", | ||
"LDAP_SEARCH_CACHE_SIZELIMIT", "LDAP_SEARCH_EXCLUDE_WILDCARD_CHARS", "LDAP_SEARCH_SIZE_LIMIT", | ||
"LDAP_SEARCH_TIME_LIMIT", "LDAP_SEARCH_CN_ATTR_ONLY", "LDAP_SEARCH_ID_ATTR_ONLY", | ||
"LDAP_SEARCH_TIME_LIMIT", "LDAP_SEARCH_CN_ATTR_ONLY", "LDAP_SEARCH_ID_ATTR_ONLY", "AUDIT_URL", | ||
"DB_CONNECT_TIMEOUT", "DB_IDLE_TIMEOUT", "DB_CONNECT_MAX_RETRIES", "DB_POOL_MIN_SIZE", "DB_POOL_MAX_SIZE", "DB_SSL_MODE", "SEQL_LOGGING"} | ||
idpEnvVars := buildIdpEnvVars(idpEnvVarList) | ||
|
||
|
@@ -700,29 +700,8 @@ func buildIdentityProviderContainer(instance *operatorv1alpha1.Authentication, i | |
Drop: []corev1.Capability{"ALL"}, | ||
}, | ||
}, | ||
Resources: *resources, | ||
VolumeMounts: []corev1.VolumeMount{ | ||
{ | ||
Name: "auth-key", | ||
MountPath: "/opt/ibm/identity-provider/server/boot/auth-key", | ||
}, | ||
{ | ||
Name: "identity-provider-cert", | ||
MountPath: "/opt/ibm/identity-provider/certs", | ||
}, | ||
{ | ||
Name: "saml-cert", | ||
MountPath: "/certs/saml-certs", | ||
}, | ||
{ | ||
Name: "pgsql-certs", | ||
MountPath: "/certs/pgsql", | ||
}, | ||
{ | ||
Name: "pgsql-client-cred", | ||
MountPath: "/pgsql/clientinfo", | ||
}, | ||
}, | ||
Resources: *resources, | ||
VolumeMounts: buildIdentityProviderVolumeMounts(auditSecretName), | ||
ReadinessProbe: &corev1.Probe{ | ||
ProbeHandler: corev1.ProbeHandler{ | ||
Exec: &corev1.ExecAction{ | ||
|
@@ -752,7 +731,7 @@ func buildIdentityProviderContainer(instance *operatorv1alpha1.Authentication, i | |
|
||
} | ||
|
||
func buildIdentityManagerContainer(instance *operatorv1alpha1.Authentication, identityManagerImage string, _ string) corev1.Container { | ||
func buildIdentityManagerContainer(instance *operatorv1alpha1.Authentication, identityManagerImage string, _ string, auditSecretName string) corev1.Container { | ||
|
||
replicaCount := int(instance.Spec.Replicas) | ||
resources := instance.Spec.IdentityManager.Resources | ||
|
@@ -994,7 +973,7 @@ func buildIdentityManagerContainer(instance *operatorv1alpha1.Authentication, id | |
"ROKS_ENABLED", "ROKS_USER_PREFIX", "IDENTITY_AUTH_DIRECTORY_URL", "OIDC_ISSUER_URL", "BOOTSTRAP_USERID", "CLUSTER_NAME", "HTTP_ONLY", "LDAP_SEARCH_SIZE_LIMIT", "LDAP_SEARCH_TIME_LIMIT", | ||
"LDAP_SEARCH_CN_ATTR_ONLY", "LDAP_SEARCH_ID_ATTR_ONLY", "LDAP_SEARCH_EXCLUDE_WILDCARD_CHARS", "IGNORE_LDAP_FILTERS_VALIDATION", "AUTH_SVC_LDAP_CONFIG_TIMEOUT", | ||
"SCIM_LDAP_SEARCH_SIZE_LIMIT", "SCIM_LDAP_SEARCH_TIME_LIMIT", "SCIM_ASYNC_PARALLEL_LIMIT", "SCIM_GET_DISPLAY_FOR_GROUP_USERS", "ATTR_MAPPING_FROM_CONFIG", "SCIM_AUTH_CACHE_MAX_SIZE", "SCIM_AUTH_CACHE_TTL_VALUE", | ||
"DB_CONNECT_TIMEOUT", "DB_IDLE_TIMEOUT", "DB_CONNECT_MAX_RETRIES", "DB_POOL_MIN_SIZE", "DB_POOL_MAX_SIZE", "DB_SSL_MODE", "SEQL_LOGGING"} | ||
"DB_CONNECT_TIMEOUT", "DB_IDLE_TIMEOUT", "DB_CONNECT_MAX_RETRIES", "DB_POOL_MIN_SIZE", "DB_POOL_MAX_SIZE", "DB_SSL_MODE", "SEQL_LOGGING", "AUDIT_URL"} | ||
|
||
idpEnvVars := buildIdpEnvVars(idpEnvVarList) | ||
|
||
|
@@ -1068,29 +1047,8 @@ func buildIdentityManagerContainer(instance *operatorv1alpha1.Authentication, id | |
Drop: []corev1.Capability{"ALL"}, | ||
}, | ||
}, | ||
Resources: *resources, | ||
VolumeMounts: []corev1.VolumeMount{ | ||
{ | ||
Name: "cluster-ca", | ||
MountPath: "/opt/ibm/identity-mgmt/certs", | ||
}, | ||
{ | ||
Name: "platform-identity-management", | ||
MountPath: "/opt/ibm/identity-mgmt/server/certs", | ||
}, | ||
{ | ||
Name: "scim-ldap-attributes-mapping", | ||
MountPath: "/opt/ibm/identity-mgmt/config/scim-config", | ||
}, | ||
{ | ||
Name: "pgsql-certs", | ||
MountPath: "/certs/pgsql", | ||
}, | ||
{ | ||
Name: "pgsql-client-cred", | ||
MountPath: "/pgsql/clientinfo", | ||
}, | ||
}, | ||
Resources: *resources, | ||
VolumeMounts: buildIdentityManagerVolumeMounts(auditSecretName), | ||
ReadinessProbe: &corev1.Probe{ | ||
ProbeHandler: corev1.ProbeHandler{ | ||
Exec: &corev1.ExecAction{ | ||
|
@@ -1129,16 +1087,16 @@ func buildContainers(instance *operatorv1alpha1.Authentication, authServiceImage | |
return []corev1.Container{authServiceContainer} | ||
} | ||
|
||
func buildManagerContainers(instance *operatorv1alpha1.Authentication, identityManagerImage string, icpConsoleURL string) []corev1.Container { | ||
func buildManagerContainers(instance *operatorv1alpha1.Authentication, identityManagerImage string, icpConsoleURL string, auditSecretName string) []corev1.Container { | ||
rashmi43 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
identityManagerContainer := buildIdentityManagerContainer(instance, identityManagerImage, icpConsoleURL) | ||
identityManagerContainer := buildIdentityManagerContainer(instance, identityManagerImage, icpConsoleURL, auditSecretName) | ||
|
||
return []corev1.Container{identityManagerContainer} | ||
} | ||
|
||
func buildProviderContainers(instance *operatorv1alpha1.Authentication, identityProviderImage string, icpConsoleURL string, saasCrnId string) []corev1.Container { | ||
func buildProviderContainers(instance *operatorv1alpha1.Authentication, identityProviderImage string, icpConsoleURL string, saasCrnId string, auditSecretName string) []corev1.Container { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
identityProviderContainer := buildIdentityProviderContainer(instance, identityProviderImage, icpConsoleURL, saasCrnId) | ||
identityProviderContainer := buildIdentityProviderContainer(instance, identityProviderImage, icpConsoleURL, saasCrnId, auditSecretName) | ||
|
||
return []corev1.Container{identityProviderContainer} | ||
} | ||
|
@@ -1184,3 +1142,83 @@ func buildInitContainerEnvVars(envVarList []string, configmapName string) []core | |
} | ||
return envVars | ||
} | ||
|
||
func buildIdentityManagerVolumeMounts(auditSecretName string) []corev1.VolumeMount { | ||
volumeMounts := []corev1.VolumeMount{ | ||
{ | ||
Name: "cluster-ca", | ||
MountPath: "/opt/ibm/identity-mgmt/certs", | ||
}, | ||
{ | ||
Name: "platform-identity-management", | ||
MountPath: "/opt/ibm/identity-mgmt/server/certs", | ||
}, | ||
{ | ||
Name: "scim-ldap-attributes-mapping", | ||
MountPath: "/opt/ibm/identity-mgmt/config/scim-config", | ||
}, | ||
{ | ||
Name: "pgsql-certs", | ||
MountPath: "/certs/pgsql", | ||
}, | ||
{ | ||
Name: "pgsql-client-cred", | ||
MountPath: "/pgsql/clientinfo", | ||
}, | ||
} | ||
if len(auditSecretName) > 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you change |
||
volumeMounts = EnsureVolumeMountPresent(volumeMounts, GetAuditCertsVolumeMount()) | ||
rashmi43 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
} | ||
|
||
return volumeMounts | ||
} | ||
|
||
func buildIdentityProviderVolumeMounts(auditSecretName string) []corev1.VolumeMount { | ||
volumeMounts := []corev1.VolumeMount{ | ||
{ | ||
Name: "auth-key", | ||
MountPath: "/opt/ibm/identity-provider/server/boot/auth-key", | ||
}, | ||
{ | ||
Name: "identity-provider-cert", | ||
MountPath: "/opt/ibm/identity-provider/certs", | ||
}, | ||
{ | ||
Name: "saml-cert", | ||
MountPath: "/certs/saml-certs", | ||
}, | ||
{ | ||
Name: "pgsql-certs", | ||
MountPath: "/certs/pgsql", | ||
}, | ||
{ | ||
Name: "pgsql-client-cred", | ||
MountPath: "/pgsql/clientinfo", | ||
}, | ||
} | ||
if len(auditSecretName) > 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you change |
||
volumeMounts = EnsureVolumeMountPresent(volumeMounts, GetAuditCertsVolumeMount()) | ||
|
||
} | ||
return volumeMounts | ||
} | ||
|
||
// EnsureVolumeMountPresent checks if a volumeMount exists | ||
// If not, it appends the new volume and returns the updated slice. | ||
func EnsureVolumeMountPresent(volumeMounts []corev1.VolumeMount, newVolMount corev1.VolumeMount) []corev1.VolumeMount { | ||
for _, v := range volumeMounts { | ||
if v.Name == newVolMount.Name { | ||
return volumeMounts // already exists | ||
} | ||
} | ||
return append(volumeMounts, newVolMount) | ||
} | ||
|
||
func GetAuditCertsVolumeMount() corev1.VolumeMount { | ||
rashmi43 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
volMount := corev1.VolumeMount{ | ||
Name: IMAuditTLSVolume, | ||
MountPath: "/certs/audit-tls", | ||
} | ||
return volMount | ||
} |
Uh oh!
There was an error while loading. Please reload this page.