Repository navigation
MGMT-18510: Add an annotation to override ironic IP family to provide in dual-stack hubs #6686
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,7 +191,7 @@ var _ = Describe("PreprovisioningImage reconcile", func() { | |
| Expect(*internalIgnitionConfig).Should(ContainSubstring(ironicServiceIPs[0])) | ||
| Expect(*internalIgnitionConfig).Should(ContainSubstring(ironicInspectorIPs[0])) | ||
| }).Return( | ||
| &common.InfraEnv{InfraEnv: models.InfraEnv{ClusterID: clusterID, ID: &infraEnvID, DownloadURL: downloadURL, CPUArchitecture: infraEnvArch}, GeneratedAt: strfmt.DateTime(time.Now())}, nil).Times(1) | ||
| &common.InfraEnv{InfraEnv: models.InfraEnv{ID: &infraEnvID, DownloadURL: downloadURL, CPUArchitecture: infraEnvArch}, GeneratedAt: strfmt.DateTime(time.Now())}, nil).Times(1) | ||
| mockCRDEventsHandler.EXPECT().NotifyInfraEnvUpdates(infraEnv.Name, infraEnv.Namespace).Times(1) | ||
| mockBMOUtils.EXPECT().getICCConfig(gomock.Any()).Times(1).Return(nil, errors.Errorf("ICC configuration is not available")) | ||
| res, err := pr.Reconcile(ctx, newPreprovisioningImageRequest(ppi)) | ||
|
|
@@ -233,6 +233,31 @@ var _ = Describe("PreprovisioningImage reconcile", func() { | |
| Expect(c.Get(ctx, key, infraEnv)).To(BeNil()) | ||
| Expect(infraEnv.ObjectMeta.Annotations[EnableIronicAgentAnnotation]).To(Equal("true")) | ||
| }) | ||
| It("Adds the ironic IPv6 address to the ignition when the infraEnv has no cluster and is annotated for IPv6", func() { | ||
| metav1.SetMetaDataAnnotation(&infraEnv.ObjectMeta, infraEnvIPFamilyAnnotation, ipv6Family) | ||
| Expect(c.Create(ctx, infraEnv)).To(BeNil()) | ||
| backendInfraEnv.ClusterID = "" | ||
| mockInstallerInternal.EXPECT().GetInfraEnvByKubeKey(gomock.Any()).Return(backendInfraEnv, nil) | ||
| mockInstallerInternal.EXPECT().UpdateInfraEnvInternal(gomock.Any(), gomock.Any(), gomock.Any()). | ||
| Do(func(ctx context.Context, params installer.UpdateInfraEnvParams, internalIgnitionConfig *string) { | ||
| Expect(params.InfraEnvID).To(Equal(*backendInfraEnv.ID)) | ||
| Expect(*internalIgnitionConfig).Should(ContainSubstring(url.QueryEscape(ironicServiceIPs[1]))) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made the assumption here that Could we have a comment here that points out that we are using IPv6 addresses here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test name is "Adds the ironic IPv6 address to the ignition when the infraEnv has no cluster and is annotated for IPv6" do you really think more commentary is required? Also the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw the title of the test and I knew of the hard coded IP slice. I thought it would be more convenient for future readers of this code to not have to look up the hard coded list. Instead of a comment, the code could be updated to make things read more nicely. I mean something like this...with the appropriate changes to where the original slices are referenced, it doesn't make a massive difference but will make it extremely obvious when the v4 or v6 IP is referenced. |
||
| Expect(*internalIgnitionConfig).Should(ContainSubstring(url.QueryEscape(ironicInspectorIPs[1]))) | ||
| }).Return( | ||
| &common.InfraEnv{InfraEnv: models.InfraEnv{ID: &infraEnvID, DownloadURL: downloadURL, CPUArchitecture: infraEnvArch}, GeneratedAt: strfmt.DateTime(time.Now())}, nil).Times(1) | ||
| mockCRDEventsHandler.EXPECT().NotifyInfraEnvUpdates(infraEnv.Name, infraEnv.Namespace).Times(1) | ||
| mockBMOUtils.EXPECT().getICCConfig(gomock.Any()).Times(1).Return(nil, errors.Errorf("ICC configuration is not available")) | ||
| res, err := pr.Reconcile(ctx, newPreprovisioningImageRequest(ppi)) | ||
| Expect(err).To(BeNil()) | ||
| Expect(res).To(Equal(ctrl.Result{})) | ||
|
|
||
| key := types.NamespacedName{ | ||
| Namespace: testNamespace, | ||
| Name: "testInfraEnv", | ||
| } | ||
| Expect(c.Get(ctx, key, infraEnv)).To(BeNil()) | ||
| Expect(infraEnv.ObjectMeta.Annotations[EnableIronicAgentAnnotation]).To(Equal("true")) | ||
| }) | ||
| It("Wait for InfraEnv cool down", func() { | ||
| infraEnv.Status.ISODownloadURL = downloadURL | ||
| infraEnv.Status.CreatedTime = &metav1.Time{Time: time.Now()} | ||
|
|
||
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.
why use
internalInfraEnvhere instead ofinfraEnvas before? It's because of the late binding?Uh oh!
There was an error while loading. Please reload this page.
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 changed the name to be more consistent with the other functions that have both.
Now
internalInfraEnvis the db object andinfraEnvis the CR.In this case I needed both because
infraEnvhas the annotations.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.
oh right! I missed that
infraEnvwas referring to the DB object 🤦♂️, it's a very good change 👍