factory.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. Copyright 2018 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Package factory provides factories for kustomize.
  14. package factory
  15. import (
  16. "sigs.k8s.io/kustomize/pkg/ifc"
  17. "sigs.k8s.io/kustomize/pkg/ifc/transformer"
  18. "sigs.k8s.io/kustomize/pkg/resmap"
  19. "sigs.k8s.io/kustomize/pkg/resource"
  20. )
  21. // KustFactory provides different factories for kustomize
  22. type KustFactory struct {
  23. ResmapF *resmap.Factory
  24. TransformerF transformer.Factory
  25. ValidatorF ifc.Validator
  26. UnstructF ifc.KunstructuredFactory
  27. }
  28. // NewKustFactory creats a KustFactory instance
  29. func NewKustFactory(u ifc.KunstructuredFactory, v ifc.Validator, t transformer.Factory) *KustFactory {
  30. return &KustFactory{
  31. ResmapF: resmap.NewFactory(resource.NewFactory(u)),
  32. TransformerF: t,
  33. ValidatorF: v,
  34. UnstructF: u,
  35. }
  36. }