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

internal/plugins/helm: add --project-name and use Config.ProjectName in scaffold #3438

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

estroz
Copy link
Member

@estroz estroz commented Jul 16, 2020

Description of the change:

  • go.sum,go.mod: bump kubebuilder dep
  • internal/plugins/helm: add --project-name flag, and use Config.ProjectName in scaffolds

Motivation for the change: This commit bumps sigs.k8s.io/kubebuilder to the latest commit so Config.ProjectName is available, and adds --project-name to Go (indirectly) and Helm (directly) to set this field on init. See kubernetes-sigs/kubebuilder#1603 and kubernetes-sigs/kubebuilder#1609 for details and changes to the Go plugin.

@asmacdo @fabianvf this might also be nice to have in an Ansible plugin too.

/cc @camilamacedo86 @joelanford

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@estroz
Copy link
Member Author

estroz commented Jul 16, 2020

Relates to #3341

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream kubebuilder just uses os.Getwd() for the project name in various places (e.g. scaffolds/templates/kustomize.go and scaffolds/templates/manager/config.go)
and doesn't make it configurable. Is there a strong use case for allowing users to choose something different than the directory name?

Even if there is, is this a difference we want to introduce between SDK and Kubebuilder?

EDIT: Just saw kubernetes-sigs/kubebuilder#1596

So Go projects use repo. Ansible and helm projects don't need repo, but can use projectName. Is it too late to make repo a config field for just the Go plugin?

@camilamacedo86
Copy link
Contributor

just a few nits but I liked the idea 👍

@joelanford
Copy link
Member

Another thought just crossed my mind.

The bundle and packagemanifest generators would probably want to use this to determine the project name, right?

If so, does it make sense to put logic in those generators to handle specific plugin configurations? (e.g. it will check for Go + repo, Helm + plugin.project, or Ansible + plugin.project)

But what if another plugin has everything setup such that those generators would just work? Ideally we don't hardcode the set of supported plugins and prevent future plugins from working with OLM integration.

@estroz
Copy link
Member Author

estroz commented Jul 17, 2020

/hold

Until the discussion in kubernetes-sigs/kubebuilder#1596 is acted upon upstream.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 17, 2020
@estroz estroz force-pushed the feature/helm-plugin-config branch 2 times, most recently from 9a2c11d to 5f7c1b6 Compare July 23, 2020 17:00
@estroz estroz changed the title internal/plugins/helm: add a Config for Helm-specific project configuration internal/plugins/helm: add --project-name and use Config.ProjectName in scaffold Jul 23, 2020
@estroz
Copy link
Member Author

estroz commented Jul 23, 2020

@camilamacedo86 @joelanford updated after kubernetes-sigs/kubebuilder#1603 was merged.

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2020
@joelanford joelanford mentioned this pull request Jul 23, 2020
92 tasks
@estroz estroz force-pushed the feature/helm-plugin-config branch from 5f7c1b6 to 483308d Compare July 23, 2020 17:45
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with move in this direction and just add TODO's to perform the refinements suggested by @joelanford in a follow up since they are more related to the design and not the functionality.

so, if we add the todo's it has my /lgtm when pass in the CI. PS requires a rebase.

@estroz estroz force-pushed the feature/helm-plugin-config branch 2 times, most recently from d8d2185 to a43cf79 Compare July 23, 2020 21:45
@estroz estroz requested a review from joelanford July 23, 2020 21:47
migration:
header: Add the `projectName` config key to your PROJECT file
body: >
Set the `projectName` key in your PROJECT file. If this key is not set,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 have the flag as suggested with projectName was blocker here that is solved now


// Image is controller manager image name
Image string

// OperatorName will be used to create the pods
OperatorName string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 great

internal/plugins/helm/v1/init.go Outdated Show resolved Hide resolved
@estroz estroz force-pushed the feature/helm-plugin-config branch from 20cfa4a to 5601742 Compare July 24, 2020 15:33
@estroz estroz requested a review from joelanford July 24, 2020 16:09
Config.ProjectName is available, and adds `--project-name` to Go
(indirectly) and Helm (directly) to set this field on `init`.

go.sum,go.mod: bump kubebuilder dep

internal/plugins/helm: add `--project-name` flag, and use Config.ProjectName
in scaffolds
@estroz estroz force-pushed the feature/helm-plugin-config branch from 5601742 to dbc6efb Compare July 24, 2020 16:40
@estroz estroz closed this Jul 24, 2020
@estroz estroz reopened this Jul 24, 2020
Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

FYI @asmacdo @fabianvf

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 24, 2020
@estroz estroz merged commit 24d73f7 into operator-framework:master Jul 24, 2020
@estroz estroz deleted the feature/helm-plugin-config branch July 24, 2020 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants