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

MGMT-15382: Ensure inspection is disabled on day-2 spoke node BMHs #5406

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/controller/controllers/bmh_agent_controller.go
Expand Up @@ -1359,6 +1359,9 @@ func (r *BMACReconciler) newSpokeBMH(log logrus.FieldLogger, bmh *bmh_v1alpha1.B
},
}
mutateFn := func() error {
// inspection must be disabled when providing hardware details
// ensure it is always disabled even for converged
setAnnotation(&bmhSpoke.ObjectMeta, BMH_INSPECT_ANNOTATION, "disabled")
carbonin marked this conversation as resolved.
Show resolved Hide resolved
bmhSpoke.Spec = bmh.Spec
// remove the credentials from the spoke's Spec so
// that BMO will set the status to unmanaged
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/controllers/bmh_agent_controller_test.go
Expand Up @@ -1068,7 +1068,7 @@ var _ = Describe("bmac reconcile", func() {
})

Context("when agent role worker and cluster deployment is set", func() {
It("should set spoke BMH when agent is not installing", func() {
It("should not create spoke BMH when agent is not installing", func() {
configMap := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "root-ca",
Expand Down Expand Up @@ -1105,7 +1105,7 @@ var _ = Describe("bmac reconcile", func() {
err = spokeClient.Get(ctx, types.NamespacedName{Name: machineName, Namespace: OPENSHIFT_MACHINE_API_NAMESPACE}, spokeMachine)
Expect(err).NotTo(BeNil())
})
It("should not set spoke BMH when agent is installing", func() {
It("should create spoke BMH when agent is installing", func() {
configMap := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "root-ca",
Expand Down Expand Up @@ -1143,6 +1143,7 @@ var _ = Describe("bmac reconcile", func() {
Expect(spokeBMH.ObjectMeta.Annotations).To(HaveKey(BMH_HARDWARE_DETAILS_ANNOTATION))
Expect(spokeBMH.ObjectMeta.Annotations[BMH_HARDWARE_DETAILS_ANNOTATION]).To(Equal(updatedHost.ObjectMeta.Annotations[BMH_HARDWARE_DETAILS_ANNOTATION]))
Expect(spokeBMH.ObjectMeta.Annotations).ToNot(HaveKey(BMH_DETACHED_ANNOTATION))
Expect(spokeBMH.ObjectMeta.Annotations[BMH_INSPECT_ANNOTATION]).To(Equal("disabled"))
Expect(spokeBMH.Spec.Image).To(Equal(updatedHost.Spec.Image))
Expect(spokeBMH.Spec.ConsumerRef.Kind).To(Equal("Machine"))
Expect(spokeBMH.Spec.ConsumerRef.Name).To(Equal(machineName))
Expand Down