mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 15:32:24 +00:00
fix: Correctly type top level network IPAM config
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
2d014d2a5d
commit
9fab0fc5cc
@ -63,17 +63,21 @@ export class Network {
|
|||||||
ipam: {
|
ipam: {
|
||||||
driver: network.IPAM.Driver,
|
driver: network.IPAM.Driver,
|
||||||
config: _.map(network.IPAM.Config, conf => {
|
config: _.map(network.IPAM.Config, conf => {
|
||||||
const newConf: NetworkConfig['ipam']['config'][0] = {
|
const newConf: NetworkConfig['ipam']['config'][0] = {};
|
||||||
subnet: conf.Subnet,
|
|
||||||
gateway: conf.Gateway,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if (conf.Subnet != null) {
|
||||||
|
newConf.subnet = conf.Subnet;
|
||||||
|
}
|
||||||
|
if (conf.Gateway != null) {
|
||||||
|
newConf.gateway = conf.Gateway;
|
||||||
|
}
|
||||||
if (conf.IPRange != null) {
|
if (conf.IPRange != null) {
|
||||||
newConf.ipRange = conf.IPRange;
|
newConf.ipRange = conf.IPRange;
|
||||||
}
|
}
|
||||||
if (conf.AuxAddress != null) {
|
if (conf.AuxAddress != null) {
|
||||||
newConf.auxAddress = conf.AuxAddress;
|
newConf.auxAddress = conf.AuxAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newConf;
|
return newConf;
|
||||||
}),
|
}),
|
||||||
options: network.IPAM.Options == null ? {} : network.IPAM.Options,
|
options: network.IPAM.Options == null ? {} : network.IPAM.Options,
|
||||||
@ -162,10 +166,13 @@ export class Network {
|
|||||||
IPAM: {
|
IPAM: {
|
||||||
Driver: this.config.ipam.driver,
|
Driver: this.config.ipam.driver,
|
||||||
Config: _.map(this.config.ipam.config, conf => {
|
Config: _.map(this.config.ipam.config, conf => {
|
||||||
const ipamConf: DockerIPAMConfig = {
|
const ipamConf: DockerIPAMConfig = {};
|
||||||
Subnet: conf.subnet,
|
if (conf.subnet != null) {
|
||||||
Gateway: conf.gateway,
|
ipamConf.Subnet = conf.subnet;
|
||||||
};
|
}
|
||||||
|
if (conf.gateway != null) {
|
||||||
|
ipamConf.Gateway = conf.gateway;
|
||||||
|
}
|
||||||
if (conf.auxAddress != null) {
|
if (conf.auxAddress != null) {
|
||||||
ipamConf.AuxAddress = conf.auxAddress;
|
ipamConf.AuxAddress = conf.auxAddress;
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ export interface NetworkConfig {
|
|||||||
ipam: {
|
ipam: {
|
||||||
driver: string;
|
driver: string;
|
||||||
config: Array<{
|
config: Array<{
|
||||||
subnet: string;
|
subnet?: string;
|
||||||
gateway: string;
|
gateway?: string;
|
||||||
ipRange?: string;
|
ipRange?: string;
|
||||||
auxAddress?: string;
|
auxAddress?: string;
|
||||||
}>;
|
}>;
|
||||||
@ -53,9 +53,9 @@ export interface NetworkConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DockerIPAMConfig {
|
export interface DockerIPAMConfig {
|
||||||
Subnet: string;
|
Subnet?: string;
|
||||||
IPRange?: string;
|
IPRange?: string;
|
||||||
Gateway: string;
|
Gateway?: string;
|
||||||
AuxAddress?: string;
|
AuxAddress?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user