Skip to content

[Feature] Centralize DBaaS operator configuration with nil-go/konf - #245

Merged
gnudeep merged 3 commits into
wso2:operatorsfrom
Yohansenanayake:fix/config-mgmt
Jul 29, 2026
Merged

[Feature] Centralize DBaaS operator configuration with nil-go/konf#245
gnudeep merged 3 commits into
wso2:operatorsfrom
Yohansenanayake:fix/config-mgmt

Conversation

@Yohansenanayake

@Yohansenanayake Yohansenanayake commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Centralizes application-level operator configuration in a typed, validated hierarchy using nil-go/konf.

The default installation continues to work without a configuration ConfigMap, while an optional Kustomize overlay provides centralized file configuration at /etc/dbaas/config.json.

Closes #244 .

Related: Discussion #240.

Changes

  • Added typed configuration, built-in defaults, validation, and tests.
  • Added source precedence: built-in defaults < configuration file < environment variables < explicit flags.
  • Added canonical dotted flags and DBAAS_ environment-variable mapping.
  • Added an optional ConfigMap-backed Kustomize overlay using the fixed /etc/dbaas/config.json path.
  • Kept the default installation independent of a configuration ConfigMap.
  • Centralized database and infrastructure defaults and removed duplicated runtime fallbacks.
  • Added a namespace-neutral shared Kustomize base.
  • Preserved one-command default installation with automatic creation of dbaas-system.
  • Made custom installation namespaces a Kustomize concern and derived the runtime namespace from Pod metadata through POD_NAMESPACE.
  • Removed operator.namespace from runtime configuration to prevent deployment and runtime namespace drift.
  • Documented precedence, installation flows, restart requirements, and the planned Helm-compatible namespace model.

Testing

  • go test ./...
  • bin/kustomize build config/base
  • bin/kustomize build config/default
  • bin/kustomize build config/overlays/operator-config
  • Verified a custom render places all namespaced resources in
    dbaas-system-v2.
  • git diff --check

All checks passed.

Checklist

  • Tests / validation for the changed area pass
  • Docs updated if behaviour or interfaces changed
  • No secrets, tokens, or kubeconfigs committed
  • No internal or other-repository names, private hostnames, or environment names included

Summary by CodeRabbit

  • New Features
    • Added centralized operator configuration through JSON files, environment variables, and command-line flags.
    • Added configurable database defaults, instance classes, monitoring settings, logging, metrics, and gateway behavior.
    • Added optional Kubernetes configuration overlay and secure metrics exposure.
    • Gateway operations now consistently target the configured installation namespace.
  • Bug Fixes
    • Improved validation and error reporting for invalid configuration, storage settings, namespaces, and database defaults.
    • Configured monitoring labels and scrape intervals are now applied consistently.
  • Documentation
    • Documented configuration precedence, supported formats, deployment instructions, and restart requirements.

- add typed configuration hierarchy, defaults, and validation
- support file, environment, and explicit flag precedence
- add optional ConfigMap-backed Kustomize overlay
- keep the default deployment independent of a ConfigMap
- centralize database defaults and remove duplicated fallbacks
- wire resolved configuration into controllers and dependencies
- add configuration and precedence tests
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The operator now uses typed, validated configuration loaded from defaults, JSON, environment variables, and explicit flags. Startup, Kubernetes manifests, reconciliation defaults, monitoring, gateway namespace handling, and Harvester storage validation are wired to the centralized configuration.

Changes

Operator configuration

