-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add a basic manifest repository implementation #1
Conversation
with tempfile.TemporaryDirectory() as tmpdir: | ||
src = path_join(tmpdir) | ||
self.render(src, config) | ||
shutil.rmtree(path=dst, ignore_errors=True) | ||
self.relocate_env(src, dst) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my current folder structure:
├── config.yml
├── env
│ ├── base
│ │ ├── apps
│ │ │ ├── caddy
│ │ │ ├── openedx
│ │ │ └── redis
│ │ ├── k8s
│ │ │ ├── deployments.yml
│ │ │ ├── jobs.yml
│ │ │ ├── namespace.yml
│ │ │ ├── services.yml
│ │ │ └── volumes.yml
│ │ ├── kustomization.yml
│ │ └── plugins
│ │ ├── forum
│ │ ├── notes
│ │ └── settingmanager.yml
│ ├── extensions
│ │ ├── flowers.yml
│ │ ├── hpa.yml
│ │ ├── ingress.yml
│ │ ├── kustomization.yml
│ │ └── overrides.yml
│ └── kustomization.yml
├── reference.yml
└── requirements.txt
My tutor plugins list:
android (disabled) 13.0.0
discovery (disabled) 13.0.1
distro 2.1.0
drydock 0.1.0
ecommerce (disabled) 13.0.1
forum 13.0.0
license (disabled) 13.0.0
mfe (disabled) 13.0.6
minio 13.0.1
notes 13.0.1
richie (disabled) 13.0.2
settingmanager 0.1.0
webui (disabled) 13.0.2
xqueue (disabled) 13.0.0
Then I run:
tutor drydock save -r reference.yml
When the command finishes, I run:
tutor plugins list
And this happens:
⚠️ Failed to enable plugin 'settingmanager': plugin 'settingmanager' is not installed.
android (disabled) 13.0.0
discovery (disabled) 13.0.1
distro 2.1.0
drydock 0.1.0
ecommerce (disabled) 13.0.1
forum 13.0.0
license (disabled) 13.0.0
mfe (disabled) 13.0.6
minio 13.0.1
notes 13.0.1
richie (disabled) 13.0.2
webui (disabled) 13.0.2
xqueue (disabled) 13.0.0
Is that okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes (actually is not ok, but is a current limitation). At the moment we don't render module nor yaml plugins on base/plugins
. The current workaround is to define the TUTOR_PLUGINS_ROOTS
outside env
.
The folder structure would look something like this:
├── config.yml
├── env
│ ├── base
│ │ ├── apps
│ │ │ ├── caddy
│ │ │ ├── openedx
│ │ │ └── redis
│ │ ├── k8s
│ │ │ ├── deployments.yml
│ │ │ ├── jobs.yml
│ │ │ ├── namespace.yml
│ │ │ ├── services.yml
│ │ │ └── volumes.yml
│ │ ├── kustomization.yml
│ │ └── plugins
│ │ ├── forum
│ │ └── notes
│ ├── extensions
│ │ ├── flowers.yml
│ │ ├── hpa.yml
│ │ ├── ingress.yml
│ │ ├── kustomization.yml
│ │ └── overrides.yml
│ └── kustomization.yml
├── reference.yml
└── requirements.txt
└── plugins
└── settingmanager.yml
and your TUTOR_PLUGINS_ROOT
should be something like $TUTOR_ROOT/plugins
self.defaults = { | ||
"DRYDOCK_FLOWER": False, | ||
"DRYDOCK_INGRESS": False, | ||
"DRYDOCK_HPA": False, | ||
"DRYDOCK_DISABLE_JOBS": False, | ||
"DRYDOCK_ENABLE_OVERRIDES": False, | ||
"DRYDOCK_LMS_MIN_REPLICAS": 1, | ||
"DRYDOCK_CMS_MIN_REPLICAS": 3, | ||
"DRYDOCK_LMS_MAX_REPLICAS": 1, | ||
"DRYDOCK_CMS_MAX_REPLICAS": 3, | ||
"DRYDOCK_LMS_LIMIT_CPU": 1, | ||
"DRYDOCK_LMS_LIMIT_MEMORY": "2Gi", | ||
"DRYDOCK_LMS_REQUEST_CPU": "600m", | ||
"DRYDOCK_LMS_REQUEST_MEMORY": "1Gi", | ||
"DRYDOCK_LMS_WORKER_LIMIT_CPU": 1, | ||
"DRYDOCK_LMS_WORKER_LIMIT_MEMORY": "2Gi", | ||
"DRYDOCK_LMS_WORKER_REQUEST_CPU": "600m", | ||
"DRYDOCK_LMS_WORKER_REQUEST_MEMORY": "1Gi", | ||
"DRYDOCK_CMS_LIMIT_CPU": 1, | ||
"DRYDOCK_CMS_LIMIT_MEMORY": "2Gi", | ||
"DRYDOCK_CMS_REQUEST_CPU": "600m", | ||
"DRYDOCK_CMS_REQUEST_MEMORY": "1Gi", | ||
"DRYDOCK_CMS_WORKER_LIMIT_CPU": 1, | ||
"DRYDOCK_CMS_WORKER_LIMIT_MEMORY": "2Gi", | ||
"DRYDOCK_CMS_WORKER_REQUEST_CPU": "600m", | ||
"DRYDOCK_CMS_WORKER_REQUEST_MEMORY": "1Gi", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.defaults changes? why this dictionary is not constant to the class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opted to define the defaults on a defaults.yml
on each template set and load them from there.
drydock/manifest_builder/infrastructure/tutor_based_manifests.py
Outdated
Show resolved
Hide resolved
How did you decide what to add as configurable in the base templates? |
The ones in base I tried to keep almost the same as the ones in tutor. Minus the Jobs for reasons explained above. The ones in extensions I've opted for making all the additional resources toggleable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! I tried it, and it seems to be working as expected. Just one more thing: you could add a short how-to describing how to generate manifests & how to apply them.
a26f26c
to
dd494c1
Compare
The `BaseManfests` builder will render a standard Tutor environment based on the templates used in version 13.3.1 of Tutor and use it as a base of Kustomization application with additional resources as overlays. The `TutorExtendedConfig` will return the Tutor configuration values of the current `TUTOR_ROOT` and will use the default values of the template set (defined in a file `defaults.yml`) as a fallback.
dd494c1
to
e449d41
Compare
Description
Implement
BaseManifest
to render a drydock environment.A manifest repository is a collection of configuration files that describe that describe the state of our applications. This collection is meant to be tracked by a version control tool and enable a GitOps framework.
The
BaseManifest
implementation serves as a basic approach to this for Kubernetes. It mixes Kustomize and a Tutor (v13.3.1) environment to render a new environment that uses the Tutor env as a base and adds additional extensions as new resources. A drydock environment generated usingBaseManifest
looks like this:Where
base
is standard Tutor env (minus files not needed by k8s), and extension is an additional Kustomize overlay with extra resources or patches.The drydock environment is generated by using the tutor renderer on the templates defined on
default
. The templates ondefault/base
are taken almost verbatim from the latest tutor version for the Maple release (v13.3.1), the only difference being the option to skip jobs (The current implementation of Jobs on Tutor doesn't play nicely with GitOps).The
default/extension
includes additional resources such as an ingress, an Horizontal Pod Autoscaler and a flowers deployment. It also includes anoverrides.yml
(inspired by this commit) to modify the values of the resources indefault/base
.Additional info
BaseManifest
is static in the sense that is tied to the templates found indefault
and those are locked to the ones found in tutor v13.3.1 for the most part. In the future it may be possible to have different versions ofdefault
.ENABLE_WEB_PROXY: true
andDRYDOCK_INGRESS: true
)