-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ingress and labels configs (#157)
* Add nginx-ingress-controller * Add labels config
- Loading branch information
George Kraft
authored
Dec 4, 2023
1 parent
54c3229
commit 0c62e90
Showing
5 changed files
with
558 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,25 @@ | ||
"""kubectl.""" | ||
|
||
import logging | ||
from subprocess import CalledProcessError, check_output | ||
|
||
from tenacity import retry, stop_after_delay, wait_exponential | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
@retry(stop=stop_after_delay(60), wait=wait_exponential()) | ||
def kubectl(*args): | ||
"""Run a kubectl cli command with a config file. | ||
Returns stdout and throws an error if the command fails. | ||
""" | ||
command = ["kubectl", "--kubeconfig=/root/.kube/config"] + list(args) | ||
log.info("Executing {}".format(command)) | ||
try: | ||
return check_output(command).decode("utf-8") | ||
except CalledProcessError as e: | ||
log.error( | ||
f"Command failed: {command}\nreturncode: {e.returncode}\nstdout: {e.output.decode()}" | ||
) | ||
raise |
Oops, something went wrong.