Skip to content
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

Option 'insecure' for Prometheus #121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions application/forms/PrometheusConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
]))
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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 ?? null) === 'true',
'disabled' => $kconfig[KConfig::PROMETHEUS_INSECURE]->locked ?? false,
'ignore' => $kconfig[KConfig::PROMETHEUS_INSECURE]->locked ?? false,
]
);

$this->addElement(
'text',
KConfig::transformKeyForForm(KConfig::PROMETHEUS_USERNAME),
Expand Down
2 changes: 2 additions & 0 deletions library/Kubernetes/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down