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

[v1.6.x] Add managedosversion finalizer (#775 & #784) #782

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
426 changes: 0 additions & 426 deletions .obs/chartfile/crds/templates/crds.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{{- $inventoryCRD := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" .Release.Namespace "machineinventories.elemental.cattle.io" -}}
{{- if $inventoryCRD -}}
{{- if $inventoryCRD.metadata.deletionTimestamp -}}
{{- required "CRDs from previous installations are pending to be removed (deletionTimestamp is set). Fully deleting them before (re-)installing is required" "" -}}
{{- $crds := list
"machineinventories.elemental.cattle.io"
"machineinventoryselectors.elemental.cattle.io"
"machineinventoryselectortemplates.elemental.cattle.io"
"machineregistrations.elemental.cattle.io"
"managedosimages.elemental.cattle.io"
"managedosversionchannels.elemental.cattle.io"
"managedosversions.elemental.cattle.io"
"seedimages.elemental.cattle.io"
"metadata.elemental.cattle.io"
-}}
{{- range $index, $crd := $crds -}}
{{- $obj := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" $.Release.Namespace $crd -}}
{{- if and $obj $obj.metadata.deletionTimestamp -}}
{{- required "CRDs from previous installations are pending to be removed (deletionTimestamp is set). Fully deleting them before (re-)installing is required" "" -}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions .obs/chartfile/operator/templates/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ rules:
- managedosversions/status
verbs:
- get
- list
- patch
- update
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"elemental.cattle.io/v1beta1/ManagedOSVersionChannel" "managedosversionchannels"
"elemental.cattle.io/v1beta1/ManagedOSVersion" "managedosversions"
"elemental.cattle.io/v1beta1/SeedImage" "seedimages"
"elemental.cattle.io/v1beta1/Metadata" "metadata"
}}
{{- range $api, $crd := $apis -}}
{{- if not ($.Capabilities.APIVersions.Has $api) -}}
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta1/common_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const (
// ElementalManagedLabel label used to put on resources managed by the elemental operator.
ElementalManagedLabel = "elemental.cattle.io/managed"

// ElementalManagedOSImageVersionNameLabel label is used to filter ManagedOSImages referencing a ManagedOSVersion.
ElementalManagedOSImageVersionNameLabel = "elemental.cattle.io/managed-os-version-name"

// ElementalManagedOSVersionChannelLabel is used to filter a set of ManagedOSVersions given the channel they originate from.
ElementalManagedOSVersionChannelLabel = "elemental.cattle.io/channel"

Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/machineinventory_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var (
const (
MachineInventoryFinalizer = "machineinventory.elemental.cattle.io"
PlanSecretType corev1.SecretType = "elemental.cattle.io/plan"
PlanTypeAnnotation = "elemental.cattle.io/plan.type"
Expand Down
10 changes: 4 additions & 6 deletions api/v1beta1/managedosversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import (
"strings"

"github.com/rancher/elemental-operator/pkg/object"
fleetv1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
upgradev1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)

const (
containerType = "container"
isoType = "iso"
containerType = "container"
isoType = "iso"
ManagedOSVersionFinalizer = "managedosversion.elemental.cattle.io"
)

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -59,9 +59,7 @@ type ManagedOSVersionSpec struct {
UpgradeContainer *upgradev1.ContainerSpec `json:"upgradeContainer,omitempty"`
}

type ManagedOSVersionStatus struct {
fleetv1.BundleStatus `json:""` //nolint
}
type ManagedOSVersionStatus struct{}

// +kubebuilder:object:root=true

Expand Down
3 changes: 1 addition & 2 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions cmd/operator/operator/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,10 @@ func setupReconcilers(mgr ctrl.Manager, config *rootConfig) {
setupLog.Error(err, "unable to create reconciler", "controller", "SeedImage")
os.Exit(1)
}
if err := (&controllers.ManagedOSVersionReconciler{
Client: mgr.GetClient(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create reconciler", "controller", "ManagedOSVersion")
os.Exit(1)
}
}
Loading
Loading