Layer / File(s) Summary
Configuration schema, loading, and validation
database/internal/config/*, database/go.mod
Adds typed configuration structures, defaults, precedence handling, environment and flag mapping, namespace resolution, validation, and tests.
Startup wiring and Kubernetes installation
database/cmd/main.go, database/config/*, database/README.md
Uses configuration for manager startup, logging, TLS, metrics, gateway enablement, and leader election; adds default and optional Kustomize installation manifests.
Configurable reconciliation defaults and monitoring
database/internal/controller/*, database/internal/ensure/*, database/internal/credentials/*, database/internal/resource/*
Propagates database defaults, instance classes, monitoring settings, credentials defaults, ports, ServiceMonitor labels, and scrape intervals through reconciliation.
Namespace-scoped gateway operations
database/internal/gateway/*
Routes all DBInstance operations through the configured namespace and tests that request-body namespaces are overridden.
Harvester storage-class validation
database/internal/harvester/*
Rejects empty data-volume storage classes and removes the hardcoded PVC storage-class fallback.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Pod
  participant ConfigLoader
  participant ControllerManager
  participant DBInstanceReconciler
  participant KubernetesAPI
  Pod->>ConfigLoader: load defaults, file, environment, and flags
  ConfigLoader-->>Pod: validated Config and PodNamespace
  Pod->>ControllerManager: start configured manager and servers
  ControllerManager->>DBInstanceReconciler: provide defaults and monitoring settings
  DBInstanceReconciler->>KubernetesAPI: reconcile DBInstance resources
Loading

Possibly related PRs

Suggested labels: Type/Improvement, Area/Operators

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the linked issue goals: typed config, precedence, optional overlay, namespace handling, and restart-only config updates.
Out of Scope Changes check ✅ Passed No clearly unrelated code changes stand out; the added manifests, config, and runtime updates all support the configuration centralization work.
Title check ✅ Passed The title is concise, specific, and accurately describes the main change to centralize operator configuration.
Description check ✅ Passed The description includes all required sections, clear change and testing details, and a completed checklist.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Yohansenanayake Yohansenanayake changed the title Centralize DBaaS operator configuration with nil-go/konf [Feature] Centralize DBaaS operator configuration with nil-go/konf Jul 28, 2026

@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: 4

🧹 Nitpick comments (1)
database/internal/ensure/defaults_test.go (1)

48-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for a non-default configuration.

All updated cases pass built-in defaults, so they cannot detect immutableDriftWithDefaults ignoring its supplied configuration. Add a case with custom database defaults and omitted spec fields that match AppliedSpec.

Also applies to: 74-76, 96-98, 122-124, 150-152

🤖 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 `@database/internal/ensure/defaults_test.go` around lines 48 - 50, Add test
cases covering custom database defaults passed to immutableDriftWithDefaults,
with omitted spec fields matching the corresponding AppliedSpec values and no
reported drift. Update the related cases at the referenced assertions to use the
custom configuration rather than only operatorconfig.Default().DatabaseDefaults,
while preserving existing default-configuration coverage.
🤖 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 `@database/config/base/cert_metrics_manager_patch.yaml`:
- Around line 11-14: Replace the stale --metrics-cert-path argument in the
metrics server container args with the registered observability.metrics.tls.*
flag for the mounted certificate directory, preserving the existing
/tmp/k8s-metrics-server/metrics-certs path.

In `@database/config/overlays/operator-config/kustomization.yaml`:
- Around line 8-11: Update the dbaas-controller image entry in
kustomization.yaml to use an already-published immutable tag dated no later than
July 28, 2026, replacing dev-b658cf2-202607290025. Keep the existing image
repository unchanged.

In `@database/internal/config/validate.go`:
- Around line 37-39: Update the validateBindAddress call for
server.health.bindAddress in config validation to allow the "0" disable sentinel
by enabling the corresponding acceptance flag. Preserve the existing validation
and error propagation for all other bind-address values.

In `@database/internal/controller/controller_test_helpers_test.go`:
- Around line 49-54: Update resetEnsureRunner to pass the configured
DatabaseDefaults, InstanceClasses, and Monitoring dependencies from the runner
into ensure.Dependencies, matching production wiring and avoiding fallback
values in controller tests.

---

Nitpick comments:
In `@database/internal/ensure/defaults_test.go`:
- Around line 48-50: Add test cases covering custom database defaults passed to
immutableDriftWithDefaults, with omitted spec fields matching the corresponding
AppliedSpec values and no reported drift. Update the related cases at the
referenced assertions to use the custom configuration rather than only
operatorconfig.Default().DatabaseDefaults, while preserving existing
default-configuration coverage.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cf9de88-99b6-4c68-abc6-66cb539b4bd3

📥 Commits

Reviewing files that changed from the base of the PR and between 67f2f46 and a3f3513.

⛔ Files ignored due to path filters (1)
  • database/go.sum is excluded by !**/*.sum
