Documentation
¶
Overview ¶
Package oachecker lints an OlaresApp (`oac`) chart directory. It validates the OlaresManifest.yaml against its declared apiVersion, dry-runs the helm chart to inspect the resulting workloads, and produces the deduped image list that downstream tooling needs.
A typical caller uses one of the top-level convenience functions:
oac.LintChart("./myapp", oac.WithOwnerAdmin("alice"))
images, err := oac.ListImagesFromOAC("./myapp")
For more control, construct a Checker with New and call its methods directly.
Index ¶
- Constants
- Variables
- func AggregateErrors(errs []error) error
- func IsNewOlaresManifestVersion(version string) bool
- func Lint(oacPath string, opts ...Option) error
- func LintBothOwnerScenarios(oacPath string, extraOpts ...Option) error
- func ListImagesFromOAC(oacPath string, opts ...Option) ([]string, error)
- func ListImagesFromOACForMode(oacPath, mode string, opts ...Option) ([]string, error)
- func ListImagesFromOACForModes(oacPath string, modes []string, opts ...Option) ([]string, error)
- func ValidateAppConfiguration(cfg *AppConfiguration, opts ...Option) error
- func ValidateManifestContent(content []byte, opts ...Option) error
- func ValidateManifestFile(oacPath string, opts ...Option) error
- func WrapValidation(version string, err error) error
- type AppConfiguration
- type CustomValidator
- type EntranceInfo
- type Manifest
- type ManifestResourceLimits
- type ManifestVersions
- type OAC
- func (c *OAC) Admin() string
- func (c *OAC) CheckChartFolder(oacPath string) error
- func (c *OAC) CheckResources(oacPath string) error
- func (c *OAC) CheckSameVersion(oacPath string, m Manifest) error
- func (c *OAC) CheckServiceAccountRules(oacPath string) error
- func (c *OAC) Lint(oacPath string) error
- func (c *OAC) ListImages(oacPath string) ([]string, error)
- func (c *OAC) ListImagesForMode(oacPath, mode string) ([]string, error)
- func (c *OAC) ListImagesForModes(oacPath string, modes []string) ([]string, error)
- func (c *OAC) LoadAppConfiguration(oacPath string) (*AppConfiguration, error)
- func (c *OAC) LoadAppConfigurationContent(content []byte) (*AppConfiguration, error)
- func (c *OAC) LoadManifestContent(content []byte) (Manifest, error)
- func (c *OAC) LoadManifestFile(oacPath string) (Manifest, error)
- func (c *OAC) Owner() string
- func (c *OAC) ValidateAppConfiguration(cfg *AppConfiguration) error
- func (c *OAC) ValidateManifestContent(content []byte) error
- func (c *OAC) ValidateManifestFile(oacPath string) error
- type Option
- func SkipAppDataCheck() Option
- func SkipFolderCheck() Option
- func SkipHostPathCheck() Option
- func SkipManifestCheck() Option
- func SkipResourceCheck() Option
- func SkipResourceNamespaceCheck() Option
- func SkipSameVersionCheck() Option
- func SkipSecurityContextCheck() Option
- func WithAdmin(admin string) Option
- func WithAppDataValidator() Option
- func WithAutoOwnerScenarios() Option
- func WithCustomValidator(fn CustomValidator) Option
- func WithHostPathCheck() Option
- func WithOwner(owner string) Option
- func WithOwnerAdmin(value string) Option
- func WithResourceNamespaceCheck() Option
- func WithSameVersionCheck() Option
- func WithSecurityContextCheck() Option
- func WithServiceAccountRulesCheck() Option
- func WithValues(extra map[string]interface{}) Option
- func WithoutAutoOwnerScenarios() Option
- type ValidationError
Constants ¶
const AllModes = "all"
AllModes is the literal keyword that ListImagesForModes / the related top-level shortcuts expand into AllImageRenderModes. Matched case-insensitively so "ALL", "All", "all" all mean the same thing.
const ManifestFileName = "OlaresManifest.yaml"
ManifestFileName is the well-known file name that holds the OlaresManifest.
const NewOlaresManifestVersion = "0.12.0"
NewOlaresManifestVersion is the threshold (inclusive) at which the OlaresManifest parsing pipeline switches from the legacy helm-template path to the literal-parse path. Manifests whose olaresManifest.version is at or above this version are considered "new" by IsNewOlaresManifestVersion.
Variables ¶
var AllImageRenderModes = []string{
"cpu",
"apple-m",
"nvidia",
"nvidia-gb10",
"mthreads-m1000",
"strix-halo",
}
AllImageRenderModes is the ordered list of .Values.GPU.Type values that "all" expands into when ListImagesForModes (or its top-level shortcut) is invoked. Each mode triggers a separate helm render under the matching GPU-Type override; the union of workload images across every render is deduped and returned alongside options.images.
The list intentionally mirrors the resource modes the Olares app store advertises, not the broader resource_mode enum that OlaresManifest validation accepts (validResourceModes). They can diverge over time: a mode may still be a valid manifest value while no longer being part of the default image-extraction set, and vice versa. Callers that want to drive image extraction off the manifest's own spec.resources[] can build their own slice from cfg.Spec.Resources instead of passing "all".
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented is returned by manifest strategies whose validation logic has not been implemented yet (e.g. v2 scaffold).
Functions ¶
func AggregateErrors ¶
AggregateErrors combines multiple errors into one. Returns nil when the input is empty or all entries are nil. The input slice is not modified.
func IsNewOlaresManifestVersion ¶
IsNewOlaresManifestVersion reports whether the given olaresManifest.version is at or above the NewOlaresManifestVersion (0.12.0) threshold. Empty or malformed versions return false (treated as legacy).
This is the same predicate downstream tooling (e.g. app-service) needs in order to branch between legacy-only logic and modern-manifest behaviour without re-implementing the semver comparison.
func LintBothOwnerScenarios ¶
LintBothOwnerScenarios runs Lint twice: once with owner == admin (cluster admin install) and once with owner != admin (regular user install). Both scenarios must pass.
This is kept as a named shortcut for Lint with WithAutoOwnerScenarios appended to the caller's options.
func ListImagesFromOAC ¶
ListImagesFromOAC is the Checker-less shortcut for (*Checker).ListImages.
func ListImagesFromOACForMode ¶
ListImagesFromOACForMode is the Checker-less shortcut for (*Checker).ListImagesForMode.
func ListImagesFromOACForModes ¶
ListImagesFromOACForModes is the Checker-less shortcut for (*Checker).ListImagesForModes. Use it when you want to extract images across several GPU-Type modes (or the "all" keyword) without holding a Checker yourself.
func ValidateAppConfiguration ¶
func ValidateAppConfiguration(cfg *AppConfiguration, opts ...Option) error
ValidateAppConfiguration is the Checker-less shortcut for one-off callers. Options behave identically to the Checker form (today only SkipManifestCheck is meaningful here; the rest don't apply to a bare *AppConfiguration).
func ValidateManifestContent ¶
ValidateManifestContent is the byte-slice counterpart of ValidateManifestFile.
func ValidateManifestFile ¶
ValidateManifestFile is the Checker-less shortcut for one-off callers.
func WrapValidation ¶
WrapValidation converts an ozzo validation.Errors map into a sorted, stable, multi-line ValidationError. If err is nil it returns nil. If err is not a validation.Errors it is wrapped as a single-message ValidationError.
Types ¶
type AppConfiguration ¶
type AppConfiguration = apimanifest.AppConfiguration
AppConfiguration is the parsed OlaresManifest.yaml payload. It is a direct type alias onto github.com/beclab/api/manifest.AppConfiguration, so reading every field works out of the box:
cfg, _ := oac.LoadAppConfiguration("./myapp")
for _, e := range cfg.Entrances { fmt.Println(e.Name, e.Port) }
When you also need to construct sub-structs (AppMetaData, Entrance, Options, ResourceMode, …) — for tests, generators, or programmatic edits — import github.com/beclab/api/manifest (and, for Entrance and friends, github.com/beclab/api/api/app.bytetrade.io/v1alpha1) directly:
import (
"github.com/beclab/oac"
"github.com/beclab/api/manifest"
appv1 "github.com/beclab/api/api/app.bytetrade.io/v1alpha1"
)
cfg.Spec.SubCharts = append(cfg.Spec.SubCharts, manifest.Chart{...})
cfg.Entrances = append(cfg.Entrances, appv1.Entrance{...})
Because everything is type-aliased (not a new named type), values flow freely between oac and the upstream api packages without conversion.
func AsAppConfiguration ¶
func AsAppConfiguration(m Manifest) (*AppConfiguration, bool)
AsAppConfiguration unwraps a Manifest into the concrete *AppConfiguration. The second return value is false when the manifest was produced by a future Strategy whose Raw() type is not AppConfiguration; today every Strategy in the tree returns one, so the boolean is a forward-compat hook rather than a runtime concern.
func LoadAppConfiguration ¶
func LoadAppConfiguration(oacPath string, opts ...Option) (*AppConfiguration, error)
LoadAppConfiguration is the Checker-less shortcut for one-off callers.
func LoadAppConfigurationContent ¶
func LoadAppConfigurationContent(content []byte, opts ...Option) (*AppConfiguration, error)
LoadAppConfigurationContent is the byte-slice counterpart.
type CustomValidator ¶
CustomValidator is invoked with the chart directory path and the parsed Manifest after the built-in structural checks have run.
type EntranceInfo ¶
type EntranceInfo = manifest.EntranceInfo
EntranceInfo is a lightweight view of a manifest entrance shared between versions.
type Manifest ¶
Manifest is the cross-version, read-only view of a parsed OlaresManifest. Raw() yields *github.com/beclab/api/manifest.AppConfiguration (same type as oac.AppConfiguration — the two are type-aliased together).
type ManifestResourceLimits ¶
type ManifestResourceLimits = manifest.ResourceRequirementLimits
ManifestResourceLimits is the full resource envelope (CPU, memory, disk, GPU required/limited pairs) for one spec.resources[] mode row.
func ResourceLimitsForResourceMode ¶
func ResourceLimitsForResourceMode(cfg *AppConfiguration, mode string) (ManifestResourceLimits, error)
ResourceLimitsForResourceMode returns required/limited CPU, memory, disk, and GPU for the spec.resources[] element whose mode matches (case-insensitive). The inline ResourceRequirement on the matched row is returned verbatim — empty fields stay empty.
type ManifestVersions ¶
ManifestVersions is the lightweight pair of top-level version fields read from raw OlaresManifest.yaml before full parsing. APIVersion is the value after the apiVersion key; OlaresManifestVersion is the value after olaresManifest.version.
func PeekManifestVersions ¶
func PeekManifestVersions(content []byte) (ManifestVersions, error)
PeekManifestVersions extracts apiVersion and olaresManifest.version from content using the same line-oriented probe as the manifest parsing pipeline (tolerates unrendered Helm template fragments in the scalar). Missing keys yield empty strings; only I/O-style scanner failures produce a non-nil error.
type OAC ¶
type OAC struct {
// contains filtered or unexported fields
}
OAC is a reusable lint context. All fields are private; build one via New(opts...) and the With*/Skip* option helpers.
func New ¶
New builds a Checker with the given options applied on top of the default configuration:
- no owner/admin override (templates fall back to the "default" placeholder)
- owner/admin scenarios are NOT auto-expanded — the explicit owner/admin values are used as-is (see WithAutoOwnerScenarios)
- all built-in checks enabled EXCEPT ServiceAccount rule inspection (RBAC is off by default; the Chart.yaml <-> manifest same-version check runs by default — turn it off with SkipSameVersionCheck; the .Values.userspace.appdata template-vs-manifest cross-check runs by default — turn it off with SkipAppDataCheck; the hostPath + rolling-update incompatibility check runs by default — turn it off with SkipHostPathCheck; the rendered-resource namespace check runs by default — turn it off with SkipResourceNamespaceCheck)
func (*OAC) CheckChartFolder ¶
CheckChartFolder validates that oacPath is a structurally-valid chart directory (Chart.yaml/values.yaml/templates/OlaresManifest.yaml present, folder name well-formed).
func (*OAC) CheckResources ¶
CheckResources dry-runs the chart and performs the resource-list level limit check. The manifest is parsed implicitly.
apiVersion v2 skips this check entirely (returns nil). v1, v3, and empty apiVersion (v1 default) share the same logic: one helm render at oacPath for the legacy path, and per-mode renders at oacPath for modern manifests. A non-empty apiVersion outside v1/v2/v3 yields not supported version.
For legacy manifests (<0.12.0) the chart is rendered once and the container-level limits are compared against spec.required*/spec.limited*. For modern manifests (>=0.12.0) limits come from spec.resources[]; each mode drives its own helm render with .Values.GPU.Type set to rm.Mode.
func (*OAC) CheckSameVersion ¶
CheckSameVersion cross-validates the folder name, Chart.yaml metadata, and parsed manifest metadata. Provide nil for m to have it loaded on demand.
func (*OAC) CheckServiceAccountRules ¶
CheckServiceAccountRules inspects Role/ClusterRole bindings in the rendered chart and returns an error if any of them grants the ServiceAccount one of the built-in forbidden permissions.
func (*OAC) Lint ¶
Lint runs the full lint pipeline against oacPath. The exact set of checks executed depends on the Skip* options set on the Checker:
- Folder layout (chartfolder.CheckLayout) - skipped by SkipFolderCheck
- Manifest parse + ozzo validation - skipped by SkipManifestCheck
- Built-in .Values.userspace.appdata cross-check - skipped by SkipAppDataCheck (on by default)
- Custom validators registered via WithCustomValidator (none by default)
- Helm dry-run and mandatory workload-integrity checks (upload mount path, `type=app` workload naming) - ALWAYS run; not governed by any Skip* option
- HostPath + rolling-update incompatibility check - ON by default, turn off with SkipHostPathCheck()
- Rendered-resource namespace check (workloads in app-namespace; other resources in app-namespace or user-system-*) - ON by default, turn off with SkipResourceNamespaceCheck()
- Container-level resource limits check - skipped by SkipResourceCheck
- Chart.yaml <-> manifest same-version check - ON by default, turn off with SkipSameVersionCheck()
- ServiceAccount RBAC inspection - OFF by default, turn on with WithServiceAccountRulesCheck()
- Non-beclab image privileged securityContext check - OFF by default, turn on with WithSecurityContextCheck()
When WithAutoOwnerScenarios() is set, every owner-dependent step runs twice — once with owner == admin and once with owner != admin. That covers the rendered-chart steps (5/6/7/8/10) AND step 2's manifest validation, so manifests that branch on `eq .Values.admin .Values.bfl.username` are exercised in both install modes. Owner-independent steps (folder layout, appdata cross-check, same-version) still run once.
func (*OAC) ListImages ¶
ListImages returns the sorted, deduplicated set of container images used by oacPath. The set is the union of:
- Images discovered by walking the Deployment/StatefulSet/DaemonSet workloads produced by a helm dry-run (primary containers only).
- Images listed under options.images in OlaresManifest.yaml, which is how apps declare extra images that are pulled outside the chart (e.g. images referenced at runtime or by client-side tooling).
ListImages is the no-mode shortcut for ListImagesForMode -- the chart is rendered without any .Values.GPU.Type override, which surfaces the images of the chart's default (non-GPU) branch only.
func (*OAC) ListImagesForMode ¶
ListImagesForMode is the mode-aware variant of ListImages: it renders the chart with .Values.GPU.Type set to mode so chart templates that branch per GPU family (e.g. {{ if eq .Values.GPU.Type "nvidia" }}) emit the matching workload set. The returned list is still the union of those rendered workload images and options.images, sorted and deduplicated.
Passing an empty mode is identical to calling ListImages: no GPU.Type override is injected and the default branch of the chart renders.
func (*OAC) ListImagesForModes ¶
ListImagesForModes returns the union of container images across each .Values.GPU.Type mode in modes. The chart is helm-rendered once per expanded mode, the resulting Deployment/StatefulSet workload images are collected, then unioned with the manifest's options.images and returned as a sorted, deduplicated slice.
Mode semantics:
- A nil / empty modes slice is treated as a single render with no GPU.Type override, identical to ListImages.
- An empty string entry renders the chart's default branch (no override), same as ListImages.
- Any element equal to AllModes ("all", case-insensitive) expands in-place into AllImageRenderModes. Duplicates introduced by mixing "all" with explicit modes are collapsed, so each mode renders at most once per call.
- Other entries are passed straight through as the .Values.GPU.Type value for that mode's render.
Errors from any single render fail the whole call and identify the offending mode in the wrapping message.
func (*OAC) LoadAppConfiguration ¶
func (c *OAC) LoadAppConfiguration(oacPath string) (*AppConfiguration, error)
LoadAppConfiguration reads OlaresManifest.yaml from oacPath, runs it through the version-aware parsing pipeline, and returns the concrete *AppConfiguration. No validation is performed — pair with ValidateManifestFile or ValidateAppConfiguration if you also want structural checks. Legacy manifests (<0.12.0) are template-rendered with the Checker's owner/admin before parsing; modern (>=0.12.0) manifests are parsed verbatim.
func (*OAC) LoadAppConfigurationContent ¶
func (c *OAC) LoadAppConfigurationContent(content []byte) (*AppConfiguration, error)
LoadAppConfigurationContent is the byte-slice counterpart of LoadAppConfiguration.
func (*OAC) LoadManifestContent ¶
LoadManifestContent is the byte-slice counterpart of LoadManifestFile.
func (*OAC) LoadManifestFile ¶
LoadManifestFile reads OlaresManifest.yaml from oacPath and returns the parsed manifest. Legacy (<0.12.0) payloads are template-rendered with the checker's owner/admin before parsing; modern (>=0.12.0) payloads are parsed verbatim. No validation is performed here — use ValidateManifestFile for that.
func (*OAC) ValidateAppConfiguration ¶
func (c *OAC) ValidateAppConfiguration(cfg *AppConfiguration) error
ValidateAppConfiguration runs structural and cross-field validation on an already-parsed manifest. It applies the same rules as ValidateManifestFile / ValidateManifestContent but starts from an in-memory *AppConfiguration instead of raw YAML — no chart rendering, no folder check, no custom validators (those need an oacPath and the chart templates, which a bare *AppConfiguration cannot supply).
Respects SkipManifestCheck(): when set, the method returns nil without running any rule, consistent with how Lint and ValidateManifestFile react to the same option.
A nil cfg is treated as a validation failure rather than a panic. Failures are wrapped as *ValidationError keyed off cfg.APIVersion (defaults to "v1" when empty, matching the parsing pipeline).
func (*OAC) ValidateManifestContent ¶
ValidateManifestContent is the byte-slice counterpart of ValidateManifestFile. It honors WithAutoOwnerScenarios() the same way (manifest validation runs once per owner scenario).
func (*OAC) ValidateManifestFile ¶
ValidateManifestFile parses and validates oacPath/OlaresManifest.yaml. No chart rendering is performed. For legacy manifests (<0.12.0) the underlying pipeline re-parses the payload under both admin=owner and admin!=owner scenarios and aggregates any failures into a single ValidationError.
When WithAutoOwnerScenarios() is set, the manifest validation is repeated for each (owner, admin) pair (owner==admin / owner!=admin) so manifests whose body branches on `eq .Values.admin .Values.bfl.username` are exercised in both configurations. Failures from each scenario are aggregated into a single *ValidationError.
type Option ¶
type Option func(*OAC)
Option mutates a Checker built via New. Options are idempotent and safe to apply in any order.
func SkipAppDataCheck ¶
func SkipAppDataCheck() Option
SkipAppDataCheck disables the built-in template-vs-manifest cross-check that scans chart templates for .Values.userspace.appdata references and requires permission.appData in OlaresManifest.yaml when any are found. The check is enabled by default; only opt out when a caller knowingly renders appdata via a non-standard path.
func SkipFolderCheck ¶
func SkipFolderCheck() Option
SkipFolderCheck disables the chart-folder layout check.
func SkipHostPathCheck ¶
func SkipHostPathCheck() Option
SkipHostPathCheck disables the built-in hostPath + rolling-update incompatibility check. The check is on by default since combining a hostPath volume with a rolling update silently produces broken installations (the new pod can't see the old node's host directory); only opt out when a chart legitimately handles this in another way.
func SkipManifestCheck ¶
func SkipManifestCheck() Option
SkipManifestCheck disables OlaresManifest.yaml structural validation.
func SkipResourceCheck ¶
func SkipResourceCheck() Option
SkipResourceCheck disables the container-level resource-limits check.
Note: this option does NOT disable the upload-mount and workload-naming checks, which Lint always runs because they guard structural integrity (a chart that declares options.upload.dest but mounts it nowhere, or an app whose templates produce no Deployment/StatefulSet named after the app, is broken regardless of limit accounting).
func SkipResourceNamespaceCheck ¶
func SkipResourceNamespaceCheck() Option
SkipResourceNamespaceCheck disables the built-in rendered-resource namespace check. The check enforces that Deployment/StatefulSet/DaemonSet workloads land in "app-namespace" and that other namespaced resources land in "app-namespace" or a "user-system-*" namespace; cluster-scoped resources are skipped. It is on by default; only opt out when a chart legitimately renders resources into a different namespace.
func SkipSameVersionCheck ¶
func SkipSameVersionCheck() Option
SkipSameVersionCheck disables the Chart.yaml <-> manifest version consistency check. By default the check runs; callers that roll their own version-alignment step can opt out here.
func SkipSecurityContextCheck ¶
func SkipSecurityContextCheck() Option
SkipSecurityContextCheck clears the non-beclab image securityContext flag. The check is OFF by default, so calling this on a fresh Checker is a no-op; it exists for option-set composition where a previously applied set may have turned the check on.
func WithAppDataValidator ¶
func WithAppDataValidator() Option
WithAppDataValidator re-enables the built-in .Values.userspace.appdata cross-check after a previous option set (re)disabled it. The check is on by default since it is essentially a safety net against permission misconfiguration, so calling this on a fresh Checker is a no-op. Kept as a named option for backward compatibility — old call sites that used it to "register" the validator continue to compile and behave as before, modulo the fact that the check is no longer wired through customValidators (so it runs exactly once even when this option is passed multiple times).
func WithAutoOwnerScenarios ¶
func WithAutoOwnerScenarios() Option
WithAutoOwnerScenarios makes Lint / ValidateManifestFile / ValidateManifestContent ignore any explicit WithOwner / WithAdmin / WithOwnerAdmin values and instead run every owner-dependent step twice:
- owner == admin (cluster-admin install)
- owner != admin (regular user install)
This covers:
- The chart-rendering portion of Lint (helm dry-run + workload integrity checks, container resource limits, RBAC inspection).
- The manifest structural validation (validateManifestBytes), so OlaresManifest.yaml bodies that branch on `eq .Values.admin .Values.bfl.username` are exercised in both configurations.
Both scenarios must pass; failures are aggregated. Owner-independent steps (folder layout, appdata cross-check, same-version) still run once.
This is the programmatic equivalent of the LintBothOwnerScenarios helper — use it whenever the caller does not have a concrete owner/admin pair and wants the linter to cover both install modes automatically.
func WithCustomValidator ¶
func WithCustomValidator(fn CustomValidator) Option
WithCustomValidator adds a user-defined validator to the Checker.
func WithHostPathCheck ¶
func WithHostPathCheck() Option
WithHostPathCheck re-enables the built-in hostPath + rolling-update incompatibility check after a previous option set disabled it. The check is on by default, so calling this on a fresh Checker is a no-op.
func WithOwner ¶
WithOwner sets the .Values.bfl.username template value and the owner field used when rendering helm charts. When owner is empty the Checker keeps its existing value.
func WithOwnerAdmin ¶
WithOwnerAdmin sets both owner and admin to the same value, modelling the "installed as admin" scenario where the cluster administrator is also the acting user.
func WithResourceNamespaceCheck ¶
func WithResourceNamespaceCheck() Option
WithResourceNamespaceCheck re-enables the built-in rendered-resource namespace check after a previous option set disabled it. The check is on by default, so calling this on a fresh Checker is a no-op.
func WithSameVersionCheck ¶
func WithSameVersionCheck() Option
WithSameVersionCheck re-enables the Chart.yaml <-> manifest version consistency check. Mostly useful when composing an option set that had SkipSameVersionCheck baked in and a particular call-site wants it back on.
func WithSecurityContextCheck ¶
func WithSecurityContextCheck() Option
WithSecurityContextCheck enables the non-beclab image privileged securityContext check. The check rejects any container (init or main) whose image is NOT published under the beclab/ namespace and whose effective securityContext grants root-equivalent privileges (any of `privileged: true`, `runAsUser: 0`, `runAsNonRoot: false`, including the value inherited from a pod-level securityContext). It is disabled by default because some legacy charts still embed third-party images that need a manual review before this rule applies; turn it on explicitly when publishing to the app store.
func WithServiceAccountRulesCheck ¶
func WithServiceAccountRulesCheck() Option
WithServiceAccountRulesCheck enables the RBAC rule inspection which makes sure the chart doesn't grant ServiceAccounts forbidden permissions. It is disabled by default to match historical Lint behaviour; callers that need it can opt in explicitly.
func WithValues ¶
WithValues registers extra helm values that the Checker deep-merges on top of the scaffold produced by helmrender.BuildValues for every render it performs (Lint, ListImages / ListImagesForMode, CheckResources, CheckServiceAccountRules, ...). External keys win on conflicts: scalar keys are replaced wholesale, and when both sides are maps the merge recurses so siblings the caller did not override are preserved.
Multiple WithValues calls are additive -- each is merged into the already-accumulated extra-values map under the same precedence rules. Passing nil is a no-op.
The mode argument of ListImagesForMode and the per-mode loop in resource-limit checks always set .Values.GPU.Type AFTER WithValues is applied, so they keep winning over any GPU.Type the caller injected.
func WithoutAutoOwnerScenarios ¶
func WithoutAutoOwnerScenarios() Option
WithoutAutoOwnerScenarios clears the auto-owner flag, pinning Lint back to the explicit owner/admin values. Mostly useful when composing option sets that have WithAutoOwnerScenarios baked in and a particular call-site wants to opt out.
type ValidationError ¶
type ValidationError struct {
// Version is the manifest version (apiVersion) that produced the error,
// e.g. "v1" or "v2".
Version string
// Field is the dotted field path that failed, e.g. "metadata.name".
Field string
// Reason is a short human-readable explanation.
Reason string
// Inner is the underlying error if any (typically validation.Errors from ozzo).
Inner error
}
ValidationError describes a single failed manifest validation.
Callers should use errors.As to pull this out of the error chain returned by ValidateManifestFile / ValidateManifestContent / LintChart and friends.
func NewValidationError ¶
func NewValidationError(version, field, reason string) *ValidationError
NewValidationError constructs a single-field ValidationError.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
chartfolder
Package chartfolder implements the structural checks that verify a chart directory is well-formed (Chart.yaml / values.yaml / templates/ / OlaresManifest.yaml present) and that its metadata is consistent with the parsed manifest.
|
Package chartfolder implements the structural checks that verify a chart directory is well-formed (Chart.yaml / values.yaml / templates/ / OlaresManifest.yaml present) and that its metadata is consistent with the parsed manifest. |
|
helmrender
Package helmrender wraps helm's dry-run engine with a set of sensible fake values so oac can lint charts without talking to a real cluster.
|
Package helmrender wraps helm's dry-run engine with a set of sensible fake values so oac can lint charts without talking to a real cluster. |
|
resources
Package resources hosts cross-version resource-level checks that run over the kube.ResourceList produced by helmrender.Render.
|
Package resources hosts cross-version resource-level checks that run over the kube.ResourceList produced by helmrender.Render. |