-
Notifications
You must be signed in to change notification settings - Fork 264
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
feature(source cronjobs): Implementation of CronJobSource management #542
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
Still todo: Adding tests. This PR is based on #499 which should be merged first. |
a6f2bb1
to
6b517f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
6b517f8
to
b851305
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you add eventing server side invocation methods here pkg/kn/commands/source/cronjob/client.go
. Just as knative serving API invocations go to pkg/serving
, I think all eventing server side invocation methods shall go to pkg/eventing
. Because some day, we may want to expose these server side invocations as a client-go library. Forgive me if I'm wrong. I think it's one of team decisions.
docs/cmd/kn_source_cronjob.md
Outdated
### SEE ALSO | ||
|
||
* [kn source](kn_source.md) - Event Source command group | ||
* [kn source cronjob create](kn_source_cronjob_create.md) - Create a Crontab scheduler source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some use Crontab scheduler source
and some use CronJob source
. I think it's better to use a consistent word.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as knative serving API invocations go to
pkg/serving
, I think all eventing server side invocation methods shall go topkg/eventing
. Because some day, we may want to expose these server side invocations as a client-go library. Forgive me if I'm wrong. I think it's one of team decisions.
I might have missed that discussion, do you have some pointers for me ?
The real design decision is whether we want to make the sources support self-contained and all under one package (which make it easier to refactor e.g. when they will be moved away from eventing proper), or whether we want expose them as API and maintaining it (in that case we should build up the same structure as for serving).
I personally tend to the 'self-contained' approach for sources, but would also be happy to go over eventing pkg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yeah, probably better to be consistent. Let me change this later. thanks
@rhuss Here is a short discussion about sdk: #375. I would strongly suggest that we put all server (serving+eventing) side functions together in a separated folder of command lines. For end users, it will be very hard for them to use Knative API directly because of the complex K8s CRD types. Knative needs a sdk-go for end users to manage the server side objects, using simple type parameters, not complicated K8s types. In the future, when community decide to have a knative sdk-go, Knative Client could easily separate the server side methods and the command lines, and easily create the basic version of knative sdk-go. |
Even our API is using "complex CRD types", actually the same as the Knative client SDKs. The benefit of a client-side SDK is not so much hiding the Knative types (there are already a simplification over the standard K8s CRs), but to provide extra, client-related features like:
So not really much (except maybe the version negotiation to come which is probably quite helpful for supporting multiple cluster versions), but I'm not sure if this is what you have in mind. How would a |
a71d4f5
to
a0397bf
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
a0397bf
to
9284399
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
fea1da2
to
7e416d0
Compare
Contains create/delete/update/describe but not tests yet. Still todo: * Think how to provide a namespace for the sink * Support for more sinks * Synchronous mode for create & update * Add list (or implement "source list")
435d9fd
to
69f443d
Compare
/lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rhuss: 34 warnings.
In response to this:
/lint
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
kn_errors "knative.dev/client/pkg/errors" | ||
) | ||
|
||
// Interface for working with ApiServer sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: comment on exported type KnApiServerSourcesClient should be of the form "KnApiServerSourcesClient ..." (with optional leading article). More info.
) | ||
|
||
// Interface for working with ApiServer sources | ||
type KnApiServerSourcesClient interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint naming: type KnApiServerSourcesClient should be KnAPIServerSourcesClient. More info.
} | ||
|
||
// NewKnSourcesClient is to invoke Eventing Sources Client API to create object | ||
func newKnApiServerSourcesClient(client client_v1alpha1.ApiServerSourceInterface, namespace string) KnApiServerSourcesClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint naming: func newKnApiServerSourcesClient should be newKnAPIServerSourcesClient. More info.
} | ||
|
||
//CreateApiServerSource is used to create an instance of ApiServerSource | ||
func (c *apiServerSourcesClient) CreateApiServerSource(apisvrsrc *v1alpha1.ApiServerSource) (*v1alpha1.ApiServerSource, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint naming: method CreateApiServerSource should be CreateAPIServerSource. More info.
return mock.ErrorOrNil(call.Result[0]) | ||
} | ||
|
||
// Delete CronJob |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: comment on exported method CronJobSourcesRecorder.DeleteCronJobSource should be of the form "DeleteCronJobSource ...". More info.
return c.recorder.r.Namespace() | ||
} | ||
|
||
// Create CronJob |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: comment on exported method CronJobSourcesRecorder.CreateCronJobSource should be of the form "CreateCronJobSource ...". More info.
return mock.ErrorOrNil(call.Result[0]) | ||
} | ||
|
||
// Get CronJob |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: comment on exported method CronJobSourcesRecorder.GetCronJobSource should be of the form "GetCronJobSource ...". More info.
"knative.dev/client/pkg/kn/commands/flags" | ||
) | ||
|
||
func NewCronJobUpdateCommand(p *commands.KnParams) *cobra.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: exported function NewCronJobUpdateCommand should have comment or be unexported. More info.
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
type KnApiServerSourcesClient interface { | ||
|
||
// Get an ApiServerSource by object | ||
CreateApiServerSource(apisvrsrc *v1alpha1.ApiServerSource) (*v1alpha1.ApiServerSource, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - In the apiserver update PR I am preparing, I've updated this function definition to only return the error
as the created object is not used (only used in the AddReactor styles tests and object is used to check the name and namespace).
// prepareRestConfig returns REST config, which can be to use to create specific clientset | ||
func (params *KnParams) prepareRestConfig() (*rest.Config, error) { | ||
// RestConfig returns REST config, which can be to use to create specific clientset | ||
func (params *KnParams) RestConfig() (*rest.Config, error) { | ||
var err error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: navidshaikh, rhuss The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…ests reporting (knative#542) * add prow job for flaky test reporting * updates for PR comment * rename to flakes-reporter * name github and slack token more specific rather than general names
Contains create/delete/update/describe but not tests yet.
Still todo: