-
Notifications
You must be signed in to change notification settings - Fork 136
NO-JIRA: hack: steps to run router locally #712
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
openshift-merge-bot
merged 1 commit into
openshift:master
from
jcmoraisjr:hack-local-debug
Mar 9, 2026
+246
−0
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,106 @@ | ||
| /openshift-router | ||
|
|
||
| # Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode | ||
|
|
||
| ### Emacs ### | ||
| # -*- mode: gitignore; -*- | ||
| *~ | ||
| \#*\# | ||
| /.emacs.desktop | ||
| /.emacs.desktop.lock | ||
| *.elc | ||
| auto-save-list | ||
| tramp | ||
| .\#* | ||
|
|
||
| # Org-mode | ||
| .org-id-locations | ||
| *_archive | ||
|
|
||
| # flymake-mode | ||
| *_flymake.* | ||
|
|
||
| # eshell files | ||
| /eshell/history | ||
| /eshell/lastdir | ||
|
|
||
| # elpa packages | ||
| /elpa/ | ||
|
|
||
| # reftex files | ||
| *.rel | ||
|
|
||
| # AUCTeX auto folder | ||
| /auto/ | ||
|
|
||
| # cask packages | ||
| .cask/ | ||
| dist/ | ||
|
|
||
| # Flycheck | ||
| flycheck_*.el | ||
|
|
||
| # server auth directory | ||
| /server/ | ||
|
|
||
| # projectiles files | ||
| .projectile | ||
| projectile-bookmarks.eld | ||
|
|
||
| # directory configuration | ||
| .dir-locals.el | ||
|
|
||
| # saveplace | ||
| places | ||
|
|
||
| # url cache | ||
| url/cache/ | ||
|
|
||
| # cedet | ||
| ede-projects.el | ||
|
|
||
| # smex | ||
| smex-items | ||
|
|
||
| # company-statistics | ||
| company-statistics-cache.el | ||
|
|
||
| # anaconda-mode | ||
| anaconda-mode/ | ||
|
|
||
| ### Go ### | ||
| # Binaries for programs and plugins | ||
| *.exe | ||
| *.exe~ | ||
| *.dll | ||
| *.so | ||
| *.dylib | ||
|
|
||
| # Test binary, build with 'go test -c' | ||
| *.test | ||
|
|
||
| # Output of the go coverage tool, specifically when used with LiteIDE | ||
| *.out | ||
|
|
||
| ### Vim ### | ||
| # swap | ||
| .sw[a-p] | ||
| .*.sw[a-p] | ||
| # session | ||
| Session.vim | ||
| # temporary | ||
| .netrwhist | ||
| # auto-generated tag files | ||
| tags | ||
|
|
||
| ### VisualStudioCode ### | ||
| .vscode/* | ||
| !.vscode/settings.json | ||
| !.vscode/tasks.json | ||
| !.vscode/extensions.json | ||
| .history | ||
|
|
||
| ### GoLand ### | ||
| .idea/* | ||
|
|
||
| # End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode |
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 |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eo pipefail | ||
|
|
||
| die() { echo "$*" >&2; exit 1; } | ||
|
|
||
| help() { | ||
| echo "Usage: $(basename "$0") <command>" | ||
| echo | ||
| echo " Commands:" | ||
| echo | ||
| echo " prepare: Prepares the environment without starting the router." | ||
| echo " Note that it kills any running HAProxy and cleans its" | ||
| echo " configuration directory." | ||
| echo " run: Prepares the environment and starts the router locally." | ||
| echo " help: Shows this help message." | ||
| exit 0 | ||
| } | ||
|
|
||
| router_prepare() { | ||
| # dropping any leaked haproxy instance that router did not have a chance to kill | ||
| killall haproxy 2>/dev/null || : | ||
|
|
||
| # copying mandatory files to HAProxy's configuration dir | ||
| readonly haproxydir="/var/lib/haproxy" | ||
| if ! [ -d "$haproxydir" ] || ! [ -w "$haproxydir" ]; then | ||
| echo "We're going to ask your sudo password in order to create and fix permission on $haproxydir" | ||
| sudo mkdir -p "$haproxydir" | ||
| sudo chown "${USER}:${USER}" "$haproxydir" | ||
| fi | ||
| rm -rf "${haproxydir}/{conf,run}" | ||
| mkdir -p "${haproxydir}/{conf,run}" | ||
| cp images/router/haproxy/conf/* "${haproxydir}/conf/" | ||
|
|
||
| echo "$haproxydir prepared" | ||
| } | ||
|
|
||
| router_run() { | ||
| # changing listening ports, we usually don't have permission to bind to the default ones 80/443 | ||
| ROUTER_SERVICE_HTTP_PORT=9090 ROUTER_SERVICE_HTTPS_PORT=9443 STATS_USERNAME=admin STATS_PASSWORD=admin STATS_PORT=1936 \ | ||
| go run -v ./cmd/openshift-router \ | ||
| --template images/router/haproxy/conf/haproxy-config.template \ | ||
| --reload images/router/haproxy/reload-haproxy | ||
| } | ||
|
|
||
| [ $# -ne 1 ] && help | ||
|
|
||
| # goes to repository root, we use relative paths | ||
| cd "$(dirname $0)/.." | ||
|
|
||
| case "$1" in | ||
| prepare) router_prepare;; | ||
| run) router_prepare; router_run;; | ||
| help) help;; | ||
| *) die "invalid command: $1";; | ||
| esac | ||
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.
It would be nice to have a check to make sure that the KUBECONFIG is set properly before running?
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.
I see, I'm not sure, I though about this and ended up choosing the simplicity, since router itself will check this for us - although its message isn't that clear:
What do you think from the user's perspective? I'm fine for both, either checking or letting router check for me.
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.
Ah okay then if router checks then fine