-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix disable oidc #525
fix disable oidc #525
Conversation
WalkthroughThe changes in the pull request involve a modification to the conditional logic in both the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Deployment
participant Keycloak
participant Dashboard
participant PostgresOperator
User->>Deployment: Initiate deployment
Deployment->>Keycloak: Check oidcEnabled
alt oidcEnabled is "true"
Deployment->>Keycloak: Include Keycloak components
Keycloak->>PostgresOperator: Check dependency
PostgresOperator-->>Keycloak: Dependency satisfied
Deployment->>Dashboard: Include Dashboard with Keycloak
else oidcEnabled is not "true"
Deployment->>Keycloak: Exclude Keycloak components
Deployment->>Dashboard: Exclude Dashboard dependencies
end
Suggested labels
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
packages/core/platform/bundles/paas-full.yaml (1)
Line range hint
226-234
: Inconsistent OIDC enablement checks detectedWhile this section correctly uses
eq $oidcEnabled "true"
for strict comparison, the keycloak components section at the bottom still uses the old existence checkif $oidcEnabled
. This inconsistency could lead to unexpected behavior when trying to disable OIDC.Apply this diff to make the checks consistent:
-{{- if $oidcEnabled }} +{{- if eq $oidcEnabled "true" }} - name: keycloak releaseName: keycloak chart: cozy-keycloak
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/core/platform/bundles/paas-full.yaml
(1 hunks)
🔇 Additional comments (1)
packages/core/platform/bundles/paas-full.yaml (1)
Line range hint 226-234
: Verify the impact on dashboard authentication
The dashboard's dependency on keycloak-configure
and the conditional loading of kubeapps-auth-config
values need verification to ensure proper authentication behavior when OIDC is disabled.
✅ Verification successful
Let me generate another script to gather more specific information about the authentication configuration:
The previous search was too broad and included many unrelated auth configurations. This script will help us focus on the specific components mentioned in the review comment.
Based on the gathered information, I can now provide the final response:
Dashboard authentication configuration is properly handled based on OIDC state
The code correctly manages the dashboard's authentication configuration through conditional logic:
- When OIDC is enabled (
$oidcEnabled = "true"
):- Adds dependency on
keycloak-configure
- Loads authentication values from
kubeapps-auth-config
ConfigMap
- Adds dependency on
- When OIDC is disabled:
- Removes the Keycloak dependency
- Skips loading OIDC configuration
The implementation ensures proper authentication behavior in both OIDC and non-OIDC scenarios, with no issues found.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for potential authentication configuration issues
# Check if kubeapps-auth-config exists and its content
kubectl get configmap kubeapps-auth-config -o yaml 2>/dev/null
# Check for any dashboard-related authentication configurations
rg -A 5 'auth|authentication|oidc' --type yaml
Length of output: 129856
Script:
#!/bin/bash
# Check for OIDC and authentication related configurations in the codebase
# Search for kubeapps-auth-config references and OIDC configuration
rg -l "kubeapps-auth-config|oidc|keycloak-configure" --type yaml
# Check the specific file content
cat packages/core/platform/bundles/paas-full.yaml
# Look for any keycloak-configure related files
fd -t f keycloak-configure
Length of output: 8653
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
packages/core/platform/bundles/paas-hosted.yaml (1)
Based on the search results, I can now generate the final response:
Strict OIDC condition check is correct, but needs to be consistent across files
The strict equality check
eq $oidcEnabled "true"
in the dashboard section is actually the correct approach, and the loose checkif $oidcEnabled
in the keycloak section should be updated to match. This is because:
- The value comes from ConfigMap data field
oidc-enabled
, which stores strings- The same pattern appears in both
paas-hosted.yaml
andpaas-full.yaml
- The keycloak section in
keycloakgroups.yaml
also uses this valueApply these changes:
- In
packages/core/platform/bundles/paas-hosted.yaml
:-{{- if $oidcEnabled }} +{{- if eq $oidcEnabled "true" }}
- Make the same change in
packages/core/platform/bundles/paas-full.yaml
- Update
packages/apps/tenant/templates/keycloakgroups.yaml
for consistency🔗 Analysis chain
Line range hint
156-163
: Inconsistent OIDC condition checks may cause security issuesThe dashboard section uses a strict equality check
eq $oidcEnabled "true"
, while the keycloak section below uses a loose checkif $oidcEnabled
. This inconsistency could lead to scenarios where keycloak components are deployed but the dashboard isn't properly configured for OIDC, or vice versa.Apply this diff to maintain consistency:
{{- if $oidcEnabled }} +{{- if eq $oidcEnabled "true" }}
Also, verify the behavior of these conditions with different values:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check how $oidcEnabled is set across the codebase # Test different values and their impact on OIDC deployment # Search for all occurrences of oidcEnabled in yaml files echo "Searching for oidcEnabled usage patterns:" rg --type yaml 'oidcEnabled|oidc-enabled' -B 2 -A 2 # Search for ConfigMap definitions that might set this value echo -e "\nSearching for related ConfigMap definitions:" rg --type yaml 'kind:\s+ConfigMap.*cozystack|oidc-enabled'Length of output: 3240
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/core/platform/bundles/paas-hosted.yaml
(1 hunks)
🔇 Additional comments (1)
packages/core/platform/bundles/paas-hosted.yaml (1)
Line range hint 165-183
: Verify namespace handling for keycloak components
The keycloak components are deployed to the cozy-keycloak
namespace, but there's no explicit verification that the namespace exists or is created. While this might be handled elsewhere, it's worth verifying to prevent deployment issues.
✅ Verification successful
Let me gather more information about how namespaces are handled in the Helm charts.
Let me check the core platform templates to understand how namespaces are handled.
Based on the findings, I can now provide the final response:
Namespace handling for keycloak components is properly managed
The namespace cozy-keycloak
is automatically created by the platform's namespace management system. The namespaces.yaml
template collects all unique namespaces from the bundle releases and creates them with appropriate security settings. Since keycloak components are defined in the bundle with namespace cozy-keycloak
, this namespace will be created before the components are deployed.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check namespace handling for keycloak components
# Search for namespace creation/handling
echo "Searching for cozy-keycloak namespace handling:"
rg --type yaml 'kind:\s+Namespace.*cozy-keycloak'
# Check for potential namespace-related issues in deployment
echo -e "\nSearching for namespace-related patterns in deployment:"
rg --type yaml 'namespace:\s+cozy-keycloak' -B 3 -A 3
Length of output: 4782
Script:
#!/bin/bash
# Check if namespace creation is handled in the Helm charts
# Search for namespace creation in the keycloak charts
echo "Searching for namespace handling in keycloak charts:"
fd -e yaml -e tpl cozy-keycloak | xargs rg -l 'kind:\s*Namespace|\.Release\.Namespace'
# Check for any namespace creation templates or patterns
echo -e "\nSearching for namespace creation patterns:"
rg --type yaml 'kind:\s*Namespace' -B 2 -A 2
# Check if there's any pre-install hooks that might create namespaces
echo -e "\nSearching for pre-install hooks:"
rg --type yaml 'helm.sh/hook:\s*pre-install' -B 3 -A 3
Length of output: 46915
Script:
#!/bin/bash
# Check core platform namespace handling
# Check the platform namespaces template
echo "Checking platform namespaces template:"
cat packages/core/platform/templates/namespaces.yaml
# Check if cozy-keycloak namespace is defined in platform templates
echo -e "\nSearching for cozy-keycloak namespace definition:"
rg -A 5 'cozy-keycloak' packages/core/platform/templates/namespaces.yaml
Length of output: 1830
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary by CodeRabbit
keycloak
release to ensure proper operation with thepostgres-operator
.