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

New CR types, controllers and webhooks #23

Merged
merged 9 commits into from
Jul 14, 2022
Merged

Conversation

kim-tsao
Copy link
Contributor

@kim-tsao kim-tsao commented Jul 5, 2022

Fixes issue : devfile/api#499

Signed-off-by: Kim Tsao <ktsao@redhat.com>
Signed-off-by: Kim Tsao <ktsao@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Jul 5, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link

openshift-ci bot commented Jul 5, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kim-tsao

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Kim Tsao <ktsao@redhat.com>
Signed-off-by: Kim Tsao <ktsao@redhat.com>
Signed-off-by: Kim Tsao <ktsao@redhat.com>
@kim-tsao kim-tsao marked this pull request as ready for review July 5, 2022 17:35
@kim-tsao
Copy link
Contributor Author

kim-tsao commented Jul 5, 2022

/retest

Signed-off-by: Kim Tsao <ktsao@redhat.com>
Signed-off-by: Kim Tsao <ktsao@redhat.com>
Copy link
Member

@johnmcollier johnmcollier left a comment

Choose a reason for hiding this comment

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

Two small-ish suggestions, otherwise I have no concerns. Some good changes in here 👍

```go
...

//create a lookup key with the name and namespace of the CR
Copy link
Member

Choose a reason for hiding this comment

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

Might be useful to show how to get the resource when not running within a controller.

E.g. like what we do in the tests for getting instances of the devfileregistries CR:

func (w *K8sClient) GetRegistryInstance(name string) (*registryv1alpha1.DevfileRegistry, error) {
data, err := w.kubeClient.RESTClient().
Get().
AbsPath("/apis/registry.devfile.io/v1alpha1").
Namespace(config.Namespace).
Resource("devfileregistries").
Name(name).
DoRaw(context.TODO())
if err != nil {
return nil, err
}
// Unmarshall the struct
registry := &registryv1alpha1.DevfileRegistry{}
err = yaml.Unmarshal(data, registry)
if err != nil {
return nil, err
}
return registry, nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@johnmcollier Does it make sense to keep the existing example too?

Copy link
Member

Choose a reason for hiding this comment

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

Can’t hurt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated README with new example

Signed-off-by: Kim Tsao <ktsao@redhat.com>
@kim-tsao kim-tsao merged commit 401af80 into devfile:main Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants