mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-11 23:50:06 +01:00
helm: add support for --api-versions (#38)
This commit is contained in:
parent
473fb3ae50
commit
ea469ff77a
2 changed files with 15 additions and 1 deletions
|
|
@ -15,12 +15,15 @@ with lib;
|
||||||
, includeCRDs ? false
|
, includeCRDs ? false
|
||||||
# whether to include hooks
|
# whether to include hooks
|
||||||
, noHooks ? false
|
, noHooks ? false
|
||||||
|
# Kubernetes api versions used for Capabilities.APIVersions (--api-versions)
|
||||||
|
, apiVersions ? null
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
valuesJsonFile = builtins.toFile "${name}-values.json" (builtins.toJSON values);
|
valuesJsonFile = builtins.toFile "${name}-values.json" (builtins.toJSON values);
|
||||||
# The `helm template` and YAML -> JSON steps are separate `runCommand` derivations for easier debuggability
|
# The `helm template` and YAML -> JSON steps are separate `runCommand` derivations for easier debuggability
|
||||||
resourcesYaml = runCommand "${name}.yaml" { nativeBuildInputs = [ kubernetes-helm ]; } ''
|
resourcesYaml = runCommand "${name}.yaml" { nativeBuildInputs = [ kubernetes-helm ]; } ''
|
||||||
helm template "${name}" \
|
helm template "${name}" \
|
||||||
|
${optionalString (apiVersions != null && apiVersions != []) "--api-versions ${lib.strings.concatStringsSep "," apiVersions}"} \
|
||||||
${optionalString (kubeVersion != null) "--kube-version ${kubeVersion}"} \
|
${optionalString (kubeVersion != null) "--kube-version ${kubeVersion}"} \
|
||||||
${optionalString (namespace != null) "--namespace ${namespace}"} \
|
${optionalString (namespace != null) "--namespace ${namespace}"} \
|
||||||
${optionalString (values != {}) "-f ${valuesJsonFile}"} \
|
${optionalString (values != {}) "-f ${valuesJsonFile}"} \
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,17 @@ in
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
apiVersions = mkOption {
|
||||||
|
description = ''
|
||||||
|
Inform Helm about which CRDs are available in the cluster (`--api-versions` option).
|
||||||
|
This is useful for charts which contain `.Capabilities.APIVersions.Has` checks.
|
||||||
|
If you use `kubernetes.customTypes` to make kubenix aware of CRDs, it will include those as well by default.
|
||||||
|
'';
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = builtins.map (customType: "${customType.group}/${customType.version}")
|
||||||
|
(builtins.attrValues globalConfig.kubernetes.customTypes);
|
||||||
|
};
|
||||||
|
|
||||||
objects = mkOption {
|
objects = mkOption {
|
||||||
description = "Generated kubernetes objects";
|
description = "Generated kubernetes objects";
|
||||||
type = types.listOf types.attrs;
|
type = types.listOf types.attrs;
|
||||||
|
|
@ -111,7 +122,7 @@ in
|
||||||
}];
|
}];
|
||||||
|
|
||||||
config.objects = importJSON (helm.chart2json {
|
config.objects = importJSON (helm.chart2json {
|
||||||
inherit (config) chart name namespace values kubeVersion includeCRDs noHooks;
|
inherit (config) chart name namespace values kubeVersion includeCRDs noHooks apiVersions;
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
default = { };
|
default = { };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue