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

Move arch validation logic outside of OS upgrade script #55

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

ipetrov117
Copy link
Contributor

@ipetrov117 ipetrov117 commented Aug 21, 2024

The suggested implementation introduces the following changes:

  1. Removal of the existing OS arch validation that was located in the os-upgrade.sh.tpl script template
  2. Rework of the SupportedArchs property of the OperatingSystem release manifest configuration:
    • The property has been moved away from a []string to a []Arch type
    • Validation was added for each Arch entry that it holds expected full arch names - x86_64 and aarch64 have been added as initial possible configurations.
    • Logic that converts arch full names to short names (e.g. amd64, arm64.. etc.) was added.
  3. OS arch validation is now done by the upgrade-controller, where:
    • each cluster node is validated against the supported architectures (both full name and short name) that have been defined in the release manifest
    • if a node is not running a supported architecture, the OS upgrade fails and both a condition and error message are printed in the UpgradePlan and upgrade-controller respectively.

Example "Failed" UpgradePlan condition message:

apiVersion: lifecycle.suse.com/v1alpha1
kind: UpgradePlan
..
  name: upgradeplan-sample
  namespace: upgrade-controller-system
..
status:
  conditions:
  - lastTransitionTime: "2024-08-21T09:05:32Z"
    message: Cluster nodes are running unsupported architectures
    reason: Failed
    status: "False"
    type: OSUpgraded

Example error message in the upgrade-controller for the following ReleaseManifest configuration:
ReleaseManifest:

apiVersion: lifecycle.suse.com/v1alpha1
kind: ReleaseManifest
metadata:
  name: releasemanifest-sample
  namespace: upgrade-controller-system
spec:
...
    operatingSystem:
      ...
      supportedArchs:
        - "aarch64"

upgrade-controller error message when running on a x86_64 OS arch:

2024-08-21T09:05:42Z  ERROR Reconciler error  {"controller": "upgradeplan", "controllerGroup": "lifecycle.suse.com", "controllerKind": "UpgradePlan", "UpgradePlan": {"name":"upgradeplan-sample","namespace":"upgrade-controller-system"}, "namespace": "upgrade-controller-system", "name": "upgradeplan-sample", "reconcileID": "208a11db-f2d9-47d8-8048-53a2f67fdd20", "error": "validating cluster node OS architecture: unsuported arch 'amd64' for 'mgmt-cluster-network' node. Supported archs: [aarch64]"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:316
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:263
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:224

Was tested both for failure and successful use-cases.

@ipetrov117 ipetrov117 merged commit 72ae0e0 into suse-edge:main Aug 21, 2024
2 checks passed
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.

2 participants