...

Source file src/sigs.k8s.io/kustomize/kyaml/fn/framework/parser/doc.go

Documentation: sigs.k8s.io/kustomize/kyaml/fn/framework/parser

     1  // Copyright 2021 The Kubernetes Authors.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  // Package parser contains implementations of the framework.TemplateParser and framework.SchemaParser interfaces.
     5  // Typically, you would use these in a framework.TemplateProcessor.
     6  //
     7  // Example:
     8  //
     9  //	processor := framework.TemplateProcessor{
    10  //		ResourceTemplates: []framework.ResourceTemplate{{
    11  //			Templates: parser.TemplateFiles("path/to/templates"),
    12  //		}},
    13  //		PatchTemplates: []framework.PatchTemplate{
    14  //			&framework.ResourcePatchTemplate{
    15  //				Templates: parser.TemplateFiles("path/to/patches/ingress.template.yaml"),
    16  //			},
    17  //		},
    18  //		AdditionalSchemas: parser.SchemaFiles("path/to/crd-schemas"),
    19  //	}
    20  //
    21  //
    22  // All the parser in this file are compatible with embed.FS filesystems. To load from an embed.FS
    23  // instead of local disk, use `.FromFS`. For example, if you embed filesystems as follows:
    24  //
    25  // //go:embed resources/* patches/*
    26  // var templateFS embed.FS
    27  // //go:embed schemas/*
    28  // var schemaFS embed.FS
    29  //
    30  // Then you can use them like so:
    31  //
    32  //	processor := framework.TemplateProcessor{
    33  //		ResourceTemplates: []framework.ResourceTemplate{{
    34  //			Templates: parser.TemplateFiles("resources").FromFS(templateFS),
    35  //		}},
    36  //		PatchTemplates: []framework.PatchTemplate{
    37  //			&framework.ResourcePatchTemplate{
    38  //				Templates: parser.TemplateFiles("patches/ingress.template.yaml").FromFS(templateFS),
    39  //			},
    40  //		},
    41  //		AdditionalSchemas: parser.SchemaFiles("schemas").FromFS(schemaFS),
    42  //	}
    43  package parser
    44  

View as plain text