Exemplo n.º 1
0
        /// <summary>
        /// Directory is a component representing a collection of resources described by a kustomize directory (kustomization).
        /// </summary>
        /// <param name="name">Name of the kustomization (e.g., nginx-ingress).</param>
        /// <param name="args">Configuration options for the kustomization.</param>
        /// <param name="options">Resource options.</param>
        public Directory(string name, DirectoryArgs args, ComponentResourceOptions?options = null)
            : base("kubernetes:kustomize:Directory", MakeName(args, name), options)
        {
            name = GetName(args, name);
            var objs = Invokes.KustomizeDirectory(new KustomizeDirectoryArgs {
                Directory = args.Directory
            });
            var configGroupArgs = new ConfigGroupArgs
            {
                ResourcePrefix  = args.ResourcePrefix,
                Objs            = objs,
                Transformations = args.Transformations
            };
            var opts = ComponentResourceOptions.Merge(options, new ComponentResourceOptions {
                Parent = this
            });
            var resources = Parser.Parse(configGroupArgs, opts);

            RegisterResources(resources);
        }
Exemplo n.º 2
0
        private static string GetName(DirectoryArgs config, string releaseName)
        {
            var prefix = config.ResourcePrefix;

            return(string.IsNullOrEmpty(prefix) ? releaseName : $"{prefix}-{releaseName}");
        }