Skip to content

Commit

Permalink
Merge pull request #547 from kubeshop/feat/dry-run-config-types
Browse files Browse the repository at this point in the history
Feat/dry run config types
  • Loading branch information
monojack authored Oct 16, 2023
2 parents e3dfc5e + 367ef4a commit 3c91040
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-pets-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@monokle/types": minor
---

add dry-run config types
57 changes: 57 additions & 0 deletions packages/types/dry-run.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export type DryRunConfigKind = 'kustomize' | 'helm';

type Args = Array<Array<[string]>>;

interface BaseConfig {
workdir?: string;
kind: DryRunConfigKind;
version?: string;
command?: string;
}

interface HelmConfig extends BaseConfig {
kind: 'helm';
command?: 'template';
values?: string[];
output?: string;
set?: {
[k: string]: unknown;
};
args?: Args;
}

interface KustomizeConfig extends BaseConfig {
kind: 'kustomize';
command?: 'build';
env?: {
[k: string]: unknown;
};
enableHelm?: boolean;
output?: string;
reorder?: 'legacy' | 'none';
args?: Args;
}

export interface DryRunHelmConfig extends HelmConfig {
postRender?: Array<HelmConfig | Omit<DryRunKustomizeConfig, 'postRender'>>
}

export interface DryRunKustomizeConfig extends KustomizeConfig {
postRender?: Array<Omit<DryRunHelmConfig, 'postRender'> | Omit<DryRunKustomizeConfig, 'postRender'>>
}

export type DryRunConfig = DryRunKustomizeConfig | DryRunHelmConfig;

export interface DryRunConfigObject<
T extends DryRunConfig = DryRunConfig
> {
[key: string]: unknown;
apiVersion: string;
kind: 'DryRun';
metadata: {
name: string;
[k: string]: unknown;
};
include?: string[]; // regex of involved files, when changed it automatically re-renders
data: T;
}
6 changes: 6 additions & 0 deletions packages/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ export interface FingerprintSuppression extends ExternalSuppression {
kind: 'external';
fingerprint: string;
}

/**
* Dry-run configs
*/

export type * from './dry-run'

0 comments on commit 3c91040

Please sign in to comment.