Skip to content
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

[nats helm 1.x] fix JS mount #717

Merged
merged 2 commits into from
May 9, 2023
Merged

Conversation

caleblloyd
Copy link
Contributor

@caleblloyd caleblloyd commented May 9, 2023

Fixes #716

In 1.0.0-beta.2 and below we are mounting to /data/jetstream and the store dir is /data

So it looks like NATS Server is detecting the size of /data which is outside of the PVC mount

This is going to be a problem when upgrading from 0.x anyways, because in 0.x we are mounting to /data and the store dir is /data

This updates the mount dir and store dir to match and default to /data

There is a one-time-fix initContainer that will be released as part of 1.0.0-beta.3 and removed after that

Signed-off-by: Caleb Lloyd <caleb@synadia.com>
Copy link
Member

@samuelattwood samuelattwood left a comment

Choose a reason for hiding this comment

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

LGTM

@caleblloyd
Copy link
Contributor Author

Well the initContainer fixup is working, but NATS is still not auto-detecting the correct storage size from the mount - it should be 10GB

1.0.0-beta.2

kubectl logs nats-0 -c nats | grep -B3 -A1 -F 'Store Directory'
[7] 2023/05/09 15:43:32.082047 [INF] ---------------- JETSTREAM ----------------
[7] 2023/05/09 15:43:32.082049 [INF]   Max Memory:      0 B
[7] 2023/05/09 15:43:32.082051 [INF]   Max Storage:     7.25 GB
[7] 2023/05/09 15:43:32.082052 [INF]   Store Directory: "/data/jetstream"
[7] 2023/05/09 15:43:32.082053 [INF] -------------------------------------------


kubectl exec -it nats-0 -c nats -- find /data -maxdepth 2
/data
/data/jetstream
/data/jetstream/lost+found
/data/jetstream/$SYS
/data/jetstream/$G

This PR

kubectl logs nats-0 -c nats | grep -B3 -A1 -F 'Store Directory'
[16] 2023/05/09 15:49:46.241840 [INF] ---------------- JETSTREAM ----------------
[16] 2023/05/09 15:49:46.241842 [INF]   Max Memory:      0 B
[16] 2023/05/09 15:49:46.241845 [INF]   Max Storage:     7.25 GB
[16] 2023/05/09 15:49:46.241847 [INF]   Store Directory: "/data/jetstream"
[16] 2023/05/09 15:49:46.241848 [INF] -------------------------------------------


kubectl exec -it nats-0 -c nats -- find /data -maxdepth 2
/data
/data/lost+found
/data/jetstream
/data/jetstream/$SYS
/data/jetstream/$G

Signed-off-by: Caleb Lloyd <caleb@synadia.com>
@caleblloyd
Copy link
Contributor Author

Going further down the rabbit hole - it turns out that the auto-disk calculation is 75% of available space, but it's got an issue because it will shrink after restarting

nats-io/nats-server#4140

So it seems that the best path forward right now is to adopt the 0.x behavior of defaulting max_file_storage to the PVC size. Although there is still the option to override it with maxSize.

It is not all that useful to be set to the PVC Size, because the actual disk is smaller when formatted. For example a 10Gi disk has 9.7Gi usable after formatting. So a max_file_storage of 10Gi will never be hit, the disk will fill up first. But it is the same behavior that 0.x has today so I digress

@caleblloyd
Copy link
Contributor Author

Alright at least the logs look right now 😄

[15] 2023/05/09 20:01:53.040642 [INF] ---------------- JETSTREAM ----------------
[15] 2023/05/09 20:01:53.040645 [INF]   Max Memory:      0 B
[15] 2023/05/09 20:01:53.040648 [INF]   Max Storage:     10.00 GB
[15] 2023/05/09 20:01:53.040650 [INF]   Store Directory: "/data/jetstream"
[15] 2023/05/09 20:01:53.040651 [INF] -------------------------------------------

@caleblloyd caleblloyd merged commit 56c3f8c into helm-nats-1.x May 9, 2023
@caleblloyd caleblloyd deleted the helm-nats-1.x-js-mount branch May 9, 2023 20:08
caleblloyd added a commit that referenced this pull request Aug 1, 2023
* [nats helm 1.x] fix JS mount

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* default max_file_store to pvc size

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>
caleblloyd added a commit that referenced this pull request Aug 1, 2023
* NATS 1.x Helm Chart (#704)

* nats-next helm chart

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* volume claim templates

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* persistence

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* load merge patch pattern

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* support nats config vars, units, and include

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* re-work jetstream values

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* reset merged values

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* separate jetstream config and pvc

* disable cluster advertisements by default

* tls

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* reloader

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* reorg config

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* nats box

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* nats protocol is always enabled

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* nest nats resources

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* un-nest nats

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* standardize pvc size

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* pvc names

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* allow overriding resource names

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* add websocket ingress

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* extra resources

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* update tplYaml

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* update extraResources example

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* test beginnings

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* more tests

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* default values test

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* ports test

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* port and config tests

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* tls test

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* resource merge/patch tests

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* global image section

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* nats box tests

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* includes test

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* extra resources test

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* rename nats-next to nats

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* fix nats-box test

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* fix linting

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* fix nindent check

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* bump test k8s versions

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* disable cluster and js by default

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* fix lint

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* CI updates

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* move ingress under config.websocket

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* remove cluster replica check

gateways could be configured which would enable single replica cluster to work

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* upgrade to nats 2.9.16

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* POD_NAME env var

* documentation

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* add optional service accounts

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* default enableServiceLinks: false

service discovery uses DNS; don't need service env vars

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* fix lint

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* add global labels

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* nats-box non-polling sleep

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* add helpers for secretNames

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* make include example clearer

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* natsBox: only create contents secret if used

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* tls key does not support contents

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [nats helm 1.x] add Beta notice to README.md (#714)

* [nats helm 1.x] add Beta notice to README.md

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* bump to 1.0.0-beta.1 so this hits ArtifactHub

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [nats helm 1.x] remove break statement (#715)

* [nats helm 1.x] remove break statement

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* jsonpatch fix

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [nats helm 1.x] fix JS mount (#717)

* [nats helm 1.x] fix JS mount

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* default max_file_store to pvc size

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* remove 1.0.0-beta.3 fix (#719)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] leafnode -> leafnodes (#720)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] upgrade nats to 2.9.17 (#728)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] config.serverNamePrefix option (#732)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] config.cluster.routeURLs options (#746)

* [helm nats 1.x] config.cluster.routeURLs options

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* update comments

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] add pod disruption budget (#747)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] 0.x -> 1.x upgrade guide (#743)

* [helm nats 1.x] 0.x -> 1.x upgrade guide

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* add TLS considerations

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* update instructions

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] upgrade NATS to 2.9.19 (#749)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] add namespaceOverride (#755)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] publish 1.0.0-rc.0 (#756)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] remove tls.ca options (#758)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] add appProtocol to services (#762)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] add tlsCA option (#763)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* [helm nats 1.x] upgrade nats to 2.9.20 (#765)

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

* release 1.0.0

Signed-off-by: Caleb Lloyd <caleb@synadia.com>

---------

Signed-off-by: Caleb Lloyd <caleb@synadia.com>
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.

None yet

2 participants