Documentation ¶
Overview ¶
Copyright Contributors to the Open Cluster Management project The content of this file mainly comes from https://github.com/open-cluster-management-io/policy-generator-plugin/blob/main/internal/utils.go
Index ¶
- func InitializeInMemoryKustomizeDir(fSys filesys.FileSystem, schema string) (err error)
- func KustomizeManifest(fSys filesys.FileSystem, kustomizationYAMLFile *KustomizeJSON) (manifests []map[string]interface{}, err error)
- func UnmarshalManifestFile(manifestPath string) ([]map[string]interface{}, error)
- func VerifyManifestPath(baseDirectory, manifestPath string) error
- type KustomizeJSON
- type ManifestPatcher
- type Openapi
- type Patch
- type Resources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeInMemoryKustomizeDir ¶
func InitializeInMemoryKustomizeDir(fSys filesys.FileSystem, schema string) (err error)
Initializes the in-memory file system with base directory and open API schema
func KustomizeManifest ¶
func KustomizeManifest(fSys filesys.FileSystem, kustomizationYAMLFile *KustomizeJSON) (manifests []map[string]interface{}, err error)
Runs Kustomize to apply patches in the in-memory file system
func UnmarshalManifestFile ¶
unmarshalManifestFile unmarshals the input object manifest/definition file into a slice in order to account for multiple YAML documents in the same file. If the file cannot be decoded or each document is not a map, an error will be returned.
func VerifyManifestPath ¶
verifyManifestPath verifies that the manifest path is in the directory tree under baseDirectory. An error is returned if it is not or the paths couldn't be properly resolved.
Types ¶
type KustomizeJSON ¶
type ManifestPatcher ¶
type ManifestPatcher struct { // The manifests to patch. Manifests []map[string]interface{} // The Kustomize patches to apply on the manifests. Note that modifications are made // to the input maps. If this is an issue, provide a deep copy of the patches. Patches []map[string]interface{} }
func (*ManifestPatcher) ApplyPatches ¶
func (m *ManifestPatcher) ApplyPatches(schema string) ([]map[string]interface{}, error)
ApplyPatches applies the Kustomize patches on the input manifests using Kustomize and returns the patched manifests. An error is returned if the patches can't be applied. This should be run after the Validate method.
func (*ManifestPatcher) Validate ¶
func (m *ManifestPatcher) Validate() error
Validate performs basic validatation of the manifests and patches. Any missing values in the patches that can be derived are added to the patches. An error is returned if a manifest or patch is invalid.