-
Notifications
You must be signed in to change notification settings - Fork 47
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
Deploy common-instancetypes v0.0.1-rc #453
Deploy common-instancetypes v0.0.1-rc #453
Conversation
Skipping CI for Draft Pull Request. |
b32febe
to
e931ce4
Compare
v0.0.1-rc
v0.0.1-rc
Marked this as ready to review but it still obviously needs tests etc, just looking for some initial reviews on direction. |
e931ce4
to
5695c42
Compare
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.
On nit, otherwise lgtm!
5695c42
to
e65b4a0
Compare
e65b4a0
to
d34d127
Compare
d34d127
to
9aff1b9
Compare
ClusterResource(clusterInstancetype). | ||
WithAppLabels(operandName, operandComponent). | ||
UpdateFunc(func(newRes, foundRes client.Object) { | ||
foundRes.(*instancetypev1alpha2.VirtualMachineClusterInstancetype).Spec = newRes.(*instancetypev1alpha2.VirtualMachineClusterInstancetype).Spec |
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.
Should the casts be checked?
This initial change starts to simply deploy the v0.0.1-rc bundle of VirtualMachineCluster{Instancetypes,Preferences} resources. These resources are deployed under both OpenShift and non-OpenShift environments. At present this is the only functionality enabled within the operator when deployed under non-OpenShift environments. Future changes will introduce support for removing deprecated resources and for deploying resources from a kustomize repo URI. Signed-off-by: Lee Yarwood <[email protected]>
9aff1b9
to
b521a26
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
Only one nit, otherwise LGTM! Thank you.
/approve
/lgtm
} | ||
|
||
func New(instancetypeBundlePath, preferenceBundlePath string) (operands.Operand, error) { | ||
virtualMachineClusterInstancetypes, err := fetchClusterResources[instancetypev1alpha2.VirtualMachineClusterInstancetype](instancetypeBundlePath) |
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 wonder if there's a way to make the import name less clunky.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0xFelix The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
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'm sorry I didn't look at this before it was merged.
I have some comments, can you implement them in another PR?
And also functional tests are missing.
} | ||
|
||
func (c *commonInstancetypes) RequiredCrds() []string { | ||
return nil |
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.
This operand requires these CRDs:
virtualmachineclusterinstancetypes.instancetype.kubevirt.io
virtualmachineclusterpreferences.instancetype.kubevirt.io
} | ||
|
||
func (c *commonInstancetypes) Cleanup(request *common.Request) ([]common.CleanupResult, error) { | ||
return nil, nil |
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.
This method must remove the created cluster resources.
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.
The example from common-templates
only drops deprecated templates so I wasn't sure what the expected behaviour here actually was:
ssp-operator/internal/operands/common-templates/reconcile.go
Lines 116 to 137 in d95ccb8
func (c *commonTemplates) Cleanup(request *common.Request) ([]common.CleanupResult, error) { | |
var objects []client.Object | |
namespace := request.Instance.Spec.CommonTemplates.Namespace | |
deprecatedTemplates, err := getDeprecatedTemplates(request) | |
if err != nil { | |
return nil, err | |
} | |
for _, obj := range deprecatedTemplates.Items { | |
obj.ObjectMeta.Namespace = namespace | |
objects = append(objects, &obj) | |
} | |
for index := range c.templatesBundle { | |
c.templatesBundle[index].ObjectMeta.Namespace = namespace | |
objects = append(objects, &c.templatesBundle[index]) | |
} | |
return common.DeleteAll(request, objects...) | |
} | |
I'll remove them all now in a follow up.
UpdateFunc(func(newRes, foundRes client.Object) { | ||
foundRes.(*instancetypev1alpha2.VirtualMachineClusterInstancetype).Spec = newRes.(*instancetypev1alpha2.VirtualMachineClusterInstancetype).Spec | ||
}). | ||
ImmutableSpec(func(resource client.Object) interface{} { |
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.
The VirtualMachineClusterInstancetype
is not immutable, so this method should not be called.
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.
Ah apologies I misunderstood things here, I'll drop it.
UpdateFunc(func(newRes, foundRes client.Object) { | ||
foundRes.(*instancetypev1alpha2.VirtualMachineClusterPreference).Spec = newRes.(*instancetypev1alpha2.VirtualMachineClusterPreference).Spec | ||
}). | ||
ImmutableSpec(func(resource client.Object) interface{} { |
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.
Similarly, preference is not immutable, so this method should not be called.
What this PR does / why we need it:
This initial change starts to simply deploy the initial v0.0.1-rc bundle
of VirtualMachineCluster{Instancetypes,Preferences} resources. These
resources are deployed under both OpenShift and non-OpenShift based
environments, at present this it the only functionality enabled under
the latter.
Future changes will introduce support for removing deprecated resources
and support for deploying resources from a repo URI.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: