Skip to content

Commit

Permalink
fix k8s issues and UI instances bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian committed Nov 1, 2024
1 parent 1949e22 commit 645e9df
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Changelog

## v1.5.10 - ????/??/??
## v1.5.11 - ????/??/??

- [BUGFIX] Fix INTERCEPTED_ERROR_CODES to allow empty value
- [UI] Fix missing settings when a service is published online
- [UI] Fix instances always down in instances page
- [AUTOCONF] Fix BW env vars not retrieved
- [AUTOCONF] Fix deadlock on k8s events when there is no ingress
- [LINUX] Increase default worker dict size to avoid crash on RPI
- [MISC] Add WORKERLOCK_MEMORY_SIZE setting for worker dict size
- [MISC] Add API_TIMEOUT and API_READ_TIMEOUT settings to control API timeouts

## v1.5.10 - 2024/09/17

- [UI] Fix setup wizard bug related to certificate
- [UI] Fix bug when adding more than 3 reverse proxies URLs
Expand Down
6 changes: 2 additions & 4 deletions docs/web-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ Review your final BunkerWeb UI URL and then click on the `Setup` button. Once th
- name: KUBERNETES_MODE
value: "YES"
- name: DATABASE_URI
value: "mariadb+pymysql://bunkerweb:testor@svc-bunkerweb-db:3306/db"
value: "mariadb+pymysql://bunkerweb:changeme@svc-bunkerweb-db:3306/db"
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -736,7 +736,6 @@ Review your final BunkerWeb UI URL and then click on the `Setup` button. Once th
resources:
requests:
storage: 5Gi
volumeName: pv-bunkerweb
```

=== "Linux"
Expand Down Expand Up @@ -1546,7 +1545,7 @@ After a successful login/password combination, you will be prompted to enter you
- name: KUBERNETES_MODE
value: "YES"
- name: DATABASE_URI
value: "mariadb+pymysql://bunkerweb:testor@svc-bunkerweb-db:3306/db"
value: "mariadb+pymysql://bunkerweb:changeme@svc-bunkerweb-db:3306/db"
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -1609,7 +1608,6 @@ After a successful login/password combination, you will be prompted to enter you
resources:
requests:
storage: 5Gi
volumeName: pv-bunkerweb
---
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down
3 changes: 1 addition & 2 deletions misc/integrations/k8s.mariadb.ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ spec:
- name: KUBERNETES_MODE
value: "YES"
- name: "DATABASE_URI"
value: "mariadb+pymysql://bunkerweb:testor@svc-bunkerweb-db:3306/db"
value: "mariadb+pymysql://bunkerweb:changeme@svc-bunkerweb-db:3306/db"
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -303,7 +303,6 @@ spec:
resources:
requests:
storage: 5Gi
volumeName: pv-bunkerweb
---
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down
14 changes: 8 additions & 6 deletions src/autoconf/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,24 @@ def _update_settings(self):
self._settings.update(plugin["settings"])

def __get_full_env(self) -> dict:
env_instances = {"SERVER_NAME": ""}
config = {"SERVER_NAME": "", "MULTISITE": "yes"}

for instance in self.__instances:
for variable, value in instance["env"].items():
env_instances[variable] = value
if not self._db.is_setting(variable):
self.__logger.warning(f"Variable {variable}: {value} is not a valid setting, ignoring it")
continue
config[variable] = value

config = {"SERVER_NAME": "", "MULTISITE": "yes"}
for service in self.__services:
server_name = service["SERVER_NAME"].split(" ")[0]
if not server_name:
continue
for variable, value in chain(env_instances.items(), service.items()):
for variable, value in service.items():
if variable.startswith("CUSTOM_CONF") or not variable.isupper():
continue
if not self._db.is_setting(variable, multisite=True):
if variable in service:
self.__logger.warning(f"Variable {variable}: {value} is not a valid multisite setting, ignoring it")
self.__logger.warning(f"Variable {variable}: {value} is not a valid multisite setting, ignoring it")
continue
config[f"{server_name}_{variable}"] = value
config["SERVER_NAME"] += f" {server_name}"
Expand Down
3 changes: 0 additions & 3 deletions src/autoconf/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ def _set_autoconf_load_db(self):
self._loaded = True

def get_services(self):
while not self._get_controller_services():
sleep(1)

services = []
for controller_service in self._get_controller_services():
services.extend(self._to_services(controller_service))
Expand Down
4 changes: 2 additions & 2 deletions src/ui/src/Instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ def get_instances(self, override_instances=None) -> list[Instance]:
if pod.metadata.annotations is not None and "bunkerweb.io/INSTANCE" in pod.metadata.annotations:
env_variables = {env.name: env.value or "" for env in pod.spec.containers[0].env}

status = "up"
status = "down"
if pod.status.conditions is not None:
for condition in pod.status.conditions:
if condition.type == "Ready" and condition.status == "True":
status = "down"
status = "up"
break

instances.append(
Expand Down

0 comments on commit 645e9df

Please sign in to comment.