Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Change weavedb from an emptyDir to a hostPath volume #2967

Merged
merged 1 commit into from
May 23, 2017

Conversation

bboreham
Copy link
Contributor

emptyDir has the same lifetime as the pod, whereas we want our persistence to extend past that, e.g. when Weave Net is upgraded.

We assume that /var/lib is writable.

Fixes #2610

@bboreham bboreham added this to the 2.0 milestone May 16, 2017
@marccarre
Copy link
Contributor

marccarre commented May 16, 2017

As discussed on Slack, this requires a similar change in the Launch Generator.
EDIT: done in weaveworks/launch-generator/pull/107

@marccarre
Copy link
Contributor

Should we add a step to delete this directory in the tests?

@bboreham
Copy link
Contributor Author

Should we add a step to delete this directory in the tests?

I guess so; from the point of view of ensuring that we test the same thing each time.
Ideally we would extend the tests to do some sort of 'delete pods and restart' to check persistence worked.

@marccarre
Copy link
Contributor

marccarre commented May 16, 2017

Ideally we would extend the tests to do some sort of 'delete pods and restart' to check persistence worked.

Agreed 👍

@@ -102,7 +102,8 @@ spec:
type: spc_t
volumes:
- name: weavedb
emptyDir: {}
hostPath:
path: /var/lib/weave-net

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@bboreham
Copy link
Contributor Author

Should we add a step to delete this directory in the tests?

I now think weave reset should clear out this persistence directory; this will help, e.g. if someone needs to move a peer from one cluster to another.

(it isn't easy to run weave reset in a Kubernetes context, but that's a different problem)

@bboreham bboreham force-pushed the issues/2610-host-volume branch from 0a8eb32 to 73d5204 Compare May 17, 2017 10:24
EmptyDir has the same lifetime as the pod, whereas we want our
persistence to extend past that, e.g. when Weave Net is upgraded.

`weave reset` cleans out the file.

We assume that /var/lib is writable.
@bboreham bboreham force-pushed the issues/2610-host-volume branch from 73d5204 to bebaa48 Compare May 17, 2017 12:38
Copy link
Contributor

@marccarre marccarre left a comment

Choose a reason for hiding this comment

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

LGTM.

@marccarre
Copy link
Contributor

@brb, what do you think of these latest changes? (I'll wait for your final review before I merge)

@@ -1634,6 +1634,7 @@ case "$COMMAND" in
protect_against_docker_hang
VOLUME_CONTAINERS=$(docker ps -qa --filter label=weavevolumes)
[ -n "$VOLUME_CONTAINERS" ] && docker rm -v $VOLUME_CONTAINERS >/dev/null 2>&1 || true
rm -f $HOST_ROOT/var/lib/weave/weave-netdata.db >/dev/null 2>&1 || true

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

Copy link
Contributor

@marccarre marccarre left a comment

Choose a reason for hiding this comment

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

LGTM.

@marccarre marccarre merged commit 0c89bbb into master May 23, 2017
@marccarre marccarre deleted the issues/2610-host-volume branch May 23, 2017 16:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants