-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RELENG-6059 add the ability to add more relabel jobs
- Loading branch information
Showing
12 changed files
with
280 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-config | ||
data: | ||
config.yaml: |- | ||
{{ .Values.config | toYaml | indent 4 }} |
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,55 @@ | ||
import yaml | ||
from enum import Enum | ||
from pathlib import Path | ||
from typing import Dict, Any, List, Optional | ||
|
||
from pydantic import BaseModel, BaseSettings | ||
|
||
|
||
def yaml_config_settings_source(settings: BaseSettings) -> Dict[str, Any]: | ||
""" | ||
A simple settings source that loads variables from a yaml file | ||
""" | ||
config_file: Path = settings.__config__.config.config_file | ||
if config_file: | ||
return yaml.full_load(config_file.read_text()) | ||
return {} | ||
|
||
|
||
class RelabelType(str, Enum): | ||
name = 'name' | ||
label = 'label' | ||
|
||
|
||
class Relabel(BaseModel): | ||
label: str | ||
type: RelabelType = RelabelType.label | ||
description: Optional[str] | ||
default: Optional[str] = None | ||
values: List[str] | ||
|
||
|
||
class ConfigFile(BaseSettings): | ||
config_file: Optional[Path] | ||
|
||
|
||
class Settings(BaseSettings): | ||
job_relabelling: Optional[List[Relabel]] = [] | ||
|
||
class Config: | ||
config: ConfigFile = ConfigFile() | ||
|
||
@classmethod | ||
def customise_sources( | ||
cls, | ||
init_settings, | ||
env_settings, | ||
file_secret_settings, | ||
): | ||
return ( | ||
init_settings, | ||
yaml_config_settings_source, | ||
env_settings, | ||
file_secret_settings, | ||
) |
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
Oops, something went wrong.