Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add explicit --manifests-dir for render bootstrap #171

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions cmd/manager/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ var (
}

renderOpts struct {
manifestsDir string
destinationDir string
ccoImage string
logLevel string
}
)

func newRenderCommand() *cobra.Command {
renderCmd.Flags().StringVar(&renderOpts.manifestsDir, "manifests-dir", "", "The directory where the install-time manifests are located.")
renderCmd.Flags().StringVar(&renderOpts.destinationDir, "dest-dir", "", "The destination directory where CCO writes the manifests.")
renderCmd.MarkFlagRequired("dest-dir")
renderCmd.Flags().StringVar(&renderOpts.ccoImage, "cloud-credential-operator-image", "", "Image for Cloud Credential Operator.")
Expand Down Expand Up @@ -152,7 +154,13 @@ func runRenderCmd(cmd *cobra.Command, args []string) {
// that the operator is enabled by default) for the operator.
func isDisabled() bool {

files, err := ioutil.ReadDir(renderOpts.destinationDir)
// if were were not provided a place to search for the install-time manifests,
// just return the default CCO operator enabled/disabled value
if renderOpts.manifestsDir == "" {
return utils.OperatorDisabledDefault
}

files, err := ioutil.ReadDir(renderOpts.manifestsDir)
if err != nil {
log.WithError(err).Errorf("failed to list files in %s, using defualt operator settings", renderOpts.destinationDir)
return utils.OperatorDisabledDefault
Expand All @@ -164,7 +172,7 @@ func isDisabled() bool {
continue
}

fullPath := filepath.Join(renderOpts.destinationDir, fInfo.Name())
fullPath := filepath.Join(renderOpts.manifestsDir, fInfo.Name())
log.Debugf("checking file: %s", fullPath)
file, err := os.Open(fullPath)
if err != nil {
Expand Down