Skip to content

feat(gitops-backend): Configure TLS MinVersion and Ciphers#1227

Open
akhilnittala wants to merge 3 commits into
redhat-developer:masterfrom
akhilnittala:usr/akhil/GITOPS-10474
Open

feat(gitops-backend): Configure TLS MinVersion and Ciphers#1227
akhilnittala wants to merge 3 commits into
redhat-developer:masterfrom
akhilnittala:usr/akhil/GITOPS-10474

Conversation

@akhilnittala

@akhilnittala akhilnittala commented Jul 21, 2026

Copy link
Copy Markdown
Member

What type of PR is this?
/kind enhancement
What does this PR do / why we need it:

To make gitops backend component complaint with OCP 5.0 goals, making tls minversion and ciphers configurable.

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #?
https://redhat.atlassian.net/browse/GITOPS-10474
Test acceptance criteria:

  • Unit Test
  • E2E Test

How to test changes / Special notes to the reviewer:

deploy gitops operator on ocp cluster, check the apiserver and tls settings accordingly for create and update scenarios.

…nd component

Signed-off-by: akhil nittala <nakhil@redhat.com>
@openshift-ci openshift-ci Bot added the kind/enhancement New feature or request label Jul 21, 2026
@openshift-ci
openshift-ci Bot requested review from anandrkskd and varshab1210 July 21, 2026 06:31
@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign varshab1210 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The controller now receives cluster TLS profile settings and passes supported minimum TLS versions and cipher suites to the GitOps backend Deployment through environment variables.

Changes

TLS backend configuration

Layer / File(s) Summary
TLS configuration wiring
controllers/gitopsservice_controller.go, cmd/main.go
ReconcileGitopsService stores TLS settings, and controller initialization populates them from the cluster security profile.
Backend TLS environment
controllers/gitopsservice_controller.go, controllers/gitopsservice_controller_test.go
Backend deployment creation converts recognized TLS versions, conditionally adds TLS_MIN_VERSION and TLS_CIPHER_SUITES, and tests image and TLS environment configuration.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ClusterSecurityProfile
  participant ReconcileGitopsService
  participant newBackendDeployment
  participant BackendDeployment
  ClusterSecurityProfile->>ReconcileGitopsService: provide MinTLSVersion and Ciphers
  ReconcileGitopsService->>newBackendDeployment: pass TLSMinVersion and TLSCiphers
  newBackendDeployment->>newBackendDeployment: convert TLS version and build environment
  newBackendDeployment->>BackendDeployment: set TLS environment variables
Loading

Suggested reviewers: varshab1210, anandrkskd

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly names the main change: configuring TLS MinVersion and ciphers for the GitOps backend.
Description check ✅ Passed The description is directly related to the change and explains the TLS configurability goal and testing intent.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
controllers/gitopsservice_controller.go (1)

803-814: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Use a switch statement instead of a map.

To avoid allocating a map on every function call, consider using a switch statement. It is more idiomatic and performs better.

