Skip to content

Commit

Permalink
Move elasticsearch to deployments repo (#1612)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjahl authored Aug 22, 2024
1 parent b7c13dd commit 054f00f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 263 deletions.
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.

0 comments on commit 054f00f

Please sign in to comment.