-
Notifications
You must be signed in to change notification settings - Fork 58
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
Introduce drenv providers #1534
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nirs
force-pushed
the
drenv-providers
branch
3 times, most recently
from
August 28, 2024 18:25
c02db9f
to
18e6076
Compare
nirs
commented
Aug 29, 2024
New version improves the provider interface:
|
nirs
force-pushed
the
drenv-providers
branch
2 times, most recently
from
September 1, 2024 22:00
082be65
to
ca352fb
Compare
New version fixes containerd to be configured only when creating a cluster (bad refactoring). |
nirs
force-pushed
the
drenv-providers
branch
from
September 5, 2024 15:46
ca352fb
to
3718ad5
Compare
Lasted push add few improvements based on experience with the lima provider.
|
nirs
force-pushed
the
drenv-providers
branch
from
September 5, 2024 16:18
3718ad5
to
a8fcd6e
Compare
Lat push improve logs when waiting until external cluster is ready. |
nirs
force-pushed
the
drenv-providers
branch
6 times, most recently
from
September 13, 2024 00:44
f19e22a
to
4a62057
Compare
Changes in latest version:
|
nirs
force-pushed
the
drenv-providers
branch
2 times, most recently
from
September 17, 2024 13:13
e43dfb7
to
f57fc27
Compare
To make it possible to debug platform and machine detection in github and or in developer environment. Signed-off-by: Nir Soffer <[email protected]>
All the public functions in the minikube module accept a profile, but this is actually a profile name. We want to pass a profile dict to start(). Use `name` for functions accepting a profile names. Signed-off-by: Nir Soffer <[email protected]>
The minikube module is mostly a thin wrapper for the minikube command, and we have higher level helpers in __main__.py. Since we wan to have multiple providers (e.g. lima, external), move all the helpers to the minikube module. Signed-off-by: Nir Soffer <[email protected]>
This step is not part of creating vnev, and will be more complicated to do as part of creating the venv when adding providers. This must be run manually as we do in the CI. Signed-off-by: Nir Soffer <[email protected]>
The envfile can have now a "provider" property, defaults to "$provider", which expands to the platform default provider. The first provider is minikube. The setup and cleanup commands requires now an env file, since they need to get the provider to setup. Signed-off-by: Nir Soffer <[email protected]>
We want to minimize the provider interface to make it easier to create new providers. Signed-off-by: Nir Soffer <[email protected]>
These commands are not very portable, they work only on Linux when using minikube kvm2 driver. Signed-off-by: Nir Soffer <[email protected]>
All functions used in drenv/__main__.py pass now the profile dict instead of the name. This is required for some functions like suspend and resume, since these operations are available only on certain profile driver. The load_files() function was renamed to configure(). The function also accepts the profile so the provider can configure the cluster based on the cluster configuration. This will be useful to configure containerd later. The setup_files() and cleanup_files() were renamed to setup() and cleanup(). They do not accept a profile since they are called once per provider. Functions are grouped by type: provider scope, cluster scope, and private helpers. Signed-off-by: Nir Soffer <[email protected]>
This makes the start flow more generic, and allow every provider to do the right thing for the profile and cluster status. Signed-off-by: Nir Soffer <[email protected]>
This is a specific minikube workaround - when starting an existing cluster, kubernetes reports stale state for a while. The wait is not needed for external cluster which we never restart. If this will be needed for other provider we can extract a common helper later. Signed-off-by: Nir Soffer <[email protected]>
Some commands (like drenv) log to stderr without writing anything to stdout. When we watch such commands we want to watch stderr instead of stdout. Since the command do not write anything to stdout, we can redirect the command stderr to stdout. When a command fails, we cannot report the error message since it was already yielded to the code watching the command. This is the issue with logging everything to stderr, but we don't control the commands we run. This change add an option to redirect stderr to commands.watch() and and test the behavior. Signed-off-by: Nir Soffer <[email protected]>
Like limactl, drenv logs only to stderr, so when running it in tests with: commands.run("drenv", "start", ...) we don't see anything in the test logs. If the test is blocking for long time, we have no way to debug this. The helpful log lines are buffered in the command error buffer. Use the new stderr= argument to watch and log the command output, and add helpers for drenv in a consistent way. Signed-off-by: Nir Soffer <[email protected]>
We used `kubectl version` as a proxy for cluster readynes, checking for server info in the response. Replace the check with lower level check if API server /readyz endpoint. Signed-off-by: Nir Soffer <[email protected]>
Before this change we had only one provider, so this was internal implementation detail. This change adds the second provider, allowing users to configure the provider in the environment file. Replace the `external: true` option with `provider: external`. With this we can remove the special handling or external cluster with calls to the external provider which does the right thing. The external provider basically does nothing, since we do not manage this cluster. However in start() we ensure that the cluster exists and then wait until the cluster is ready. This helps to debug issues with external cluster and reduces log noise. Signed-off-by: Nir Soffer <[email protected]>
nirs
force-pushed
the
drenv-providers
branch
from
September 17, 2024 13:55
f57fc27
to
eaba42c
Compare
ShyamsundarR
approved these changes
Sep 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Preparing for running drenv on Apple silicon via lima, introduce the providers package. The first provider is minikube.
This is change mostly internal refactoring without changing the behavior, making it easy to add a lima provider in a clean and safe way.
Behavior changes:
Testing:
Part of #1513