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

chore: Add support for us region to replace saas #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ ENV VIRTUAL_ENV=1
ENV SENTRY_KUBE_INSTALL_GIT_HOOKS=0
ENV SENTRY_KUBE_ROOT="/work"
ENV SENTRY_KUBE_NO_CONTEXT="1"
ENV SENTRY_KUBE_CUSTOMER="saas"
ENV SENTRY_KUBE_CUSTOMER="us"

RUN /install.sh && rm -rf /root/.cache

### Prepare the working directory
WORKDIR /work
# Dummy context to make sentry-kube happy
RUN mkdir -p k8s/clusters && echo '{"context": "_empty", "services": []}' > k8s/clusters/default.yaml
RUN echo "{sites: {saas_us: {name: us, region: us-central1, zone: b}}, silo_regions: {saas: {bastion: " >> configuration.yaml
RUN echo "{sites: {saas_us: {name: us, region: us-central1, zone: b}}, silo_regions: {us: {bastion: " >> configuration.yaml
RUN echo "{spawner_endpoint: 'https://test', site: saas_us}, k8s: {root: k8s, cluster_def_root: " >> configuration.yaml
RUN echo "clusters, materialized_manifests: materialized_manifests}}}}" >> configuration.yaml

Expand Down
5 changes: 1 addition & 4 deletions libsentrykube/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,14 @@ def report_terragrunt_event(
if "terraform/" in os.getcwd():
tgroot = "terraform"
tgslice = os.getcwd().split("terraform/")[1]
region = "saas"
region = "us"
elif "terragrunt/" in os.getcwd():
tgroot = "terragrunt"
tgslice = os.getcwd().split("terragrunt/")[1].split("/.terragrunt-cache/")[0]
region = tgslice.split("/")[-1]
else:
raise RuntimeError("Unable to determine what slice you're running in.")

if region == "us":
region = "saas"

sentry_region = Config().silo_regions[region].sentry_region

user = getpass.getuser()
Expand Down
9 changes: 7 additions & 2 deletions sentry_kube/cli/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
You may specify up to {TTL_MAX} and as low as {TTL_MIN}.
"""
)
@click.argument("customer", default="saas")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets remove this default.

@click.argument("customer")
@click.option("--ttl", type=int, required=False, default=TTL_DEFAULT)
@click.option("--site", "site_name", type=click.Choice(Site.names()), required=False)
@click.option("--zone", "zone_override", type=str, required=False, default=None)
Expand All @@ -60,7 +60,12 @@ def connect(ctx, *, customer, ttl, site_name, zone_override, use_standard_ssh_po
click.echo(f"Operating on google project '{customer_google_project}'")

service_ips = []
if customer != "saas" and customer != "test-control" and customer != "de":
if (
customer != "saas"
and customer != "test-control"
and customer != "de"
and customer != "us"
):
Comment on lines +63 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this should be a flag in the config .

service_ips = [
f"{ip}/32"
for ip in get_service_ip_mapping(
Expand Down
2 changes: 1 addition & 1 deletion sentry_kube/cli/kafkactl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sentry-kube
# -C saas
# -C us
# run-pod
# --exec
# -it
Expand Down
2 changes: 1 addition & 1 deletion sentry_kube/cli/run_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def run_pod(
):
customer_name = ctx.obj.customer_name

if customer_name == "saas" or customer_name == "de":
if customer_name == "saas" or customer_name == "de" or customer_name == "us":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, this should be a config flag.

default_service, default_deployment = (
"getsentry",
"getsentry-worker-save-production",
Expand Down
Loading