diff --git a/application/forms/PrometheusConfigForm.php b/application/forms/PrometheusConfigForm.php index af8770b1..1a2c2b1c 100644 --- a/application/forms/PrometheusConfigForm.php +++ b/application/forms/PrometheusConfigForm.php @@ -26,6 +26,7 @@ public function getKConfig(string $clusterUuid): array $q = KConfig::on(Database::connection()) ->filter(Filter::equal('key', [ KConfig::PROMETHEUS_URL, + KConfig::PROMETHEUS_INSECURE, KConfig::PROMETHEUS_USERNAME, KConfig::PROMETHEUS_PASSWORD ])) @@ -72,6 +73,7 @@ protected function assemble(): void if ($clusterUuid !== $this->getPopulatedValue('old_cluster_uuid', $clusterUuid)) { $this->clearPopulatedValue('old_cluster_uuid'); $this->clearPopulatedValue('prometheus_url'); + $this->clearPopulatedValue('prometheus_insecure'); $this->clearPopulatedValue('prometheus_username'); $this->clearPopulatedValue('prometheus_password'); } @@ -105,6 +107,19 @@ protected function assemble(): void ] ); + $this->addElement( + 'checkbox', + KConfig::transformKeyForForm(KConfig::PROMETHEUS_INSECURE), + [ + 'label' => $this->translate('Insecure'), + 'checkedValue' => 'true', + 'uncheckedValue' => 'false', + 'value' => $kconfig[KConfig::PROMETHEUS_INSECURE]?->value === 'true', + 'disabled' => $kconfig[KConfig::PROMETHEUS_INSECURE]->locked ?? false, + 'ignore' => $kconfig[KConfig::PROMETHEUS_INSECURE]->locked ?? false, + ] + ); + $this->addElement( 'text', KConfig::transformKeyForForm(KConfig::PROMETHEUS_USERNAME), diff --git a/library/Kubernetes/Model/Config.php b/library/Kubernetes/Model/Config.php index 1c692024..33b9ea20 100644 --- a/library/Kubernetes/Model/Config.php +++ b/library/Kubernetes/Model/Config.php @@ -31,6 +31,8 @@ class Config extends Model public const PROMETHEUS_URL = 'prometheus.url'; + public const PROMETHEUS_INSECURE = 'prometheus.insecure'; + public const PROMETHEUS_USERNAME = 'prometheus.username'; public const PROMETHEUS_PASSWORD = 'prometheus.password';