Skip to content

Commit

Permalink
api: Adds vSphere 7.0u1-u3 support to namespace-management (Tanzu)
Browse files Browse the repository at this point in the history
Closes: #2860
Signed-off-by: Adam Fowler <adam@adamfowler.org>
  • Loading branch information
adamfowleruk committed Jul 20, 2022
1 parent 4a6c4b1 commit 642156d
Show file tree
Hide file tree
Showing 3 changed files with 506 additions and 40 deletions.
28 changes: 21 additions & 7 deletions govc/namespace/cluster/enable.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2020 VMware, Inc. All Rights Reserved.
Copyright (c) 2020-2022 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,7 @@ type enableCluster struct {
ControlPlaneDNSSearchDomains string
ImageStoragePolicy string
NcpClusterNetworkSpec workloadNetwork
ControlPlaneManagementNetwork namespace.MasterManagementNetwork
ControlPlaneManagementNetwork masterManagementNetwork
ControlPlaneDNSNames string
ControlPlaneNTPServers string
EphemeralStoragePolicy string
Expand All @@ -51,6 +51,13 @@ type enableCluster struct {
*flags.ClusterFlag
}

type masterManagementNetwork struct {
Mode string
FloatingIP string
AddressRange *namespace.AddressRange
Network string
}

type workloadNetwork struct {
NsxEdgeCluster string
PodCidrs string
Expand All @@ -71,7 +78,7 @@ type objectReferences struct {

func init() {
newEnableCluster := &enableCluster{
ControlPlaneManagementNetwork: namespace.MasterManagementNetwork{
ControlPlaneManagementNetwork: masterManagementNetwork{
AddressRange: &namespace.AddressRange{},
},
}
Expand Down Expand Up @@ -303,7 +310,11 @@ func (cmd *enableCluster) toVapiSpec(refs objectReferences) (*namespace.EnableCl
if (cmd.ControlPlaneManagementNetwork.Mode != "") ||
(cmd.ControlPlaneManagementNetwork.FloatingIP != "") ||
(cmd.ControlPlaneManagementNetwork.Network != "") {
masterManagementNetwork = &cmd.ControlPlaneManagementNetwork
masterManagementNetwork.AddressRange = cmd.ControlPlaneManagementNetwork.AddressRange
masterManagementNetwork.FloatingIP = cmd.ControlPlaneManagementNetwork.FloatingIP
ipam := namespace.IpAssignmentModeFromString(cmd.ControlPlaneManagementNetwork.Mode)
masterManagementNetwork.Mode = &ipam
masterManagementNetwork.Network = cmd.ControlPlaneManagementNetwork.Network
}
if masterManagementNetwork != nil {
if (masterManagementNetwork.AddressRange.SubnetMask == "") &&
Expand All @@ -315,9 +326,12 @@ func (cmd *enableCluster) toVapiSpec(refs objectReferences) (*namespace.EnableCl
masterManagementNetwork.Network = refs.Network
}

sh := namespace.SizingHintFromString(cmd.SizeHint)
np := namespace.ClusterNetworkProviderFromString(cmd.NetworkProvider)

spec := namespace.EnableClusterSpec{
MasterDNSSearchDomains: splitCommaSeparatedList(cmd.ControlPlaneDNSSearchDomains),
ImageStorage: namespace.ImageStorage{StoragePolicy: refs.ImageStoragePolicy},
ImageStorage: namespace.ImageStorageSpec{StoragePolicy: refs.ImageStoragePolicy},
NcpClusterNetworkSpec: &namespace.NcpClusterNetworkSpec{
NsxEdgeCluster: refs.EdgeCluster,
PodCidrs: podCidrs,
Expand All @@ -332,11 +346,11 @@ func (cmd *enableCluster) toVapiSpec(refs objectReferences) (*namespace.EnableCl
DefaultImageRepository: cmd.DefaultImageRepository,
ServiceCidr: serviceCidr,
LoginBanner: cmd.LoginBanner,
SizeHint: cmd.SizeHint,
SizeHint: &sh,
WorkerDNS: splitCommaSeparatedList(cmd.WorkerDNS),
DefaultImageRegistry: nil,
MasterDNS: splitCommaSeparatedList(cmd.ControlPlaneDNS),
NetworkProvider: cmd.NetworkProvider,
NetworkProvider: &np,
MasterStoragePolicy: refs.ControlPlaneStoragePolicy,
DefaultKubernetesServiceContentLibrary: cmd.DefaultKubernetesServiceContentLibrary,
}
Expand Down
Loading

0 comments on commit 642156d

Please sign in to comment.