Skip to content

Commit

Permalink
CNF-14630: CNF14631: Add initial upgrade handler
Browse files Browse the repository at this point in the history
- Add release field to ClusterTemplate, sepcifying openshift release for
  the template
- Add upgradeDefaults to ClusterTemplate.Templates, specifying configmap
  name for upgrade information to this templater
- Add initital upgrade handler. After detecting that
  clusterTemplate.release is higher than deployed
managedCluster.OpenshiftVersion, upgrade handler creates and ibgu to
upgrade the cluster. The upgrade information is read from
upgradeDefaults configmap specified in the clusterTemplate.

Signed-off-by: Saeid Askari <saskari@redhat.com>
  • Loading branch information
sudomakeinstall2 committed Oct 18, 2024
1 parent 641a932 commit 74bb68a
Show file tree
Hide file tree
Showing 311 changed files with 5,755 additions and 19,000 deletions.
6 changes: 6 additions & 0 deletions api/provisioning/v1alpha1/clustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type ClusterTemplateSpec struct {
// Metadata defines a List of key/value pairs describing metadata associated with the template.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Metadata",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Metadata map[string]string `json:"metadata,omitempty"`
// Release defines the openshift release version of the template
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Release",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Release string `json:"release"`
// Templates defines the references to the templates required for ClusterTemplate.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Templates",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Templates Templates `json:"templates"`
Expand All @@ -70,6 +73,9 @@ type Templates struct {
// PolicyTemplateDefaults defines a reference to a configmap with
// default values for ACM policies
PolicyTemplateDefaults string `json:"policyTemplateDefaults"`
// UpgradeDefaults defines a reference to a configmap with
// default values for upgrade information
UpgradeDefaults string `json:"upgradeDefaults,omitempty"`
}

// ClusterTemplateStatus defines the observed state of ClusterTemplate
Expand Down

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

5 changes: 5 additions & 0 deletions bundle/manifests/oran-o2ims.clusterserviceversion.yaml

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

Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ spec:
name:
description: Name defines a Human readable name of the Template.
type: string
release:
description: Release defines the openshift release version of the
template
type: string
templateId:
description: TemplateId defines a Identifier for the O-Cloud Template.
This identifier is allocated by the O-Cloud.
Expand Down Expand Up @@ -87,17 +91,21 @@ spec:
PolicyTemplateDefaults defines a reference to a configmap with
default values for ACM policies
type: string
upgradeDefaults:
type: string
required:
- clusterInstanceDefaults
- hwTemplate
- policyTemplateDefaults
- upgradeDefaults
type: object
version:
description: Version defines a version or generation of the resource
as defined by its provider.
type: string
required:
- name
- release
- templateParameterSchema
- templates
- version
Expand Down
5 changes: 5 additions & 0 deletions config/manifests/bases/oran-o2ims.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ spec:
path: name
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Release defines the openshift release version of the template
displayName: Release
path: release
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: TemplateId defines a Identifier for the O-Cloud Template. This
identifier is allocated by the O-Cloud.
displayName: TemplateId
Expand Down
60 changes: 34 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/imdario/mergo v0.3.16
github.com/imdario/mergo v1.0.0
github.com/itchyny/gojq v0.12.14
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift-kni/cluster-group-upgrades-operator v0.0.0-20241015193426-dd5c5bc228e8
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20241001130125-a052f08603f7
github.com/openshift-kni/oran-o2ims/api/inventory v0.0.0-00010101000000-000000000000
github.com/openshift-kni/oran-o2ims/api/provisioning v0.0.0-00010101000000-000000000000
github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e
github.com/openshift/api v0.0.0-20240423014330-2cb60a113ad1
github.com/openshift/assisted-service/api v0.0.0-20240405132132-484ec5c683c6
github.com/peterhellberg/link v1.2.0
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/client_golang v1.19.1
github.com/r3labs/diff/v3 v3.0.1
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
Expand All @@ -37,11 +38,11 @@ require (
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.30.2
k8s.io/apimachinery v0.30.2
k8s.io/client-go v0.30.2
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog/v2 v2.130.1
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
open-cluster-management.io/api v0.14.0
open-cluster-management.io/governance-policy-propagator v0.12.0
open-cluster-management.io/governance-policy-propagator v0.14.0
sigs.k8s.io/controller-runtime v0.18.2
sigs.k8s.io/yaml v1.4.0
)
Expand All @@ -50,29 +51,28 @@ require (
github.com/PaesslerAG/gval v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-openapi/analysis v0.21.2 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/loads v0.21.1 // indirect
github.com/go-openapi/spec v0.20.7 // indirect
github.com/go-openapi/strfmt v0.21.3 // indirect
github.com/go-openapi/swag v0.22.9 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-openapi/validate v0.22.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
Expand All @@ -86,32 +86,32 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/openshift-kni/lifecycle-agent v0.0.0-20241010194013-9d0e25438512 // indirect
github.com/openshift/assisted-service/models v0.0.0 // indirect
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect
github.com/openshift/hive/apis v0.0.0-20240306163002-9c5806a63531 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.15.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/gorm v1.24.5 // indirect
k8s.io/apiextensions-apiserver v0.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
open-cluster-management.io/multicloud-operators-subscription v0.11.0 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Expand All @@ -121,3 +121,11 @@ replace github.com/openshift-kni/oran-o2ims/api/hardwaremanagement => ./api/hard
replace github.com/openshift-kni/oran-o2ims/api/inventory => ./api/inventory

replace github.com/openshift-kni/oran-o2ims/api/provisioning => ./api/provisioning

// From the mergo project's README: "If the vanity URL is causing issues in
// your project due to a dependency pulling Mergo - it isn't a direct
// dependency in your project - it is recommended to use replace to pin the
// version to the last one with the old import URL:"
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16

replace k8s.io/client-go => k8s.io/client-go v0.30.2
Loading

0 comments on commit 74bb68a

Please sign in to comment.