♻️ Proposed refactor
 func TLSVersionToBackend(tlsVersion string) string {
-	versionMap := map[string]string{
-		"VersionTLS12": "1.2",
-		"VersionTLS13": "1.3",
-		"VersionTLS11": "1.1",
-		"VersionTLS10": "1",
-	}
-	if v, ok := versionMap[tlsVersion]; ok {
-		return v
-	}
-	return "" // default fallback
+	switch tlsVersion {
+	case "VersionTLS12":
+		return "1.2"
+	case "VersionTLS13":
+		return "1.3"
+	case "VersionTLS11":
+		return "1.1"
+	case "VersionTLS10":
+		return "1"
+	default:
+		return "" // default fallback
+	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/gitopsservice_controller.go` around lines 803 - 814, Update
TLSVersionToBackend to replace the per-call versionMap allocation with a switch
on tlsVersion, returning the existing TLS version strings for VersionTLS10
through VersionTLS13 and preserving the empty-string fallback for unknown
values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@controllers/gitopsservice_controller.go`:
- Around line 803-814: Update TLSVersionToBackend to replace the per-call
versionMap allocation with a switch on tlsVersion, returning the existing TLS
version strings for VersionTLS10 through VersionTLS13 and preserving the
empty-string fallback for unknown values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 21920b77-0290-4a4e-877d-7c69f5b22609

📥 Commits

Reviewing files that changed from the base of the PR and between 8695d85 and 3f8dcc0.

📒 Files selected for processing (2)
  • cmd/main.go
  • controllers/gitopsservice_controller.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • argoproj-labs/argocd-operator (manual)

…nd component

Signed-off-by: akhil nittala <nakhil@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@controllers/gitopsservice_controller_test.go`:
- Around line 113-126: In controllers/gitopsservice_controller_test.go sites
113-126 and 133-146, update both environment-variable loops to remove the early
break statements so TLS_MIN_VERSION and TLS_CIPHER_SUITES are always collected.
Separate the assertions in each test so gotTLSMinVersion is independently
checked against "1.3" and gotTLSCiphers is independently checked against
"dummy1" at 113-126 and "dummy1:dummy2" at 133-146.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 68ef1871-9cc1-442b-9fea-2370e80ce23a

📥 Commits

Reviewing files that changed from the base of the PR and between 3f8dcc0 and 0eaf3c7.

📒 Files selected for processing (1)
  • controllers/gitopsservice_controller_test.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • argoproj-labs/argocd-operator (manual)

Comment on lines +113 to +126
for _, env := range deployment.Spec.Template.Spec.Containers[0].Env {
if env.Name == "TLS_MIN_VERSION" {
gotTLSMinVersion = env.Value
break
}
if env.Name == "TLS_CIPHER_SUITES" {
gotTLSCiphers = env.Value
break
}
}
if gotTLSMinVersion != "1.3" && gotTLSCiphers != "dummy1" {
t.Errorf("TLS Min Version mismatch: got %s, want %s", gotTLSMinVersion, "1.3")
t.Errorf("TLS Cipher mismatch: got %s, want %s", gotTLSCiphers, "dummy1")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Fix flawed test assertions due to early break and && condition.

The break statement inside the loop causes the iteration to exit immediately after finding the first environment variable (TLS_MIN_VERSION), meaning gotTLSCiphers remains empty. Furthermore, using && in the assertion condition hides this bug because the test falsely passes when gotTLSMinVersion is correct, effectively silencing the failure for the missing cipher verification.

  • controllers/gitopsservice_controller_test.go#L113-L126: Remove the break statements from the loop and separate the assertions to check gotTLSMinVersion and gotTLSCiphers independently against "1.3" and "dummy1".
  • controllers/gitopsservice_controller_test.go#L133-L146: Remove the break statements from the loop and separate the assertions to check gotTLSMinVersion and gotTLSCiphers independently against "1.3" and "dummy1:dummy2".
📍 Affects 1 file
  • controllers/gitopsservice_controller_test.go#L113-L126 (this comment)
  • controllers/gitopsservice_controller_test.go#L133-L146
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/gitopsservice_controller_test.go` around lines 113 - 126, In
controllers/gitopsservice_controller_test.go sites 113-126 and 133-146, update
both environment-variable loops to remove the early break statements so
TLS_MIN_VERSION and TLS_CIPHER_SUITES are always collected. Separate the
assertions in each test so gotTLSMinVersion is independently checked against
"1.3" and gotTLSCiphers is independently checked against "dummy1" at 113-126 and
"dummy1:dummy2" at 133-146.

@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown

@akhilnittala: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v4.14-e2e 82a99da link false /test v4.14-e2e
ci/prow/v4.14-kuttl-sequential 82a99da link false /test v4.14-kuttl-sequential
ci/prow/v4.14-kuttl-parallel 82a99da link false /test v4.14-kuttl-parallel
ci/prow/v4.19-kuttl-sequential 82a99da link true /test v4.19-kuttl-sequential
ci/prow/v4.19-kuttl-parallel 82a99da link true /test v4.19-kuttl-parallel

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant