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 status to ClusterImagePolicy + TrustRoot CRDs #533

Merged
merged 4 commits into from
Jan 31, 2023

Conversation

vaikas
Copy link
Collaborator

@vaikas vaikas commented Jan 27, 2023

Summary

Add Status to CRDs. Also add some more failure testing and ensure they show up in status.
Fixes: #456

Release Note

🎁 Add Status to ClusterImagePolicy as well as TrustRoot CRDs.

Documentation

Copy link
Collaborator

@hectorj2f hectorj2f left a comment

Choose a reason for hiding this comment

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

make docs is missing the new fields

@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2023

Codecov Report

Merging #533 (7c0045a) into main (90daaac) will decrease coverage by 0.38%.
The diff coverage is 38.46%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #533      +/-   ##
==========================================
- Coverage   54.79%   54.41%   -0.38%     
==========================================
  Files          42       45       +3     
  Lines        4559     4723     +164     
==========================================
+ Hits         2498     2570      +72     
- Misses       1856     1949      +93     
+ Partials      205      204       -1     
Impacted Files Coverage Δ
...g/apis/policy/v1alpha1/clusterimagepolicy_types.go 0.00% <0.00%> (ø)
pkg/apis/policy/v1alpha1/trustroot_lifecycle.go 0.00% <0.00%> (ø)
pkg/apis/policy/v1alpha1/trustroot_types.go 0.00% <0.00%> (ø)
...pis/policy/v1beta1/clusterimagepolicy_lifecycle.go 0.00% <0.00%> (ø)
...kg/apis/policy/v1beta1/clusterimagepolicy_types.go 0.00% <0.00%> (ø)
pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go 13.39% <37.50%> (+1.14%) ⬆️
...is/policy/v1alpha1/clusterimagepolicy_lifecycle.go 41.66% <41.66%> (ø)
pkg/apis/policy/v1beta1/zz_generated.deepcopy.go 19.76% <41.66%> (+0.80%) ⬆️
pkg/reconciler/trustroot/trustroot.go 50.00% <50.00%> (+0.71%) ⬆️
...econciler/clusterimagepolicy/clusterimagepolicy.go 59.33% <65.00%> (+5.03%) ⬆️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@vaikas
Copy link
Collaborator Author

vaikas commented Jan 27, 2023

ko failed to install on the test failure:

Installing ko @ v0.12.0 for Linux
+ sudo tar xzf - -C /usr/local/bin ko
+ curl -fsL https://github.com/ko-build/ko/releases/download/v0.12.0/ko_0.12.0_Linux_x86_64.tar.gz

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Error: Process completed with exit code 2.

@@ -90,28 +97,40 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, cip *v1alpha1.ClusterIma
if err != nil {
if !apierrs.IsNotFound(err) {
logging.FromContext(ctx).Errorf("Failed to get configmap: %v", err)
cip.Status.MarkCMUpdateFailed(err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add a status for the url's failure or success operation when fetching a policy ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We already do on line 82 (if inlinePolicies fail) we mark that failed and the error will be reflected in the status just like if any inline policy fails. Splitting out whether it's CM or URL makes things way more complicated and I see no benefit to the user for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we wanted to give more descriptive errors about what it could go wrong with a policy.


ClusterImagePolicyConditionKeysInlined apis.ConditionType = "KeysInlined"
ClusterImagePolicyConditionPoliciesInlined apis.ConditionType = "PoliciesInlined"
ClusterImagePolicyConditionCMUpdated apis.ConditionType = "ConfigMapUpdated"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm. That link doesn't take me anywhere except the full diff :) Assuming you mean FinalizeKind, once the finalizer has been slapped on, I am fairly certain you can't update the object anymore. But, I could be wrong. I'll look at doing that in a followup, ok?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure. FinalizeKind is optional, and if implemented by the reconciler will be called when the resource's deletion timestamp is set I am not sure what means to set the deletion timestmap.

Copy link
Collaborator

@hectorj2f hectorj2f left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me 💪🏻 , I added some comments.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
@vaikas vaikas merged commit 5c64064 into sigstore:main Jan 31, 2023
@vaikas vaikas deleted the status branch January 31, 2023 16:09
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

Successfully merging this pull request may close these issues.

Revisit the earlier decision to not support Status field in CIP
3 participants