Commit 3155de28 authored by Russell Trow's avatar Russell Trow

Simplified Frontend view

parent af28d550
Pipeline #77760422 passed with stages
in 3 minutes and 29 seconds
......@@ -22,14 +22,13 @@ version = os.getenv('TIMBER_VERSION', '1.3')
liveness_probe_text = 'enabled and reachable at `/probe/liveness`'
readiness_probe_text = 'enabled and reachable at `/probe/readiness`'
description = '''Here's the configuration details for Timber right now:
`TIMBER_LIVENESS_PROBE_ENABLED` - The liveness probe is {liveness_probe}
`TIMBER_READINESS_PROBE_ENABLED` - The readiness probe is {readiness_probe}
`TIMBER_STATE` - The state management is set to `{state}`
`TIMBER_VERSION` - The version is `{version}`.
description = '''Configuration from Backend:
You can change all of these through environment variables.
Take a look at `configuration.py` to see how this works.'''.format(
`TIMBER_VERSION` - The version is `{version}`.
`TIMBER_LIVENESS_PROBE_ENABLED` - The liveness probe is {liveness_probe}
`TIMBER_READINESS_PROBE_ENABLED` - The readiness probe is {readiness_probe}
`TIMBER_STATE` - The state management is set to `{state}`
'''.format(
# Format it so it doesn't say True or False, but enabled or disabled
liveness_probe=liveness_probe_text if liveness_probe_enabled else 'disabled',
readiness_probe=readiness_probe_text if readiness_probe_enabled else 'disabled',
......
......@@ -13,8 +13,10 @@ namespace = os.getenv('MY_POD_NAMESPACE', 'unknown')
node = os.getenv('MY_NODE_NAME', 'unknown')
# We use this in `app.py`, to return on `/`
description = f'''This information comes from the Downward Kubernetes API:
My pod name is `{pod}`, on node `{node}` in namespace `{namespace}`, with IP `{ip}`.
Also, my hostname is `{hostname}`, but I knew that without asking the API!
This code resides in `metadata.py`.
description = f'''Downward Kubernetes API:
Pod name is `{pod}`
Node is `{node}`
Namespace is `{namespace}`
IP is `{ip}`
'''
......@@ -20,11 +20,9 @@ def hello():
# Description to return on the index page
description = [
f'Hello there! This is the frontend container. My hostname is {my_hostname}',
'On the other hand, all this information comes from the backend:',
api_data['redis_detection'].get('description', 'Unable to reach the backend.'),
api_data['metadata'].get('description', 'Unable to reach the backend.'),
api_data['configuration'].get('description', 'Unable to reach the backend.'),
# api_data['redis_detection'].get('description', 'Unable to reach the backend.'),
# api_data['metadata'].get('description', 'Unable to reach the backend.')
]
# Transforming the list into an HTML-worthy text
......@@ -35,6 +33,7 @@ def hello():
'index.html',
description=description,
hostname=api_data['metadata'].get('hostname'),
my_hostname=my_hostname,
hostname_color=api_data['colors'].get('hostname'),
version=api_data['configuration'].get('version'),
version_color=api_data['colors'].get('version'),
......
......@@ -11,14 +11,10 @@
body { background-color: #2740f8; font-family: 'Roboto', sans-serif; !important }
body.v1-0 { background-color: #27a9f8; }
.jumbotron { padding: 8rem 2rem; margin-bottom: 0; }
h1 { font-size: 5rem; }
h1, h2, h3 { font-weight: normal; }
.description { font-family: 'Roboto Mono', monospace; }
.stroke { -webkit-text-stroke-width: 1px; -webkit-text-stroke-color: #555555; }
.hostname { color: #{{hostname_color}}; }
.version { color: #{{version_color}}; }
.state { color: #{{state_color}}; }
.description { white-space: pre; }
h1 { font-size: 5rem; -webkit-text-stroke-width: 1px; -webkit-text-stroke-color: #555555; }
h2 { color: #{{hostname_color}}; }
p { font-family: 'Roboto Mono', monospace; white-space: pre; }
footer { text-align: center; font-size: 10px; padding-bottom: 32px; background-color: #e9ecef; }
</style>
</head>
......@@ -26,18 +22,22 @@
<main role="main">
<div class="jumbotron">
<div class="container">
<h1 class="stroke">Hello, this is Timber!</h1>
<h2 class="hostname stroke">Hostname: {{hostname}}</h2>
<h2 class="version stroke">Version: {{version}}</h2>
<h2 class="state stroke">State: <img src="{{state_image_link}}" width="100px"> has been shown {{state_hits}} times</h2>
<h1>Timber Frontend</h1>
<hr>
<h2>Hostname: {{hostname}}</h2>
<h2>Container: {{my_hostname}}</h2>
<h2>Version: {{version}}</h2>
<hr>
<p class="description">{{description}}</p>
<p>{{description}}</p>
</div>
</div>
</main>
<footer class="h3">
Timber was made with ❤️ by <a href="https://training.container-solutions.com?utm_source=timber_app">Container Solutions</a>
</footer>
<footer>Made with ❤️ by <a href="https://training.container-solutions.com?utm_source=timber_app">Container Solutions</a></footer>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment