-
Notifications
You must be signed in to change notification settings - Fork 17
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
Introduce ManagedOSChangelog resource #891
Draft
fgiudici
wants to merge
8
commits into
rancher:main
Choose a base branch
from
fgiudici:changelog3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3e1019f
operator: add ManagedOSChangelog CRD
fgiudici 1e52b0a
operator: add ManagedOSChangelog controller
fgiudici fef0f09
make build-manifest
fgiudici c1baed6
ManagedOSChangelog: add CRD to kustomize file
fgiudici c0b588c
managedoschangelog: implement controller logic
fgiudici db73931
make generate
fgiudici 07c8bd4
make build-manifests
fgiudici f970d67
changelog: add proxy in the operator http server
fgiudici 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
There are no files selected for viewing
This file contains 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 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 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 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,89 @@ | ||
/* | ||
Copyright © 2022 - 2024 SUSE LLC | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
ManagedOSChangelogFinalizer = "managedoschangelog.elemental.cattle.io" | ||
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
type ManagedOSChangelog struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ManagedOSChangelogSpec `json:"spec,omitempty"` | ||
Status ManagedOSChangelogStatus `json:"status,omitempty"` | ||
} | ||
|
||
type ManagedOSChangelogSpec struct { | ||
// ManagedOSVersionChannelRef a referemce to the related ManagedOSVersionChannel. | ||
ManagedOSVersionChannelRef *corev1.ObjectReference `json:"channelRef"` | ||
// ManagedOSVersion the name of the ManagedOSVersion resource for which the changelog | ||
// should be generated. | ||
ManagedOSVersion string `json:"osVersion,omitempty"` | ||
// LifetimeMinutes the time at which the changelog data will be cleaned up. | ||
// Default is 60 minutes, set to 0 to disable. | ||
// +kubebuilder:default:=60 | ||
// +optional | ||
LifetimeMinutes int32 `json:"cleanupAfterMinutes"` | ||
// Refresh triggers to build again a cleaned up changelog. | ||
// +optional | ||
Refresh bool `json:"refresh"` | ||
} | ||
|
||
type ChangelogState string | ||
|
||
const ( | ||
ChangelogInit ChangelogState = "Initialized" | ||
ChangelogStarted ChangelogState = "Started" | ||
ChangelogCompleted ChangelogState = "Completed" | ||
ChangelogFailed ChangelogState = "Failed" | ||
ChangelogNotStarted ChangelogState = "NotStarted" | ||
) | ||
|
||
type ManagedOSChangelogStatus struct { | ||
// Conditions describe the state of the changelog object. | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` | ||
// ChangelogURL the URL where changelog data can be displayed | ||
// +optional | ||
ChangelogURL string `json:"changelogURL,omitempty"` | ||
// State reflect the state of the changelog generation process. | ||
// +kubebuilder:validation:Enum=Initialized;Started;Completed;Failed;NotStarted | ||
// +optional | ||
State ChangelogState `json:"state,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ManagedOSChangelogList contains a list of ManagedOSChangelogs. | ||
type ManagedOSChangelogList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []ManagedOSChangelog `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&ManagedOSChangelog{}, &ManagedOSChangelogList{}) | ||
} |
Oops, something went wrong.
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.
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 don't think this should be part of the spec. IMHO this belongs to the state and should be handled there. I know subresources update via kubectl is still a beta feature and expected to be fully supported starting from v1.31, but I think it would make more sense to track it as a condition.
I am not sure having some user input being manipulated and updated in spec by the controller is good pattern. This is prone to cache miss errors and issues during backup & restore.