rename ExposedPort

pull/427/head
iwilltry42 4 years ago
parent 0c32c36d99
commit 621640c901
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 8
      cmd/util/ports.go
  2. 2
      pkg/config/config_test.go
  3. 2
      pkg/config/v1alpha1/types.go
  4. 19
      pkg/types/types.go

@ -32,9 +32,9 @@ import (
)
// ParseExposePort parses/validates a string to create an exposePort struct from it
func ParseExposePort(portString string) (k3d.ExposePort, error) {
func ParseExposePort(portString string) (k3d.ExposedPort, error) {
var exposePort k3d.ExposePort
var exposePort k3d.ExposedPort
split := strings.Split(portString, ":")
if len(split) > 2 {
@ -43,14 +43,14 @@ func ParseExposePort(portString string) (k3d.ExposePort, error) {
}
if len(split) == 1 {
exposePort = k3d.ExposePort{Port: split[0]}
exposePort = k3d.ExposedPort{Port: split[0]}
} else {
// Make sure 'host' can be resolved to an IP address
addrs, err := net.LookupHost(split[0])
if err != nil {
return exposePort, err
}
exposePort = k3d.ExposePort{Host: split[0], HostIP: addrs[0], Port: split[1]}
exposePort = k3d.ExposedPort{Host: split[0], HostIP: addrs[0], Port: split[1]}
}
// Verify 'port' is an integer and within port ranges

@ -41,7 +41,7 @@ func TestReadSimpleConfig(t *testing.T) {
Name: "test",
Servers: 1,
Agents: 2,
ExposeAPI: k3d.ExposePort{
ExposeAPI: k3d.ExposedPort{
HostIP: "0.0.0.0",
Port: "6443",
},

@ -116,7 +116,7 @@ type SimpleConfig struct {
Name string `mapstructure:"name" yaml:"name" json:"name,omitempty"`
Servers int `mapstructure:"servers" yaml:"servers" json:"servers,omitempty"` //nolint:lll // default 1
Agents int `mapstructure:"agents" yaml:"agents" json:"agents,omitempty"` //nolint:lll // default 0
ExposeAPI k3d.ExposePort `mapstructure:"exposeAPI" yaml:"exposeAPI" json:"exposeAPI,omitempty"`
ExposeAPI k3d.ExposedPort `mapstructure:"exposeAPI" yaml:"exposeAPI" json:"exposeAPI,omitempty"`
Image string `mapstructure:"image" yaml:"image" json:"image,omitempty"`
Network string `mapstructure:"network" yaml:"network" json:"network,omitempty"`
ClusterToken string `mapstructure:"clusterToken" yaml:"clusterToken" json:"clusterToken,omitempty"` // default: auto-generated

@ -240,7 +240,7 @@ type Cluster struct {
Nodes []*Node `yaml:"nodes" json:"nodes,omitempty"`
InitNode *Node // init server node
ExternalDatastore *ExternalDatastore `yaml:"externalDatastore,omitempty" json:"externalDatastore,omitempty"`
ExposeAPI ExposePort `yaml:"exposeAPI" json:"exposeAPI,omitempty"`
ExposeAPI ExposedPort `yaml:"exposeAPI" json:"exposeAPI,omitempty"`
ServerLoadBalancer *Node `yaml:"serverLoadbalancer,omitempty" json:"serverLoadBalancer,omitempty"`
ImageVolume string `yaml:"imageVolume" json:"imageVolume,omitempty"`
}
@ -307,8 +307,8 @@ type Node struct {
// ServerOpts describes some additional server role specific opts
type ServerOpts struct {
IsInit bool `yaml:"isInitializingServer" json:"isInitializingServer,omitempty"`
ExposeAPI ExposePort // filled automatically
IsInit bool `yaml:"isInitializingServer" json:"isInitializingServer,omitempty"`
ExposeAPI ExposedPort // filled automatically
}
// ExternalDatastore describes an external datastore used for HA/multi-server clusters
@ -320,8 +320,8 @@ type ExternalDatastore struct {
Network string `yaml:"network" json:"network,omitempty"`
}
// ExposePort describes specs needed to expose the API-Server
type ExposePort struct {
// ExposedPort describes specs needed to expose the API-Server
type ExposedPort struct {
Host string `yaml:"host" json:"host,omitempty"`
HostIP string `yaml:"hostIP" json:"hostIP,omitempty"`
Port string `yaml:"port" json:"port"`
@ -356,10 +356,11 @@ const (
// Registry describes a k3d-managed registry
type Registry struct {
Host string `yaml:"host" json:"host"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
Port ExposePort `yaml:"port" json:"port"`
Options struct {
ClusterRef string // filled automatically -> if created with a cluster
Host string `yaml:"host" json:"host"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
Port ExposedPort `yaml:"port" json:"port"`
Options struct {
ConfigFile string `yaml:"configFile,omitempty" json:"configFile,omitempty"`
Proxy struct {
RemoteURL string `yaml:"remoteURL" json:"remoteURL"`

Loading…
Cancel
Save