Skip to content

Deploy (do not merge) - #1

Closed
kingdonb wants to merge 9 commits into
flux-oper-0.6from
deploy
Closed

kingdonb wants to merge 9 commits into
flux-oper-0.6from
deploy

Conversation

@kingdonb

@kingdonb kingdonb commented Jun 22, 2024 •

Copy link
Copy Markdown
Owner

This PR is me figuring out the build system well enough to test:

@kingdonb
kingdonb force-pushed the deploy branch 3 times, most recently from 8b43278 to 7d88c84 Compare June 22, 2024 21:13
kingdonb added 3 commits June 22, 2024 22:15
Signed-off-by: Kingdon Barrett <[email protected]>
Signed-off-by: Kingdon Barrett <[email protected]>
@kingdonb
kingdonb changed the base branch from main to flux-oper-0.6 June 23, 2024 12:03
@kingdonb
kingdonb deleted the branch flux-oper-0.6 June 24, 2024 13:09
@kingdonb kingdonb closed this Jun 24, 2024
kingdonb pushed a commit that referenced this pull request Nov 23, 2025
….merge (cozystack#1583)

[nats] Fixes for NATS App Helm chart, fix template issues with
config.merge value

## What this PR does

This PR fixes two critical bugs in the NATS application chart
(`packages/apps/nats`) that prevented successful deployment when using
user authentication with custom configuration:

**Bug #1: YAML Parse Error with Empty config.merge**
- When users were defined but `config.merge` was empty (`{}`), the Helm
template would fail with YAML parse errors
- Fixed by adding safe existence checks before accessing
`.Values.config.merge` and preventing rendering of empty merge blocks

**Bug #2: Incorrect Config Nesting**
- When both `users` and `config.merge` were defined, custom NATS config
values (e.g., `max_payload`, `max_connections`) were incorrectly nested
as children of the `accounts` object instead of being placed at the root
NATS configuration level
- This caused NATS pods to crash with "Expected map entries for
accounts" errors
- Fixed by correcting the indentation from `nindent 12` to `nindent 10`
in the template

The related issue is cozystack#1354 

### Changes Made

**File**: `packages/apps/nats/templates/nats.yaml`

1. Line 55: Added safe existence checks for `.Values.config.merge`
2. Line 66: Added length validation to prevent rendering empty merge
objects
3. Line 67: Fixed indentation to ensure config values merge at root
level

### Impact

- Enables NATS deployments with user authentication and custom
configuration
- Fixes Stalwart mail server clustering scenarios that require NATS with
authentication
- Resolves HelmRelease failures in multi-tenant environments

### Testing

Can be tested with:
```yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: NATS
metadata:
  name: test-nats
spec:
  replicas: 2
  users:
    testuser: {}
  config:
    merge:
      max_payload: 2097152
      max_connections: 500
```

Expected result: HelmRelease succeeds, NATS pods start successfully, and
configuration is valid.

---

### Release note

```release-note
[nats] Fix NATS application chart template bugs that prevented deployments with user authentication and custom configuration.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Enhanced configuration validation with improved guard conditions to
ensure proper handling of merge configurations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

1 participant