-
Notifications
You must be signed in to change notification settings - Fork 40
CM-867: Implement trust-manager resource reconcilers #379
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
Merged
openshift-merge-bot
merged 7 commits into
openshift:master
from
chiragkyal:trust-manager-reconcilers
Mar 24, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3136225
Implement resource reconcilers for trust-manager
chiragkyal 3803731
Update relatedImages and Makefile
chiragkyal 4089ab8
Add unit tests for trust-manager
chiragkyal 4f3c5f7
Add e2e tests for trust-manager reconcilers
chiragkyal 88f97b2
Address review comments
chiragkyal de5b043
Update the controller predicate logic
chiragkyal 219524a
Update the cache handling for Issuer and ClusterIssuer
chiragkyal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package common | ||
|
|
||
| import ( | ||
| "unsafe" | ||
|
|
||
| corev1 "k8s.io/api/core/v1" | ||
| apivalidation "k8s.io/apimachinery/pkg/api/validation" | ||
| metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" | ||
| "k8s.io/apimachinery/pkg/util/validation/field" | ||
| "k8s.io/kubernetes/pkg/apis/core" | ||
| corevalidation "k8s.io/kubernetes/pkg/apis/core/validation" | ||
| ) | ||
|
|
||
| // ValidateNodeSelectorConfig validates the NodeSelector configuration using | ||
| // the Kubernetes label validation rules. | ||
| func ValidateNodeSelectorConfig(nodeSelector map[string]string, fldPath *field.Path) error { | ||
| return metav1validation.ValidateLabels(nodeSelector, fldPath.Child("nodeSelector")).ToAggregate() | ||
| } | ||
|
|
||
| // ValidateTolerationsConfig validates the Tolerations configuration using | ||
| // the Kubernetes core toleration validation rules. | ||
| func ValidateTolerationsConfig(tolerations []corev1.Toleration, fldPath *field.Path) error { | ||
| // convert corev1.Tolerations to core.Tolerations, required for validation. | ||
| convTolerations := *(*[]core.Toleration)(unsafe.Pointer(&tolerations)) | ||
| return corevalidation.ValidateTolerations(convTolerations, fldPath.Child("tolerations")).ToAggregate() | ||
| } | ||
|
|
||
| // ValidateResourceRequirements validates the ResourceRequirements configuration | ||
| // using the Kubernetes core resource requirements validation rules. | ||
| func ValidateResourceRequirements(requirements corev1.ResourceRequirements, fldPath *field.Path) error { | ||
| // convert corev1.ResourceRequirements to core.ResourceRequirements, required for validation. | ||
| convRequirements := *(*core.ResourceRequirements)(unsafe.Pointer(&requirements)) | ||
| return corevalidation.ValidateContainerResourceRequirements(&convRequirements, nil, fldPath.Child("resources"), corevalidation.PodValidationOptions{}).ToAggregate() | ||
| } | ||
|
|
||
| // ValidateAffinityRules validates the Affinity configuration using | ||
| // the Kubernetes core affinity validation rules. | ||
| func ValidateAffinityRules(affinity *corev1.Affinity, fldPath *field.Path) error { | ||
| // convert corev1.Affinity to core.Affinity, required for validation. | ||
| convAffinity := (*core.Affinity)(unsafe.Pointer(affinity)) | ||
| return validateAffinity(convAffinity, corevalidation.PodValidationOptions{}, fldPath.Child("affinity")).ToAggregate() | ||
| } | ||
|
|
||
| // ValidateLabelsConfig validates label keys and values using the Kubernetes | ||
| // metadata validation rules. | ||
| func ValidateLabelsConfig(labels map[string]string, fldPath *field.Path) error { | ||
| return metav1validation.ValidateLabels(labels, fldPath.Child("labels")).ToAggregate() | ||
| } | ||
|
|
||
| // ValidateAnnotationsConfig validates annotation keys and sizes using the | ||
| // Kubernetes metadata validation rules. | ||
| func ValidateAnnotationsConfig(annotations map[string]string, fldPath *field.Path) error { | ||
| return apivalidation.ValidateAnnotations(annotations, fldPath.Child("annotations")).ToAggregate() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Avoid panics in decode helper used by reconcilers.
DecodeObjBytespanics on decode/type mismatch, which can crash the operator process and cause crash loops instead of returning a reconcile error.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
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.
This change is not needed as all the callers of this function pass static manifest data which is present in the binary. Inability to decode such static manifest should lead to panic.
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.
@mytreya-rh, understood — the panic is intentional here as a "fail-fast on programmer error" pattern. Since all callers supply statically embedded asset bytes baked into the binary, a decode failure would indicate a build-time bug rather than a runtime condition, making panic the correct signal. I'll update my understanding for future reviews.