stackrox
stackrox copied to clipboard
CR Status Defaults [with version check]
Description
change me!
User-facing documentation
- [ ] CHANGELOG is updated OR update is not needed
- [ ] documentation PR is created and is linked above OR is not needed
Testing and quality
- [ ] the change is production ready: the change is GA or otherwise the functionality is gated by a feature flag
- [ ] CI results are inspected
Automated testing
- [ ] added unit tests
- [ ] added e2e tests
- [ ] added regression tests
- [ ] added compatibility tests
- [ ] modified existing tests
How I validated my change
change me!
Summary by Sourcery
Implement version-aware defaulting mechanism for Scanner V4 component policy in the ACS (Advanced Cluster Security) operator
New Features:
- Introduced a new defaulting mechanism for Scanner V4 component policy that considers installation type (new vs upgrade) and version
Enhancements:
- Added XYVersion parsing and comparison utilities
- Created a flexible defaulting strategy for Scanner V4 component enablement
- Implemented status tracking for component policy defaults
Chores:
- Refactored version parsing and comparison logic
- Updated operator and API type definitions
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
Reviewer's Guide by Sourcery
This pull request introduces changes to manage the Scanner V4 component's enablement status, including version comparison utilities, status persistence, and defaulting logic. It also includes updates to the operator version and startup logging.
Sequence diagram for Scanner V4 component policy defaulting
sequenceDiagram
participant CentralReconciler
participant ScannerV4StatusDefaultsExtension
participant defaulting.ScannerV4DefaultsApply
participant CentralStatus
CentralReconciler->>ScannerV4StatusDefaultsExtension: Reconcile
ScannerV4StatusDefaultsExtension->>defaulting.ScannerV4DefaultsApply: ScannerV4DefaultsApply(statusDefaults, spec)
defaulting.ScannerV4DefaultsApply->>CentralStatus: Read status.Defaults
defaulting.ScannerV4DefaultsApply->>CentralStatus: Write status.Defaults
ScannerV4StatusDefaultsExtension->>CentralReconciler: Update status
Updated class diagram for versioning
classDiagram
class ParsedMainVersion {
MarketingMajor int
MarketingMinor *int
EngRelease int
PatchLevel string
PatchSuffix string
}
class XYVersion {
X int
Y int
Serialize() string
LessOrEqual(XYVersion) bool
Less(XYVersion) bool
}
ParsedMainVersion <.. XYVersion : Uses
Class diagram for StatusDefaults and StatusDefault
classDiagram
class StatusDefaults {
ScannerV4ComponentPolicy StatusDefault
}
class StatusDefault {
OwnerVersion string
Value string
}
StatusDefaults -- StatusDefault : contains
File-Level Changes
| Change | Details | Files |
|---|---|---|
Introduces XYVersion struct and related functions for comparing versions, and updates version parsing logic to support X.Y version format. |
|
pkg/version/version.go |
Adds StatusDefault and StatusDefaults structs to operator API for managing default component statuses, specifically for Scanner V4. |
|
operator/api/v1alpha1/zz_generated.deepcopy.gooperator/api/v1alpha1/common_types.gooperator/api/v1alpha1/central_types.go |
| Modifies the Scanner V4 component defaulting logic to retain the current enablement state during upgrades to 4.8 and enable it for new installations. |
|
operator/api/v1alpha1/central_types.gooperator/config/crd/bases/platform.stackrox.io_centrals.yamloperator/internal/central/values/translation/translation.gooperator/internal/common/defaulting/scanner_v4_enabling.go |
| Adds an extension to persist the Scanner V4 enablement status in the Central status for later use. |
|
operator/internal/central/extensions/reconcile_scanner_v4_status_defaults.gooperator/internal/central/reconciler/reconciler.gooperator/internal/central/extensions/reconcile_scanner_v4_db_password.go |
| Updates the operator version and adds logging for operator startup. |
|
operator/cmd/main.gooperator/internal/version/version.go |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review! - Generate a plan of action for an issue: Comment
@sourcery-ai planon an issue to generate a plan of action for it.
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Images are ready for the commit at 6bfba62.
To use with deploy scripts, first export MAIN_IMAGE_TAG=4.8.x-429-g2af4bc01b4.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 49.17%. Comparing base (
aeb7429) to head (6bfba62). Report is 39 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #14937 +/- ##
===========================================
+ Coverage 48.96% 49.17% +0.21%
===========================================
Files 2550 734 -1816
Lines 187233 73971 -113262
===========================================
- Hits 91673 36374 -55299
+ Misses 88308 34314 -53994
+ Partials 7252 3283 -3969
| Flag | Coverage Δ | |
|---|---|---|
| go-unit-tests | 49.17% <ø> (+0.21%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.