📒 Files selected for processing (42)
  • database/README.md
  • database/cmd/main.go
  • database/config/base/cert_metrics_manager_patch.yaml
  • database/config/base/kustomization.yaml
  • database/config/base/metrics_service.yaml
  • database/config/default/kustomization.yaml
  • database/config/default/manager_metrics_patch.yaml
  • database/config/default/namespace.yaml
  • database/config/manager/manager.yaml
  • database/config/overlays/operator-config/kustomization.yaml
  • database/config/overlays/operator-config/manager_config_patch.yaml
  • database/config/overlays/operator-config/operator_config.yaml
  • database/go.mod
  • database/internal/config/defaults.go
  • database/internal/config/flags.go
  • database/internal/config/load.go
  • database/internal/config/load_test.go
  • database/internal/config/namespace.go
  • database/internal/config/namespace_test.go
  • database/internal/config/types.go
  • database/internal/config/validate.go
  • database/internal/config/validate_test.go
  • database/internal/controller/controller_test_helpers_test.go
  • database/internal/controller/dbinstance_controller.go
  • database/internal/credentials/resolver.go
  • database/internal/credentials/resolver_test.go
  • database/internal/ensure/defaults.go
  • database/internal/ensure/defaults_test.go
  • database/internal/ensure/dependencies.go
  • database/internal/ensure/health.go
  • database/internal/ensure/monitoring.go
  • database/internal/ensure/preflight.go
  • database/internal/ensure/preflight_test.go
  • database/internal/ensure/resize.go
  • database/internal/ensure/steps_test_helpers_test.go
  • database/internal/ensure/vm.go
  • database/internal/gateway/gateway.go
  • database/internal/gateway/gateway_test.go
  • database/internal/harvester/typed_client.go
  • database/internal/harvester/typed_client_test.go
  • database/internal/resource/builder_test.go
  • database/internal/resource/servicemonitor.go
💤 Files with no reviewable changes (1)
  • database/config/default/manager_metrics_patch.yaml

Comment on lines +8 to +11
images:
- name: ghcr.io/yohansenanayake/dbaas-controller
newName: ghcr.io/yohansenanayake/dbaas-controller
newTag: dev-b658cf2-202607290025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use an image tag available today.

This tag is dated July 29, 2026, but today is July 28, 2026. Applying the overlay before that image is published will leave the manager in ImagePullBackOff. Replace it with an existing immutable tag.

🤖 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 `@database/config/overlays/operator-config/kustomization.yaml` around lines 8 -
11, Update the dbaas-controller image entry in kustomization.yaml to use an
already-published immutable tag dated no later than July 28, 2026, replacing
dev-b658cf2-202607290025. Keep the existing image repository unchanged.

