forked from opensearch-project/opensearch-migrations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opensearch-project#1054 from gregschohn/Kubernetes…
…Experimentation Description Longer term, Kubernetes (K8s) will allow us To unify the single-node developer experience with and on prem experience and the cloud one. Simplify and speed up deployment, especially around testing. To enable auto-scaling Category Enhancement / New feature Why these changes are required? See above What is the old behavior before changes and new behavior after changes? CDK deployment should still work as it did before. For this first cut... Installing The k8s directory contains helm charts that can be installed with helm install charts/aggregate/migrationAssistant. Optionally, -n ma can be added to add the helm installation and MA resources to the "ma" namespace (or whatever is specified). aggregate/mockCustomerClusters is a helm chart for testing purposes to bring up the resources external to the migration assistant that are required to facilitate testing all of the migration assistant functionality. Those aggregate charts pull other helm charts, either local to this repo (charts/components/(captureProxy|migrationConsole...) or 3rd party charts (opensearch, elasticsearch, prometheus, etc) into them. Each chart defines default values in the values.yaml contained within the charts directory, alongside the Chart.yaml manifest file. Those default values can be used to install a working version of the MA solution. Today's functionality is limited and buggy, but doing a reasonable demo install w/out providing any value overrides will be an ongoing requirement. Before running helm install, you'll likely need to run helm dependency build CHART_DIR, which downloads or copies charts into the CHART_DIR/charts directory. There's a script (linkSubChartsToDependencies.sh), which still has some bugs, that attempts do do some of this manually w/ symlinks to local directories when possible. Symlinks are preferable to tarballs because you don't need to keep rebuilding the dependencies, which can be time consuming. Configurations Command line parameters are configured via helm through the values (such as values.yaml). Here's sample contents for the bulkLoad deployment. parameters: initialLeaseDuration: value: PT10M documentsPerBulkRequest: value: 1000 All of Migration Assistant's custom processes use the same paradigm to translate those yaml parameters into the command line parameters. Shared helm charts (helmCommon) provide helper macros that allow consistent handling across our fleet of helm packages. For command line parsing, helm charts create deployments, mostly via the common code that does the following. 1) Create config map stores for each of the parameters specified in the values.yaml file; 2) load the values from those config maps as environment variables into an init container; and then 3) that init container runs shell script commands to construct the arguments that will be passed into the main program. For the last part, those arguments are passed via a file (vars.sh) within a shared mount and 4) the main container loads those variables before running the program. The migration console has an extra init container that constructs the migration_services.yaml - which, like vars.sh is written into a shared container. However, since pods can't refresh environment variables when config maps update and because we're bundling those into a single services yaml file, we have a separate init container to maintain that. That container uses a custom shell script that uses the k8s client to watch config maps and formats the configured values themselves as yaml.
- Loading branch information
Showing
95 changed files
with
3,149 additions
and
70 deletions.
There are no files selected for viewing
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
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
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
39 changes: 39 additions & 0 deletions
39
TrafficCapture/dockerSolution/src/main/docker/k8sConfigMapUtilScripts/Dockerfile
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM amazonlinux:2023 | ||
|
||
ENV PIP_ROOT_USER_ACTION ignore | ||
ENV LANG C.UTF-8 | ||
|
||
RUN dnf install -y \ | ||
jq \ | ||
less \ | ||
python3.11 \ | ||
python3.11-devel \ | ||
python3.11-pip \ | ||
python3.11-wheel \ | ||
tar \ | ||
unzip \ | ||
vim \ | ||
wget \ | ||
&& \ | ||
dnf clean all && \ | ||
rm -rf /var/cache/dnf | ||
|
||
# Define the virtual environment path to use for all pipenv runs | ||
ENV WORKON_HOME=/ | ||
ENV PIPENV_CUSTOM_VENV_NAME=.venv | ||
ENV PIPENV_DEFAULT_PYTHON_VERSION=3.11 | ||
ENV PIPENV_MAX_DEPTH=1 | ||
|
||
RUN python3.11 -m pip install pipenv | ||
WORKDIR / | ||
RUN python3.11 -m venv .venv | ||
|
||
WORKDIR /root | ||
COPY Pipfile . | ||
COPY Pipfile.lock . | ||
RUN pipenv install --deploy | ||
|
||
COPY configmap2yaml/* /root/ | ||
RUN chmod ug+x /root/*.py | ||
|
||
ENTRYPOINT ["tail", "-f", "/dev/null"] |
14 changes: 14 additions & 0 deletions
14
TrafficCapture/dockerSolution/src/main/docker/k8sConfigMapUtilScripts/Pipfile
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
kubernetes = ">=30.1.0" | ||
pyyaml = ">=6.0.2" | ||
Jinja2 = ">=3.1.4" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.11" |
Oops, something went wrong.