-
Notifications
You must be signed in to change notification settings - Fork 67
K8S Deploy Updates: Combine Celery+Julia, Cron Restart of Pods #658
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0a21ca1
Add Jenkins pipeline for rolling restart of julia/celery containers
Bill-Becker 1d7ce9e
Add tada-jenkins-library to new Jenkinsfile pipeline file
Bill-Becker f2a40ad
Update cron time for restart-celery-julia
Bill-Becker 8ea0756
Add Julia container to the Celery pod for linking celery-to-julia for…
Bill-Becker 9a8f7f1
Update deploy resource values and reduce django workers from 8 to 4 w…
Bill-Becker d30a32c
Update celery pod to use localhost for juliaHost
Bill-Becker bcf9726
Fix JULIA_HOST name for local celery to Julia comm
Bill-Becker bae2a77
Fix indention of the celery container env section
Bill-Becker 83d0b3e
Change JULIA_HOST back to just "localhost"
Bill-Becker cd86fa6
Add HTTP access logging to Julia's HTTP server.
GUI 3d3998e
Attempt to setup Jenkinsfile to restart deployments
GUI e161e6d
Fixes for restart task
GUI ef657f7
Merge pull request #655 from NREL/celery-julia
Bill-Becker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,6 +1,4 @@ | ||
| appEnv: staging | ||
| djangoSettingsModule: reopt_api.staging_settings | ||
| juliaCpuRequest: "1000m" | ||
| juliaCpuLimit: "4000m" | ||
| juliaMemoryRequest: "8000Mi" | ||
| juliaMemoryLimit: "8000Mi" |
This file contains hidden or 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 hidden or 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,114 @@ | ||
| @Library("tada-jenkins-library") _ | ||
|
|
||
| pipeline { | ||
| agent any | ||
| environment { | ||
| TZ = 'America/Denver' // MST/MDT (handles daylight saving automatically) | ||
| DEPLOY_IMAGE_REPO_DOMAIN = credentials("reopt-api-image-repo-domain") | ||
| DEVELOPMENT_BASE_DOMAIN = credentials("reopt-api-development-base-domain") | ||
| DEVELOPMENT_TEMP_BASE_DOMAIN = credentials("reopt-api-development-temp-base-domain") | ||
| STAGING_BASE_DOMAIN = credentials("reopt-api-staging-base-domain") | ||
| STAGING_TEMP_BASE_DOMAIN = credentials("reopt-api-staging-temp-base-domain") | ||
| PRODUCTION_DOMAIN = credentials("reopt-api-production-domain") | ||
| XPRESS_LICENSE_HOST = credentials("reopt-api-xpress-license-host") | ||
| NREL_ROOT_CERT_URL_ROOT = credentials("reopt-api-nrel-root-cert-url-root") | ||
| } | ||
| triggers { | ||
| cron('15 13 * * *') // 1:15 PM MST/MDT | ||
| } | ||
|
|
||
| parameters { | ||
| booleanParam( | ||
| name: "DEVELOPMENT_DEPLOY", | ||
| defaultValue: false, | ||
| description: "Development Deploy: Deploy to development.", | ||
| ) | ||
|
|
||
| booleanParam( | ||
| name: "STAGING_DEPLOY", | ||
| defaultValue: false, | ||
| description: "Staging Deploy: Deploy to staging for a non-master branch (master will always be deployed).", | ||
| ) | ||
| } | ||
|
|
||
| stages { | ||
| stage("deploy-agent") { | ||
| agent { | ||
| docker { | ||
| image "${DEPLOY_IMAGE_REPO_DOMAIN}/tada-public/tada-jenkins-kube-deploy:werf-1.2" | ||
| args tadaDockerInDockerArgs() | ||
| } | ||
| } | ||
|
|
||
| environment { | ||
| TMPDIR = tadaDockerInDockerTmp() | ||
| } | ||
|
|
||
| stages { | ||
| stage('Rolling Restart Celery and Julia') { | ||
| stages { | ||
| stage("deploy-development") { | ||
| when { expression { params.DEVELOPMENT_DEPLOY } } | ||
|
|
||
| environment { | ||
| DEPLOY_ENV = "development" | ||
| } | ||
|
|
||
| steps { | ||
| withKubeConfig([credentialsId: "kubeconfig-nrel-reopt-prod4"]) { | ||
| tadaWithWerfEnv(rancherProject: "reopt-api-dev", primaryBranch: "master", dbBaseName: "reopt_api_development", baseDomain: "${DEVELOPMENT_BASE_DOMAIN}") { | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout restart deployment/reopt-api-celery-deployment" | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout status deployment/reopt-api-celery-deployment --timeout=10m" | ||
|
|
||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout restart deployment/reopt-api-julia-deployment" | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout status deployment/reopt-api-julia-deployment --timeout=10m" | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("deploy-staging") { | ||
| when { expression { params.STAGING_DEPLOY || env.BRANCH_NAME == "master" } } | ||
|
|
||
| environment { | ||
| DEPLOY_ENV = "staging" | ||
| } | ||
|
|
||
| steps { | ||
| withKubeConfig([credentialsId: "kubeconfig-nrel-reopt-prod4"]) { | ||
| tadaWithWerfEnv(rancherProject: "reopt-api-staging", primaryBranch: "master", dbBaseName: "reopt_api_staging", baseDomain: "${STAGING_BASE_DOMAIN}") { | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout restart deployment/reopt-api-celery-deployment" | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout status deployment/reopt-api-celery-deployment --timeout=10m" | ||
|
|
||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout restart deployment/reopt-api-julia-deployment" | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout status deployment/reopt-api-julia-deployment --timeout=10m" | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("deploy-production") { | ||
| when { branch "master" } | ||
|
|
||
| environment { | ||
| DEPLOY_ENV = "production" | ||
| } | ||
|
|
||
| steps { | ||
| withKubeConfig([credentialsId: "kubeconfig-nrel-reopt-prod5"]) { | ||
| tadaWithWerfEnv(rancherProject: "reopt-api-production", primaryBranch: "master") { | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout restart deployment/reopt-api-celery-deployment" | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout status deployment/reopt-api-celery-deployment --timeout=10m" | ||
|
|
||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout restart deployment/reopt-api-julia-deployment" | ||
| sh "kubectl -n '${env.DEPLOY_APP_NAMESPACE_NAME}' rollout status deployment/reopt-api-julia-deployment --timeout=10m" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -662,4 +662,4 @@ HTTP.register!(ROUTER, "GET", "/health", health) | |
| HTTP.register!(ROUTER, "GET", "/get_existing_chiller_default_cop", get_existing_chiller_default_cop) | ||
| HTTP.register!(ROUTER, "GET", "/get_ashp_defaults", get_ashp_defaults) | ||
| HTTP.register!(ROUTER, "GET", "/pv_cost_defaults", pv_cost_defaults) | ||
| HTTP.serve(ROUTER, "0.0.0.0", 8081, reuseaddr=true) | ||
| HTTP.serve(ROUTER, "0.0.0.0", 8081, reuseaddr=true, access_log=combined_logfmt) | ||
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting JULIA_HOST to 'localhost' hardcodes the assumption that Julia runs in the same pod. Consider using a configurable value or documenting this coupling to avoid confusion during future maintenance.