Comment on lines +37 to +39
if err := validateBindAddress("server.health.bindAddress", c.Server.Health.BindAddress, false); err != nil {
return err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does controller-runtime manager Options.HealthProbeBindAddress support "0" to disable health probes?

💡 Result:

Yes, controller-runtime manager supports using "0" or an empty string ("") in HealthProbeBindAddress to disable health probes [1][2][3]. The official documentation and source code explicitly state that HealthProbeBindAddress is the TCP address the controller binds to for serving health probes, and setting it to "0" or "" will disable this functionality [1][2][4]. This is implemented in the internal defaultHealthProbeListener function, which returns nil for the listener when the address is set to "0" or "", effectively preventing the health probe server from starting [1][2][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files and refs =="
fd -a 'go\.mod|validate\.go' . | sed 's#^\./##'
echo
rg -n 'HealthProbeBindAddress|HealthProbe|health|bindAddress|go\.module|github.com/sigs.k8s.io/controller-runtime|sigs.k8s.io/controller-runtime' -S --glob '!vendor' . | head -200

echo
echo "== validate.go relevant section =="
if [ -f database/internal/config/validate.go ]; then
  nl -ba database/internal/config/validate.go | sed -n '1,130p'
fi

echo
echo "== go.mod controller-runtime versions =="
if [ -f go.mod ]; then rg 'controller-runtime|sigs.k8s.io/controller-runtime' go.mod; fi
echo
if [ -f go.sum ]; then rg 'controller-runtime|sigs.k8s.io/controller-runtime' go.sum | head -20; fi

Repository: wso2/open-cloud-datacenter

Length of output: 21910


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== validate.go relevant section =="
awk '{printf "%6d  %s\n", NR, $0}' database/internal/config/validate.go | sed -n '1,120p'

echo
echo "== database go.mod =="
awk '{printf "%6d  %s\n", NR, $0}' database/go.mod

echo
echo "== validate helper implementation and tests =="
python3 - <<'PY'
from pathlib import Path
p = Path('database/internal/config/validate.go')
s = p.read_text()
for needle in ['func validateBindAddress', 'func Validate']:
    idx = s.find(needle)
    print(f'--- {needle} at {idx} ---')
    print(s[idx:idx+800].split('\n---')[0][:800] if idx != -1 else 'not found')
print('contains allowDisabled check:', 'allowDisabled' in s)
PY

echo
echo "== deterministic parser for validateBindAddress-like behavior =="
python3 - <<'PY'
from pathlib import Path
p = Path('database/internal/config/validate.go')
text = p.read_text()
print(text[:text.find('\npackage ')].count('\n'))
import re
m = re.search(r'func validateBindAddress\([^)]*\) string, value string, allowDisabled bool[^{]+{(?P<body>.*?)(?=\n[}\t ]\n|func |\Z)', text, re.S)
if not m:
    m = re.search(r'func validateBindAddress\([^)]*\) string, value string, allowDisabled bool[^{]+{(?P<body>.*?)(?=\nfunc |\Z)', text, re.S)
body = m.group('body') if m else text
print(body)

def behavior(body):
    # Extract conditions around value == "0" and allowDisabled
    out = []
    for part in body.split('\n'):
        if 'value' in part or 'allowDisabled' in part or 'strconv' in part or 'net' in part:
            out.append(part.strip())
    return out

print('conditions:', behavior(body))
PY

Repository: wso2/open-cloud-datacenter

Length of output: 23241


🌐 Web query:

controller-runtime v0.20.4 pkg manager healthProbeBindAddress "0" HealthProbeBindAddress

💡 Result:

In controller-runtime v0.20.4, the HealthProbeBindAddress field within the manager.Options struct (part of the sigs.k8s.io/controller-runtime/pkg/manager package) specifies the TCP address that the controller manager uses to bind and serve health probes [1][2]. Setting this field to "0" or an empty string ("") explicitly disables the serving of health probes [1][3]. When a valid address (e.g., ":8081" or "0.0.0.0:8081") is provided, the manager uses the defaultHealthProbeListener function to create a TCP listener on that address [1][2]. Because this mechanism creates a standard TCP listener, it is common to use tools like nc (netcat) to verify connectivity if HTTP requests to endpoints like /healthz or /readyz do not behave as expected [4]. Note that while the configuration sets the binding address, custom health check logic can be added to the manager using the AddHealthzCheck and AddReadyzCheck methods [4].

Citations:


🌐 Web query:

controller-runtime v0.20.4 pkg manager manager.go HealthProbeBindAddress disable "0"

💡 Result:

In controller-runtime v0.20.4, you can disable the health probe server by setting the HealthProbeBindAddress option to either "0" or an empty string ("") [1][2]. The default health probe listener function, defined within the package manager, explicitly checks for these values to determine whether to skip creating the listener [1][2]. If the address is set to "0" or "", the function returns nil for the listener, effectively disabling the serving of health probes [1][3][2]. Source code context: The relevant logic in pkg/manager/manager.go is implemented as follows: func defaultHealthProbeListener(addr string) (net.Listener, error) { if addr == "" || addr == "0" { return nil, nil } ln, err:= net.Listen("tcp", addr) //... return ln, nil } This behavior ensures that when "0" is provided, the controller manager does not attempt to bind to any TCP port for health checks [1][4].

Citations:


🌐 Web query:

github.com kubernetes-sigs controller-runtime v0.20.4 pkg manager defaultHealthProbeListener "0"

💡 Result:

In the Kubernetes controller-runtime library, including version v0.20.4, the defaultHealthProbeListener is a helper function defined within the pkg/manager/manager.go file [1][2][3]. Its primary purpose is to create a TCP listener for health probes [1][2]. The function checks the provided address (addr) and returns early—effectively disabling the health probe server—if the address is an empty string ("") or the string "0" [1][2][3]. The implementation is as follows: func defaultHealthProbeListener(addr string) (net.Listener, error) { if addr == "" || addr == "0" { return nil, nil } ln, err:= net.Listen("tcp", addr) if err!= nil { return nil, fmt.Errorf("error listening on %s: %w", addr, err) } return ln, nil } When a manager is initialized, the HealthProbeBindAddress option uses this logic to determine whether to bind to a specific address or disable the health probe server entirely [1][2]. If a user sets the HealthProbeBindAddress to "0" or leaves it as the default (empty string), the manager will not start a health probe listener [1][2].

Citations:


🌐 Web query:

controller-runtime v0.18.0 v0.19.0 v0.20.4 HealthProbeBindAddress defaultHealthProbeListener

💡 Result:

In controller-runtime, HealthProbeBindAddress is a configuration option in the manager's Options struct used to specify the TCP address where the manager serves health probes (such as liveness and readiness checks) [1][2][3]. The function defaultHealthProbeListener is the internal implementation used to create the listener for these probes [1][2][4]. Its behavior is consistent across versions v0.18.0, v0.19.0, and v0.20.4 [1][2][4]: 1. If HealthProbeBindAddress is set to an empty string "" or "0", the function returns nil, nil, effectively disabling the health probe server [1][2][5]. 2. Otherwise, it attempts to open a TCP listener on the provided address using net.Listen("tcp", addr) [1][2][4]. If the bind fails (e.g., due to an invalid address or the port already being in use), it returns an error [1][2][5]. The manager uses this listener to expose health endpoints, which default to /healthz (liveness) and /readyz (readiness) [1][2]. Developers typically set HealthProbeBindAddress (e.g., :8081) in the manager's options, and the manager automatically falls back to defaultHealthProbeListener if a custom listener is not provided [1][2][5].

Citations:


Allow disabling health probe binding with "0" for server.health.bindAddress.

HealthProbeBindAddress in controller-runtime treats "0" as disable, and database/cmd/main.go passes this value directly to mgr.Options. Since validateBindAddress(..., false) rejects "0" here, admins cannot use the supported disable sentinel without this validation error.

🤖 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 `@database/internal/config/validate.go` around lines 37 - 39, Update the
validateBindAddress call for server.health.bindAddress in config validation to
allow the "0" disable sentinel by enabling the corresponding acceptance flag.
Preserve the existing validation and error propagation for all other
bind-address values.

Comment on lines 49 to +54
return ensure.Dependencies{
Client: r.Client,
Harvester: r.Harvester,
Recorder: r.Recorder,
GrafanaBaseURL: r.GrafanaBaseURL,
OperatorNamespace: r.operatorNamespace(),
OperatorNamespace: operatorNamespace,

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 | 🟡 Minor | ⚡ Quick win

Pass configured dependencies through this test helper.

Production wiring supplies DatabaseDefaults, InstanceClasses, and Monitoring, but resetEnsureRunner drops them here and silently exercises built-in fallbacks instead. Controller tests cannot validate configured reconciliation behavior.

Proposed fix
 		GrafanaBaseURL:    r.GrafanaBaseURL,
 		OperatorNamespace: operatorNamespace,
+		DatabaseDefaults:  r.DatabaseDefaults,
+		InstanceClasses:   r.InstanceClasses,
+		Monitoring:        r.Monitoring,
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return ensure.Dependencies{
Client: r.Client,
Harvester: r.Harvester,
Recorder: r.Recorder,
GrafanaBaseURL: r.GrafanaBaseURL,
OperatorNamespace: r.operatorNamespace(),
OperatorNamespace: operatorNamespace,
return ensure.Dependencies{
Client: r.Client,
Harvester: r.Harvester,
Recorder: r.Recorder,
GrafanaBaseURL: r.GrafanaBaseURL,
OperatorNamespace: operatorNamespace,
DatabaseDefaults: r.DatabaseDefaults,
InstanceClasses: r.InstanceClasses,
Monitoring: r.Monitoring,
🤖 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 `@database/internal/controller/controller_test_helpers_test.go` around lines 49
- 54, Update resetEnsureRunner to pass the configured DatabaseDefaults,
InstanceClasses, and Monitoring dependencies from the runner into
ensure.Dependencies, matching production wiring and avoiding fallback values in
controller tests.

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🧹 Nitpick comments (1)
database/internal/ensure/defaults_test.go (1)

48-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for a non-default configuration.

All updated cases pass built-in defaults, so they cannot detect immutableDriftWithDefaults ignoring its supplied configuration. Add a case with custom database defaults and omitted spec fields that match AppliedSpec.

Also applies to: 74-76, 96-98, 122-124, 150-152

🤖 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 `@database/internal/ensure/defaults_test.go` around lines 48 - 50, Add test
cases covering custom database defaults passed to immutableDriftWithDefaults,
with omitted spec fields matching the corresponding AppliedSpec values and no
reported drift. Update the related cases at the referenced assertions to use the
custom configuration rather than only operatorconfig.Default().DatabaseDefaults,
while preserving existing default-configuration coverage.
🤖 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 `@database/config/base/cert_metrics_manager_patch.yaml`:
- Around line 11-14: Replace the stale --metrics-cert-path argument in the
metrics server container args with the registered observability.metrics.tls.*
flag for the mounted certificate directory, preserving the existing
/tmp/k8s-metrics-server/metrics-certs path.

In `@database/config/overlays/operator-config/kustomization.yaml`:
- Around line 8-11: Update the dbaas-controller image entry in
kustomization.yaml to use an already-published immutable tag dated no later than
July 28, 2026, replacing dev-b658cf2-202607290025. Keep the existing image
repository unchanged.

In `@database/internal/config/validate.go`:
- Around line 37-39: Update the validateBindAddress call for
server.health.bindAddress in config validation to allow the "0" disable sentinel
by enabling the corresponding acceptance flag. Preserve the existing validation
and error propagation for all other bind-address values.

In `@database/internal/controller/controller_test_helpers_test.go`:
- Around line 49-54: Update resetEnsureRunner to pass the configured
DatabaseDefaults, InstanceClasses, and Monitoring dependencies from the runner
into ensure.Dependencies, matching production wiring and avoiding fallback
values in controller tests.

---

Nitpick comments:
In `@database/internal/ensure/defaults_test.go`:
- Around line 48-50: Add test cases covering custom database defaults passed to
immutableDriftWithDefaults, with omitted spec fields matching the corresponding
AppliedSpec values and no reported drift. Update the related cases at the
referenced assertions to use the custom configuration rather than only
operatorconfig.Default().DatabaseDefaults, while preserving existing
default-configuration coverage.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cf9de88-99b6-4c68-abc6-66cb539b4bd3

📥 Commits

Reviewing files that changed from the base of the PR and between 67f2f46 and a3f3513.

⛔ Files ignored due to path filters (1)
  • database/go.sum is excluded by !**/*.sum
📒 Files selected for processing (42)
  • database/README.md
  • database/cmd/main.go
  • database/config/base/cert_metrics_manager_patch.yaml
  • database/config/base/kustomization.yaml
  • database/config/base/metrics_service.yaml
  • database/config/default/kustomization.yaml
  • database/config/default/manager_metrics_patch.yaml
  • database/config/default/namespace.yaml
  • database/config/manager/manager.yaml
  • database/config/overlays/operator-config/kustomization.yaml
  • database/config/overlays/operator-config/manager_config_patch.yaml
  • database/config/overlays/operator-config/operator_config.yaml
  • database/go.mod
  • database/internal/config/defaults.go
  • database/internal/config/flags.go
  • database/internal/config/load.go
  • database/internal/config/load_test.go
  • database/internal/config/namespace.go
  • database/internal/config/namespace_test.go
  • database/internal/config/types.go
  • database/internal/config/validate.go
  • database/internal/config/validate_test.go
  • database/internal/controller/controller_test_helpers_test.go
  • database/internal/controller/dbinstance_controller.go
  • database/internal/credentials/resolver.go
  • database/internal/credentials/resolver_test.go
  • database/internal/ensure/defaults.go
  • database/internal/ensure/defaults_test.go
  • database/internal/ensure/dependencies.go
  • database/internal/ensure/health.go
  • database/internal/ensure/monitoring.go
  • database/internal/ensure/preflight.go
  • database/internal/ensure/preflight_test.go
  • database/internal/ensure/resize.go
  • database/internal/ensure/steps_test_helpers_test.go
  • database/internal/ensure/vm.go
  • database/internal/gateway/gateway.go
  • database/internal/gateway/gateway_test.go
  • database/internal/harvester/typed_client.go
  • database/internal/harvester/typed_client_test.go
  • database/internal/resource/builder_test.go
  • database/internal/resource/servicemonitor.go
💤 Files with no reviewable changes (1)
  • database/config/default/manager_metrics_patch.yaml
🛑 Comments failed to post (1)
database/config/base/cert_metrics_manager_patch.yaml (1)

11-14: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline database/internal/config/flags.go --items all
rg -n -C2 'metrics-cert-path|observability\.metrics\.tls\.certDir|certDir' \
  database/internal/config/flags.go database/cmd/main.go

Repository: wso2/open-cloud-datacenter

Length of output: 1796


🏁 Script executed:

#!/bin/bash
cat -n database/internal/config/flags.go
printf '\n--- patch file ---\n'
cat -n database/config/base/cert_metrics_manager_patch.yaml
printf '\n--- main setup section ---\n'
sed -n '80,135p' database/cmd/main.go | cat -n

Repository: wso2/open-cloud-datacenter

Length of output: 8779


Replace the stale metrics certificate flag.

--metrics-cert-path is not a registered CLI flag; the manager parses arguments from database/internal/config/flags.go, whose current metrics TLS options use observability.metrics.tls.*. Use that flag for the mounted cert directory.

Proposed fix
-  value: --metrics-cert-path=/tmp/k8s-metrics-server/metrics-certs
+  value: --observability.metrics.tls.certDir=/tmp/k8s-metrics-server/metrics-certs
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

# Add the --metrics-cert-path argument for the metrics server
- op: add
  path: /spec/template/spec/containers/0/args/-
 value: --observability.metrics.tls.certDir=/tmp/k8s-metrics-server/metrics-certs
🤖 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 `@database/config/base/cert_metrics_manager_patch.yaml` around lines 11 - 14,
Replace the stale --metrics-cert-path argument in the metrics server container
args with the registered observability.metrics.tls.* flag for the mounted
certificate directory, preserving the existing
/tmp/k8s-metrics-server/metrics-certs path.

@gnudeep
gnudeep merged commit ceb5bec into wso2:operators Jul 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants