Change include type to struct
This commit is contained in:
parent
2ca5e7394b
commit
77f1d0dcb9
54
examples/use/charts/vaultwardens.yaml
Normal file
54
examples/use/charts/vaultwardens.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
- name: vaultwarden
|
||||
repository: badhouseplants
|
||||
version: latest
|
||||
extensions:
|
||||
- name: Add virtual service to the chartc
|
||||
target_dir: templates/extensions
|
||||
source_dir: ./examples/extensions/vaultwarden
|
||||
patches:
|
||||
- name: Git patch 1
|
||||
git:
|
||||
path: ./examples/patches/git/patch.diff
|
||||
- name: Git patch 2
|
||||
git:
|
||||
path: ./examples/patches/git/patch-2.diff
|
||||
- name: yaml-fmt
|
||||
custom_command:
|
||||
commands:
|
||||
- |-
|
||||
cat <<EOT >> .yamlfmt
|
||||
formatter:
|
||||
pad_line_comments: 2
|
||||
EOT
|
||||
- yamlfmt values.yaml --conf ./yamlfmt.yaml
|
||||
- rm -f yamlfmt.yaml
|
||||
mirrors:
|
||||
- badhouseplants-git
|
||||
- custom-command
|
||||
- name: vaultwarden
|
||||
repository: badhouseplants
|
||||
version: latest
|
||||
extensions:
|
||||
- name: Add virtual service to the chartc
|
||||
target_dir: templates/extensions
|
||||
source_dir: ./examples/extensions/vaultwarden
|
||||
patches:
|
||||
- name: Git patch 1
|
||||
git:
|
||||
path: ./examples/patches/git/patch.diff
|
||||
- name: Git patch 2
|
||||
git:
|
||||
path: ./examples/patches/git/patch-2.diff
|
||||
- name: yaml-fmt
|
||||
custom_command:
|
||||
commands:
|
||||
- |-
|
||||
cat <<EOT >> .yamlfmt
|
||||
formatter:
|
||||
pad_line_comments: 2
|
||||
EOT
|
||||
- yamlfmt values.yaml --conf ./yamlfmt.yaml
|
||||
- rm -f yamlfmt.yaml
|
||||
mirrors:
|
||||
- badhouseplants-git
|
||||
- custom-command
|
@ -1,6 +1,7 @@
|
||||
# mirror charts
|
||||
include:
|
||||
Charts: ./examples/use/charts/vaultwarden.yaml
|
||||
- kind: Charts
|
||||
path: ./examples/use/charts/vaultwardens.yaml
|
||||
repositories:
|
||||
- name: metrics-server
|
||||
helm:
|
||||
|
@ -8,11 +8,17 @@ pub(crate) enum IncludeTypes {
|
||||
Repositories,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub(crate) struct Include {
|
||||
kind: IncludeTypes,
|
||||
path: String,
|
||||
}
|
||||
|
||||
pub(crate) fn apply_includes(config: &mut super::Config) -> Result<(), Box<dyn std::error::Error>> {
|
||||
for (kind, path) in config.include.clone().unwrap() {
|
||||
match kind {
|
||||
for include in config.include.clone().unwrap() {
|
||||
match include.kind {
|
||||
IncludeTypes::Charts => {
|
||||
let mut charts = include_chart(path)?;
|
||||
let mut charts = include_chart(include.path)?;
|
||||
let extended_charts = match config.charts.clone() {
|
||||
Some(mut existing_charts) => {
|
||||
existing_charts.append(&mut charts);
|
||||
@ -23,7 +29,7 @@ pub(crate) fn apply_includes(config: &mut super::Config) -> Result<(), Box<dyn s
|
||||
config.charts = Some(extended_charts);
|
||||
},
|
||||
IncludeTypes::Mirrors => {
|
||||
let mut mirrors = include_mirrors(path)?;
|
||||
let mut mirrors = include_mirrors(include.path)?;
|
||||
let extended_mirrors = match config.mirrors.clone() {
|
||||
Some(mut existing_mirrors) => {
|
||||
existing_mirrors.append(&mut mirrors);
|
||||
@ -34,7 +40,7 @@ pub(crate) fn apply_includes(config: &mut super::Config) -> Result<(), Box<dyn s
|
||||
config.mirrors = Some(extended_mirrors);
|
||||
},
|
||||
IncludeTypes::Repositories => {
|
||||
let mut repositories = include_repositories(path)?;
|
||||
let mut repositories = include_repositories(include.path)?;
|
||||
let extended_repositories = match config.repositories.clone() {
|
||||
Some(mut existing_repositories) => {
|
||||
existing_repositories.append(&mut repositories);
|
||||
|
@ -8,7 +8,7 @@ pub(crate) mod include;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub(crate) struct Config {
|
||||
pub(crate) include: Option<HashMap::<include::IncludeTypes, String>>,
|
||||
pub(crate) include: Option<Vec<include::Include>>,
|
||||
pub(crate) variables: Option<HashMap<String, String>>,
|
||||
pub(crate) repositories: Option<Vec<Repository>>,
|
||||
pub(crate) charts: Option<Vec<Chart>>,
|
||||
|
Loading…
Reference in New Issue
Block a user