Skip to content

Commit

Permalink
MGMT-17106: Disable ironic vlan creation when static networking confi…
Browse files Browse the repository at this point in the history
…g is present (#6055)

* Vendor new ICC code

* Disable ironic vlan creation when static networking config is present

Previously the ironic agent would define vlan interfaces when it
detected that vlans were present using LLDP

This change only allows this type of reconfiguration if the user didn't
provide static networking config. If a user does provide static
networking config and requires vlans it's expected that they will
configure them manually rather than relying on LLDP-based configuration
from the ironic agent.

Resolves https://issues.redhat.com/browse/MGMT-17106
  • Loading branch information
carbonin committed Mar 6, 2024
1 parent ffc9aef commit 3864109
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 40 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
github.com/openshift/custom-resource-status v1.1.2
github.com/openshift/generic-admission-server v1.14.1-0.20231020105858-8dcc3c9b298f
github.com/openshift/hive/apis v0.0.0-20220222213051-def9088fdb5a
github.com/openshift/image-customization-controller v0.0.0-20231018032321-4677f060c4bf
github.com/openshift/image-customization-controller v0.0.0-20240129110832-60a3867d7f9e
github.com/ory/dockertest/v3 v3.9.1
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pelletier/go-toml v1.9.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1366,8 +1366,8 @@ github.com/openshift/generic-admission-server v1.14.1-0.20231020105858-8dcc3c9b2
github.com/openshift/generic-admission-server v1.14.1-0.20231020105858-8dcc3c9b298f/go.mod h1:/CLsleDcQ6AFTGKJe9VL3Y4rB9DqX3fQwQv47q2/ZJc=
github.com/openshift/hive/apis v0.0.0-20220222213051-def9088fdb5a h1:E+XPJs/aVvYsrlJzo2ED38ZTR2RTNUlFMmOaFAAdMZg=
github.com/openshift/hive/apis v0.0.0-20220222213051-def9088fdb5a/go.mod h1:E1bgquRiwfugdArdecPbpYIrAdve5kTzMaJb0+8jMXI=
github.com/openshift/image-customization-controller v0.0.0-20231018032321-4677f060c4bf h1:Z+LlKXsPGtzMsIQxSWAtebZLlUV/o678wYReGItPSkc=
github.com/openshift/image-customization-controller v0.0.0-20231018032321-4677f060c4bf/go.mod h1:rTvO75VGcFhEuE2HgQe10OijcR9HBDNC+CnKei8p1HE=
github.com/openshift/image-customization-controller v0.0.0-20240129110832-60a3867d7f9e h1:x1j5gWm4PdTTXTmuX3S7VAmsnazbbMiefQyCLdyjH74=
github.com/openshift/image-customization-controller v0.0.0-20240129110832-60a3867d7f9e/go.mod h1:rTvO75VGcFhEuE2HgQe10OijcR9HBDNC+CnKei8p1HE=
github.com/openshift/library-go v0.0.0-20191003152030-97c62d8a2901/go.mod h1:NBttNjZpWwup/nthuLbPAPSYC8Qyo+BBK5bCtFoyYjo=
github.com/openshift/library-go v0.0.0-20200831114015-2ab0c61c15de/go.mod h1:6vwp+YhYOIlj8MpkQKkebTTSn2TuYyvgiAFQ206jIEQ=
github.com/openshift/library-go v0.0.0-20231110170715-08d73a9c798b h1:BmunS/b02dKSwQ0H21+3EbXDfDr9t8UDlO54WxKkOts=
Expand Down
9 changes: 7 additions & 2 deletions internal/ignition/ironic.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ func GenerateIronicConfig(ironicBaseURL string, ironicInspectorURL string, infra
config.Ignition.Version = "3.2.0"

httpProxy, httpsProxy, noProxy := common.GetProxyConfigs(infraEnv.Proxy)
ironicInspectorVlanInterfaces := ""
// allow ironic to configure vlans if no static network config is provided
if infraEnv.StaticNetworkConfig == "" {
ironicInspectorVlanInterfaces = "all"
}
// TODO: this should probably get the pullSecret as well
ib, err := iccignition.New([]byte{}, []byte{}, ironicBaseURL, ironicInspectorURL, ironicAgentImage, "", "", "", httpProxy, httpsProxy, noProxy, "")
ib, err := iccignition.New([]byte{}, []byte{}, ironicBaseURL, ironicInspectorURL, ironicAgentImage, "", "", "", httpProxy, httpsProxy, noProxy, "", ironicInspectorVlanInterfaces)
if err != nil {
return []byte{}, err
}
config.Storage.Files = []ignition_config_types_32.File{ib.IronicAgentConf()}
config.Storage.Files = []ignition_config_types_32.File{ib.IronicAgentConf(ironicInspectorVlanInterfaces)}
// TODO: sort out the flags (authfile...) and copy network
config.Systemd.Units = []ignition_config_types_32.Unit{ib.IronicAgentService(false)}
return json.Marshal(config)
Expand Down
12 changes: 12 additions & 0 deletions internal/ignition/ironic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
. "github.com/onsi/gomega"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
"github.com/vincent-petithory/dataurl"
)

var _ = Describe("GenerateIronicConfig", func() {
Expand Down Expand Up @@ -45,6 +46,17 @@ var _ = Describe("GenerateIronicConfig", func() {
_, err := GenerateIronicConfig(ironicBaseURL, inspectorURL, infraEnv, "")
Expect(err).To(HaveOccurred())
})
It("set the ironic inspector config to not tag interfaces when static networking is configured", func() {
infraEnv.StaticNetworkConfig = "some network config here"
conf, err := GenerateIronicConfig(ironicBaseURL, inspectorURL, infraEnv, "ironicAgentImage:custom")
Expect(err).NotTo(HaveOccurred())
Expect(conf).Should(ContainSubstring(dataurl.Escape([]byte("enable_vlan_interfaces = \n"))))
})
It("sets the ironic inspector config to tag all interfaces when static networking is not configured", func() {
conf, err := GenerateIronicConfig(ironicBaseURL, inspectorURL, infraEnv, "ironicAgentImage:custom")
Expect(err).NotTo(HaveOccurred())
Expect(conf).Should(ContainSubstring(dataurl.Escape([]byte("enable_vlan_interfaces = all\n"))))
})
})

func validateIgnition(conf []byte) {
Expand Down

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

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ github.com/openshift/hive/apis/hive/v1/openstack
github.com/openshift/hive/apis/hive/v1/ovirt
github.com/openshift/hive/apis/hive/v1/vsphere
github.com/openshift/hive/apis/scheme
# github.com/openshift/image-customization-controller v0.0.0-20231018032321-4677f060c4bf
# github.com/openshift/image-customization-controller v0.0.0-20240129110832-60a3867d7f9e
## explicit; go 1.19
github.com/openshift/image-customization-controller/pkg/ignition
# github.com/openshift/library-go v0.0.0-20231110170715-08d73a9c798b
Expand Down

0 comments on commit 3864109

Please sign in to comment.