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

Change StrategyRef strategy kind default behaviour #657

Closed
HeavyWombat opened this issue Mar 11, 2021 · 6 comments
Closed

Change StrategyRef strategy kind default behaviour #657

HeavyWombat opened this issue Mar 11, 2021 · 6 comments

Comments

@HeavyWombat
Copy link
Contributor

While working on a PR, it was that @qu1queee and I were wondering why the BuildStrategyKind is a pointer, because this eventually leads to nil checks and the implicit internal contract that nil means namespace based build strategy.

Idea: Make the Kind mandatory as in making it not a pointer in the spec. We would force end-users to explicitly decide whether it is a ClusterBuildStrategy or a (namespace) BuildStrategy, which I think makes sense to force that decision at this point. Side effect is fewer lines of code when it comes to verify the field.

@sbose78
Copy link
Member

sbose78 commented Mar 11, 2021 via email

@imjasonh
Copy link
Contributor

It seems reasonable to me to have a default, rather than making users specify every time. In Tekton, we assume a Task in the same namespace as the TaskRun, over a ClusterTask, and I think that's the less surprising behavior.

In Tekton we've recently sort of shied away from adding more cluster-scoped types, since they can make it hard to upgrade clusters -- all users get the new behavior all at once, which can cause problems. Over time we might get rid of ClusterTask entirely, or at least not immediately bring it into v1. Tekton bundles are more powerful and beyond-cluster-scoped, since they can live in a registry.

I'd personally vote for the default to be the namespaced BuildStrategy, then fallback to the cluster-scoped one. This also makes it easier to remove the cluster-scoped version in the future, if we decide we want to.

@zhangtbj
Copy link
Contributor

Yes, I also agree to have a default value. Right now, we don't have webhook, so it has to be done in the controller logic.

Also FYI, this is the initial discussion about this pointer logic:
#62 (comment)

(Just one year ago, Mar 12th 2020, time flies fast :) )

@imjasonh
Copy link
Contributor

Worth pointing out that we can have a default value and a non-nillable Kind, by using a defaulting webhook to synchronously update "" -> "whatever-default-value" when the request comes in, before being persisted in etcd.

Tekton does this for timeouts today IIRC, with timeout: "" being updated to timeout: "24h" (say), and the specific default value being configured in a ConfigMap so the user can set their own.

@zhangtbj
Copy link
Contributor

Yes, if we want to introduce the webhook, it is easier.

But as discussed before, we didn't plan to use webhook at the beginning, so we set default in the controller logic. :)

qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 19, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 22, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
qu1queee added a commit to qu1queee/build that referenced this issue Mar 22, 2021
When a Build do not specify an strategy Kind, ensure we default to a
namespaced scope one. This logic was already in placed, a previous
commit removed and this commit added it again in a different function.

Also, it should fix shipwright-io#657
@qu1queee
Copy link
Contributor

This was tackle via #641, if the Kindis not specified, we default to a namespaced-scope strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants