Comment unused function that depends on k8s.io/kubernetes
This commit is contained in:
parent
4312d1e34a
commit
b4f3d605ca
|
|
@ -17,62 +17,59 @@ limitations under the License.
|
|||
package manifest
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
manifest "k8s.io/kubectl/pkg/apis/manifest/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||
)
|
||||
|
||||
const kubeManifestFileName = "Kube-manifest.yaml"
|
||||
|
||||
// loadBaseAndOverlayPkg returns:
|
||||
// - List of FilenameOptions, each FilenameOptions contains all the files and whether recursive for each base defined in overlay kube-manifest.yaml.
|
||||
// - Fileoptions for overlay.
|
||||
// - Package object for overlay.
|
||||
// - A potential error.
|
||||
func loadBaseAndOverlayPkg(f string) ([]resource.FilenameOptions, resource.FilenameOptions, *manifest.Manifest, error) {
|
||||
overlay, err := loadManifestPkg(path.Join(f, kubeManifestFileName))
|
||||
if err != nil {
|
||||
return nil, resource.FilenameOptions{}, nil, err
|
||||
}
|
||||
overlayFileOptions := resource.FilenameOptions{
|
||||
// TODO: support `recursive` when we figure out what its behavior should be.
|
||||
// Recursive: overlay.Recursive
|
||||
}
|
||||
for _, o := range overlay.Patches {
|
||||
overlayFileOptions.Filenames = append(overlayFileOptions.Filenames, path.Join(f, o))
|
||||
}
|
||||
// // loadBaseAndOverlayPkg returns:
|
||||
// // - List of FilenameOptions, each FilenameOptions contains all the files and whether recursive for each base defined in overlay kube-manifest.yaml.
|
||||
// // - Fileoptions for overlay.
|
||||
// // - Package object for overlay.
|
||||
// // - A potential error.
|
||||
// func loadBaseAndOverlayPkg(f string) ([]resource.FilenameOptions, resource.FilenameOptions, *manifest.Manifest, error) {
|
||||
// overlay, err := loadManifestPkg(path.Join(f, kubeManifestFileName))
|
||||
// if err != nil {
|
||||
// return nil, resource.FilenameOptions{}, nil, err
|
||||
// }
|
||||
// overlayFileOptions := resource.FilenameOptions{
|
||||
// // TODO: support `recursive` when we figure out what its behavior should be.
|
||||
// // Recursive: overlay.Recursive
|
||||
// }
|
||||
// for _, o := range overlay.Patches {
|
||||
// overlayFileOptions.Filenames = append(overlayFileOptions.Filenames, path.Join(f, o))
|
||||
// }
|
||||
|
||||
if len(overlay.Resources) == 0 {
|
||||
return nil, resource.FilenameOptions{}, nil, errors.New("expect at least one base, but got 0")
|
||||
}
|
||||
// if len(overlay.Resources) == 0 {
|
||||
// return nil, resource.FilenameOptions{}, nil, errors.New("expect at least one base, but got 0")
|
||||
// }
|
||||
|
||||
var baseFileOptionsList []resource.FilenameOptions
|
||||
for _, base := range overlay.Resources {
|
||||
var baseFilenames []string
|
||||
baseManifest, err := loadManifestPkg(path.Join(f, base, kubeManifestFileName))
|
||||
if err != nil {
|
||||
return nil, resource.FilenameOptions{}, nil, err
|
||||
}
|
||||
for _, filename := range baseManifest.Resources {
|
||||
baseFilenames = append(baseFilenames, path.Join(f, base, filename))
|
||||
}
|
||||
baseFileOptions := resource.FilenameOptions{
|
||||
Filenames: baseFilenames,
|
||||
// TODO: support `recursive` when we figure out what its behavior should be.
|
||||
// Recursive: baseManifest.Recursive,
|
||||
}
|
||||
baseFileOptionsList = append(baseFileOptionsList, baseFileOptions)
|
||||
}
|
||||
// var baseFileOptionsList []resource.FilenameOptions
|
||||
// for _, base := range overlay.Resources {
|
||||
// var baseFilenames []string
|
||||
// baseManifest, err := loadManifestPkg(path.Join(f, base, kubeManifestFileName))
|
||||
// if err != nil {
|
||||
// return nil, resource.FilenameOptions{}, nil, err
|
||||
// }
|
||||
// for _, filename := range baseManifest.Resources {
|
||||
// baseFilenames = append(baseFilenames, path.Join(f, base, filename))
|
||||
// }
|
||||
// baseFileOptions := resource.FilenameOptions{
|
||||
// Filenames: baseFilenames,
|
||||
// // TODO: support `recursive` when we figure out what its behavior should be.
|
||||
// // Recursive: baseManifest.Recursive,
|
||||
// }
|
||||
// baseFileOptionsList = append(baseFileOptionsList, baseFileOptions)
|
||||
// }
|
||||
|
||||
return baseFileOptionsList, overlayFileOptions, overlay, nil
|
||||
}
|
||||
// return baseFileOptionsList, overlayFileOptions, overlay, nil
|
||||
// }
|
||||
|
||||
// loadManifestPkg loads a manifest file and parse it in to the Package object.
|
||||
func loadManifestPkg(filename string) (*manifest.Manifest, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue