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

Move elasticsearch to deployments repo #1612

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions deploy/deployctl/subcommands/elasticsearch.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
import argparse
import os
import subprocess
import sys
import typing

import jinja2

from deployctl.shell import kubectl


def deployment_directory() -> str:
return os.path.realpath(os.path.join(os.path.dirname(__file__), "../../manifests/elasticsearch"))


def render_template_and_apply(
template_path: str, context: typing.Optional[typing.Dict[str, typing.Any]] = None
) -> None:
if not context:
context = {}

with open(template_path) as template_file:
template = jinja2.Template(template_file.read())
manifest = template.render(**context)

kubectl(["apply", "-f", "-"], input=manifest)


def apply_elasticsearch(**kwargs) -> None:
render_template_and_apply(os.path.join(deployment_directory(), "elasticsearch.yaml.jinja2"), kwargs)
render_template_and_apply(os.path.join(deployment_directory(), "elasticsearch.load-balancer.yaml.jinja2"), kwargs)


def get_elasticsearch_cluster(cluster_name: str, namespace: str) -> None:
print(kubectl([f"-n={namespace}", "get", "elasticsearch", cluster_name]), end="")


def get_elasticsearch_password(cluster_name: str, namespace: str) -> None:
# ECK creates this secret when the cluster is created.
print(
Expand Down Expand Up @@ -81,17 +52,6 @@ def main(argv: typing.List[str]) -> None:
parser = argparse.ArgumentParser(prog="deployctl")
subparsers = parser.add_subparsers()

apply_parser = subparsers.add_parser("apply")
apply_parser.set_defaults(action=apply_elasticsearch)
apply_parser.add_argument("--cluster-name", default="gnomad")
apply_parser.add_argument("--n-ingest-pods", type=int, default=0)
apply_parser.add_argument("--namespace", default="default")

get_parser = subparsers.add_parser("get")
get_parser.set_defaults(action=get_elasticsearch_cluster)
get_parser.add_argument("--cluster-name", default="gnomad")
get_parser.add_argument("--namespace", default="default")

get_parser = subparsers.add_parser("get-password")
get_parser.set_defaults(action=get_elasticsearch_password)
get_parser.add_argument("--cluster-name", default="gnomad")
Expand Down
6 changes: 3 additions & 3 deletions deploy/docs/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ First install the operator with the steps as documented: [Elastic Cloud on Kuber

To check if the operator is ready, run `kubectl -n elastic-system get statefulset.apps/elastic-operator`.

If you are using a custom cluster (e.g. `gnomad-myname`) ensure `environment_tag` in `deployctl_config.json` is set to `myname`.

To create an Elasticsearch cluster, run `./deployctl elasticsearch apply`.

After creating the cluster, store the password in a secret so that Dataproc jobs can access it.
Run `kubectl apply -k .` in the appropriate environment folder in [gnomad-deployments/elasticsearch](https://github.com/broadinstitute/gnomad-deployments/tree/main/elasticsearch).

After creating the cluster, store the password in a secret so that Dataproc jobs can access it. The `prod` kustomization includes a [PushSecret](https://github.com/broadinstitute/gnomad-deployments/blob/main/elasticsearch/prod/pushsecret.yaml) manifest that will update the secret in in the GCP secret manager for you.

## Deploy Redis

Expand Down

This file was deleted.

202 changes: 0 additions & 202 deletions deploy/manifests/elasticsearch/elasticsearch.yaml.jinja2

This file was deleted.

Loading