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

247 add dev env #45

Merged
merged 12 commits into from
Dec 4, 2020
Merged

247 add dev env #45

merged 12 commits into from
Dec 4, 2020

Conversation

sshi100
Copy link
Contributor

@sshi100 sshi100 commented Nov 25, 2020

Major changes:

  • added 'start-dev-env.sh' and skaffold.yaml

How to run:

  • ./start-dev-env.sh

Related changes in infrastructure repo

  • add new policy 'k8s_developer_env_access' and assign to 'developer', Staging only
  • add 'create-application-dev-user' in Makefile with a new secret template, that collects new users in IAM developer group, and create db, user and secret for each user

templates/skaffold.yaml Outdated Show resolved Hide resolved
Comment on lines 97 to 104
rm -rf kubernetes.tmp && cp -pr kubernetes kubernetes.tmp
## image: set image definition
sed -i ".bak" "s|image: fake-image|image: ${ECR_REPO}:${VERSION_TAG}|g" kubernetes.tmp/base/deployment.yml
## ingress: create new domain with external DNS
sed -i ".bak" "s|${EXT_HOSTNAME}|${MY_EXT_HOSTNAME}|g" kubernetes.tmp/overlays/${CONFIG_ENVIRONMENT}/ingress.yml
## database_name: replace with new one
sed -i ".bak" "s|DATABASE_NAME=${DATABASE_NAME}|DATABASE_NAME=${DEV_DATABASE_NAME}|g" kubernetes.tmp/base/kustomization.yml
skaffold config set default-repo ${ECR_REPO} >& /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

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

There must be a better way to do this, maybe dynamically within skaffold itself.. We shouldn't be leaving this temp dir hanging around.

Copy link
Contributor Author

@sshi100 sshi100 Nov 26, 2020

Choose a reason for hiding this comment

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

decided to use kustomize build . | sed blahx blahy | kubectl apply -f -, instead of skaffold

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(from Bill) We also need to think about how the frontend works with this. I guess the idea is that they run the frontend locally but then they point it at myname-app.backend.com. But in that case we also need to make sure the backend has CORS set up properly to allow traffic from the local frontend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when they run the frontend locally, suggest they set /etc/host with 127.0.01 to app.backend.com and point api server with xxx-api.backend.com. Then, we don't need to change CORS.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, we don't want them to mess with their /etc/hosts, plus that would mess up any use of certificates. It's easy enough for us to set cors headers through the ingress definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided to add localhost to CORS. However, annonatation cors-allow-origin doesn't support multiple domains in the field, ref: kubernetes/ingress-nginx#5496

templates/start-dev-env.sh Outdated Show resolved Hide resolved
templates/start-dev-env.sh Outdated Show resolved Hide resolved
templates/start-dev-env.sh Outdated Show resolved Hide resolved
templates/README.md Outdated Show resolved Hide resolved
templates/start-dev-env.sh Outdated Show resolved Hide resolved
templates/start-dev-env.sh Outdated Show resolved Hide resolved
templates/start-dev-env.sh Outdated Show resolved Hide resolved
@sshi100 sshi100 merged commit 98cfdf5 into main Dec 4, 2020
@sshi100 sshi100 self-assigned this Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants