-
Notifications
You must be signed in to change notification settings - Fork 586
/
crd_manifest_merge.go
45 lines (37 loc) · 1.29 KB
/
crd_manifest_merge.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"fmt"
"github.com/openshift/api/tools/codegen/pkg/generation"
"github.com/openshift/api/tools/codegen/pkg/manifestmerge"
"github.com/spf13/cobra"
)
var (
manifestMergePayloadManifestPath string
)
// schemapatchCmd represents the schemapatch command
var crdManifestMerge = &cobra.Command{
Use: "crd-manifest-merge",
Short: "crd-manifest-merge takes all CRD manifests with the same name and merges them together",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
genCtx, err := generation.NewContext(generation.Options{
BaseDir: baseDir,
APIGroupVersions: apiGroupVersions,
})
if err != nil {
return fmt.Errorf("could not build generation context: %w", err)
}
gen := newCRDManifestMerger()
return executeGenerators(genCtx, gen)
},
}
func init() {
rootCmd.AddCommand(crdManifestMerge)
rootCmd.PersistentFlags().StringVar(&manifestMergePayloadManifestPath, "manifest-merge:payload-manifest-path", manifestmerge.DefaultPayloadFeatureGatePath, "path to directory containing the FeatureGate YAMLs for each FeatureSet,ClusterProfile tuple.")
}
// newSchemaPatchGenerator builds a new schemapatch generator.
func newCRDManifestMerger() generation.Generator {
return manifestmerge.NewGenerator(manifestmerge.Options{
Verify: verify,
})
}