mirror of https://github.com/kubernetes/kops.git
Apply gofmt to pkg directory
It was omitted from the makefile `make gofmt`
This commit is contained in:
parent
ddfa3e467e
commit
35cd96f359
1
Makefile
1
Makefile
|
|
@ -201,6 +201,7 @@ gofmt:
|
|||
gofmt -w -s federation/
|
||||
gofmt -w -s util/
|
||||
gofmt -w -s upup/pkg/
|
||||
gofmt -w -s pkg/
|
||||
gofmt -w -s protokube/cmd
|
||||
gofmt -w -s protokube/pkg
|
||||
gofmt -w -s dns-controller/cmd
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const DefaultChannel = "stable"
|
|||
|
||||
type Channel struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ChannelSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ func (z *ClusterZoneSpec) assignCIDR(c *Cluster) error {
|
|||
// We assume a maximum of 8 subnets per network
|
||||
// TODO: Does this make sense on GCE?
|
||||
// TODO: Should we limit this to say 1000 IPs per subnet? (any reason to?)
|
||||
index = index % 8 - 1
|
||||
index = index%8 - 1
|
||||
networkLength += 3
|
||||
|
||||
ip4 := cidr.IP.To4()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
type KubeletConfig struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ClusterSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
@ -374,24 +374,24 @@ type KubeAPIServerConfig struct {
|
|||
|
||||
LogLevel int `json:"logLevel,omitempty" flag:"v"`
|
||||
|
||||
CloudProvider string `json:"cloudProvider,omitempty" flag:"cloud-provider"`
|
||||
SecurePort int `json:"securePort,omitempty" flag:"secure-port"`
|
||||
Address string `json:"address,omitempty" flag:"address"`
|
||||
EtcdServers []string `json:"etcdServers,omitempty" flag:"etcd-servers"`
|
||||
EtcdServersOverrides []string `json:"etcdServersOverrides,omitempty" flag:"etcd-servers-overrides"`
|
||||
AdmissionControl []string `json:"admissionControl,omitempty" flag:"admission-control"`
|
||||
ServiceClusterIPRange string `json:"serviceClusterIPRange,omitempty" flag:"service-cluster-ip-range"`
|
||||
ClientCAFile string `json:"clientCAFile,omitempty" flag:"client-ca-file"`
|
||||
BasicAuthFile string `json:"basicAuthFile,omitempty" flag:"basic-auth-file"`
|
||||
TLSCertFile string `json:"tlsCertFile,omitempty" flag:"tls-cert-file"`
|
||||
TLSPrivateKeyFile string `json:"tlsPrivateKeyFile,omitempty" flag:"tls-private-key-file"`
|
||||
TokenAuthFile string `json:"tokenAuthFile,omitempty" flag:"token-auth-file"`
|
||||
AllowPrivileged *bool `json:"allowPrivileged,omitempty" flag:"allow-privileged"`
|
||||
APIServerCount *int `json:"apiServerCount,omitempty" flag:"apiserver-count"`
|
||||
// keys and values in RuntimeConfig are parsed into the `--runtime-config` parameter
|
||||
// for KubeAPIServer, concatenated with commas. ex: `--runtime-config=key1=value1,key2=value2`.
|
||||
// Use this to enable alpha resources on kube-apiserver
|
||||
RuntimeConfig map[string]string `json:"runtimeConfig,omitempty" flag:"runtime-config"`
|
||||
CloudProvider string `json:"cloudProvider,omitempty" flag:"cloud-provider"`
|
||||
SecurePort int `json:"securePort,omitempty" flag:"secure-port"`
|
||||
Address string `json:"address,omitempty" flag:"address"`
|
||||
EtcdServers []string `json:"etcdServers,omitempty" flag:"etcd-servers"`
|
||||
EtcdServersOverrides []string `json:"etcdServersOverrides,omitempty" flag:"etcd-servers-overrides"`
|
||||
AdmissionControl []string `json:"admissionControl,omitempty" flag:"admission-control"`
|
||||
ServiceClusterIPRange string `json:"serviceClusterIPRange,omitempty" flag:"service-cluster-ip-range"`
|
||||
ClientCAFile string `json:"clientCAFile,omitempty" flag:"client-ca-file"`
|
||||
BasicAuthFile string `json:"basicAuthFile,omitempty" flag:"basic-auth-file"`
|
||||
TLSCertFile string `json:"tlsCertFile,omitempty" flag:"tls-cert-file"`
|
||||
TLSPrivateKeyFile string `json:"tlsPrivateKeyFile,omitempty" flag:"tls-private-key-file"`
|
||||
TokenAuthFile string `json:"tokenAuthFile,omitempty" flag:"token-auth-file"`
|
||||
AllowPrivileged *bool `json:"allowPrivileged,omitempty" flag:"allow-privileged"`
|
||||
APIServerCount *int `json:"apiServerCount,omitempty" flag:"apiserver-count"`
|
||||
// keys and values in RuntimeConfig are parsed into the `--runtime-config` parameter
|
||||
// for KubeAPIServer, concatenated with commas. ex: `--runtime-config=key1=value1,key2=value2`.
|
||||
// Use this to enable alpha resources on kube-apiserver
|
||||
RuntimeConfig map[string]string `json:"runtimeConfig,omitempty" flag:"runtime-config"`
|
||||
}
|
||||
|
||||
type KubeControllerManagerConfig struct {
|
||||
|
|
|
|||
|
|
@ -18,4 +18,4 @@ limitations under the License.
|
|||
// +k8s:conversion-gen=k8s.io/kops/pkg/apis/kops
|
||||
|
||||
// +groupName=kops.k8s.io
|
||||
package kops // import "k8s.io/kops/pkg/apis/kops"
|
||||
package kops // import "k8s.io/kops/pkg/apis/kops"
|
||||
|
|
|
|||
|
|
@ -20,11 +20,10 @@ import (
|
|||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
)
|
||||
|
||||
|
||||
// Federation represents a federated set of kubernetes clusters
|
||||
type Federation struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec FederationSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
@ -33,7 +32,7 @@ type FederationSpec struct {
|
|||
Controllers []string `json:"controllers,omitempty"`
|
||||
Members []string `json:"members,omitempty"`
|
||||
|
||||
DNSName string `json:"dnsName,omitempty"`
|
||||
DNSName string `json:"dnsName,omitempty"`
|
||||
}
|
||||
|
||||
type FederationList struct {
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@ limitations under the License.
|
|||
package kops
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
)
|
||||
|
||||
|
||||
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||
// users must create.
|
||||
type ObjectMeta struct {
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ limitations under the License.
|
|||
package install
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/apimachinery/announced"
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/pkg/apis/kops/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/apimachinery/announced"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -33,7 +33,7 @@ func init() {
|
|||
AddInternalObjectsToScheme: kops.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||
},
|
||||
).Announce().RegisterAndEnable(); err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import (
|
|||
// InstanceGroup represents a group of instances (either nodes or masters) with the same configuration
|
||||
type InstanceGroup struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec InstanceGroupSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
var (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
|
|
@ -59,4 +59,4 @@ func (obj *InstanceGroup) GetObjectKind() unversioned.ObjectKind {
|
|||
}
|
||||
func (obj *Federation) GetObjectKind() unversioned.ObjectKind {
|
||||
return &obj.TypeMeta
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ package registry
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"k8s.io/kops/pkg/client/simple"
|
||||
api "k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/pkg/client/simple"
|
||||
)
|
||||
|
||||
func CreateClusterConfig(clientset simple.Clientset, cluster *api.Cluster, groups []*api.InstanceGroup) error {
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@ limitations under the License.
|
|||
package kops
|
||||
|
||||
const (
|
||||
TopologyPublic = "public"
|
||||
TopologyPrivate = "private"
|
||||
TopologyPublic = "public"
|
||||
TopologyPrivate = "private"
|
||||
)
|
||||
|
||||
type TopologySpec struct {
|
||||
// The environment to launch the Kubernetes masters in public|private
|
||||
Masters string `json:"masters,omitempty"`
|
||||
Masters string `json:"masters,omitempty"`
|
||||
|
||||
// The environment to launch the Kubernetes nodes in public|private
|
||||
Nodes string `json:"nodes,omitempty"`
|
||||
Nodes string `json:"nodes,omitempty"`
|
||||
|
||||
// Controls if a private topology should deploy a bastion host or not
|
||||
// The bastion host is designed to be a simple, and secure bridge between
|
||||
// the public subnet and the private subnet
|
||||
BypassBastion bool `json:"bypassBastion,omitempty"`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
type KubeletConfig struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ClusterSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,4 @@ limitations under the License.
|
|||
// +k8s:conversion-gen=k8s.io/kops/pkg/apis/kops
|
||||
|
||||
// +groupName=kops.k8s.io
|
||||
package v1alpha1 // import "k8s.io/kops/pkg/apis/kops/v1alpha1"
|
||||
package v1alpha1 // import "k8s.io/kops/pkg/apis/kops/v1alpha1"
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ limitations under the License.
|
|||
package v1alpha1
|
||||
|
||||
type DockerConfig struct {
|
||||
Bridge *string `json:"bridge,omitempty" flag:"bridge"`
|
||||
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
||||
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
||||
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
||||
Bridge *string `json:"bridge,omitempty" flag:"bridge"`
|
||||
LogLevel *string `json:"logLevel,omitempty" flag:"log-level"`
|
||||
IPTables *bool `json:"ipTables,omitempty" flag:"iptables"`
|
||||
IPMasq *bool `json:"ipMasq,omitempty" flag:"ip-masq"`
|
||||
|
||||
// Storage maps to the docker storage flag
|
||||
// But nodeup will also process a comma-separate list, selecting the first supported option
|
||||
Storage *string `json:"storage,omitempty" flag:"storage-driver"`
|
||||
Storage *string `json:"storage,omitempty" flag:"storage-driver"`
|
||||
|
||||
InsecureRegistry *string `json:"insecureRegistry,omitempty" flag:"insecure-registry"`
|
||||
MTU *int `json:"mtu,omitempty" flag:"mtu"`
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
type Federation struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec FederationSpec `json:"spec"`
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ type FederationSpec struct {
|
|||
Controllers []string `json:"controllers,omitempty"`
|
||||
Members []string `json:"members,omitempty"`
|
||||
|
||||
DNSName string `json:"dnsName,omitempty"`
|
||||
DNSName string `json:"dnsName,omitempty"`
|
||||
}
|
||||
|
||||
type FederationList struct {
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@ limitations under the License.
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
)
|
||||
|
||||
|
||||
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||
// users must create.
|
||||
type ObjectMeta struct {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
// InstanceGroup represents a group of instances (either nodes or masters) with the same configuration
|
||||
type InstanceGroup struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec InstanceGroupSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
var (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
|
|
@ -59,4 +59,4 @@ func (obj *InstanceGroup) GetObjectKind() unversioned.ObjectKind {
|
|||
}
|
||||
func (obj *Federation) GetObjectKind() unversioned.ObjectKind {
|
||||
return &obj.TypeMeta
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@ limitations under the License.
|
|||
package v1alpha1
|
||||
|
||||
const (
|
||||
TopologyPublic = "public"
|
||||
TopologyPrivate = "private"
|
||||
TopologyPublic = "public"
|
||||
TopologyPrivate = "private"
|
||||
)
|
||||
|
||||
type TopologySpec struct {
|
||||
// The environment to launch the Kubernetes masters in public|private
|
||||
Masters string `json:"masters,omitempty"`
|
||||
Masters string `json:"masters,omitempty"`
|
||||
|
||||
// The environment to launch the Kubernetes nodes in public|private
|
||||
Nodes string `json:"nodes,omitempty"`
|
||||
Nodes string `json:"nodes,omitempty"`
|
||||
|
||||
// Controls if a private topology should deploy a bastion host or not
|
||||
// The bastion host is designed to be a simple, and secure bridge between
|
||||
// the public subnet and the private subnet
|
||||
BypassBastion bool `json:"bypassBastion,omitempty"`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,18 +304,17 @@ func (c *Cluster) Validate(strict bool) error {
|
|||
c.Spec.Topology = &TopologySpec{Masters: TopologyPublic, Nodes: TopologyPublic}
|
||||
}
|
||||
|
||||
|
||||
if c.Spec.Topology.Masters != "" && c.Spec.Topology.Nodes != "" {
|
||||
if c.Spec.Topology.Masters != TopologyPublic && c.Spec.Topology.Masters != TopologyPrivate {
|
||||
return fmt.Errorf("Invalid Masters value for Topology")
|
||||
} else if c.Spec.Topology.Nodes != TopologyPublic && c.Spec.Topology.Nodes != TopologyPrivate {
|
||||
return fmt.Errorf("Invalid Nodes value for Topology")
|
||||
// Until we support other topologies - these must match
|
||||
// Until we support other topologies - these must match
|
||||
} else if c.Spec.Topology.Masters != c.Spec.Topology.Nodes {
|
||||
return fmt.Errorf("Topology Nodes must match Topology Masters")
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
return fmt.Errorf("Topology requires non-nil values for Masters and Nodes")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"github.com/golang/glog"
|
||||
api "k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/pkg/apis/kops/registry"
|
||||
"k8s.io/kops/pkg/apis/kops/v1alpha1"
|
||||
"k8s.io/kops/pkg/client/simple"
|
||||
"k8s.io/kops/util/pkg/vfs"
|
||||
k8sapi "k8s.io/kubernetes/pkg/api"
|
||||
|
|
@ -28,14 +29,13 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
"k8s.io/kops/pkg/apis/kops/v1alpha1"
|
||||
)
|
||||
|
||||
type ClusterVFS struct {
|
||||
commonVFS
|
||||
}
|
||||
|
||||
func newClusterVFS(basePath vfs.Path) (*ClusterVFS) {
|
||||
func newClusterVFS(basePath vfs.Path) *ClusterVFS {
|
||||
c := &ClusterVFS{}
|
||||
c.init("Cluster", basePath, v1alpha1.SchemeGroupVersion)
|
||||
defaultReadVersion := v1alpha1.SchemeGroupVersion.WithKind("Cluster")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package vfsclientset
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/golang/glog"
|
||||
kops "k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/util/pkg/vfs"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
|
|
@ -27,14 +28,13 @@ import (
|
|||
"os"
|
||||
"reflect"
|
||||
"time"
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
type commonVFS struct {
|
||||
kind string
|
||||
basePath vfs.Path
|
||||
decoder runtime.Decoder
|
||||
encoder runtime.Encoder
|
||||
kind string
|
||||
basePath vfs.Path
|
||||
decoder runtime.Decoder
|
||||
encoder runtime.Encoder
|
||||
defaultReadVersion *unversioned.GroupVersionKind
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ func (c *commonVFS) serialize(o runtime.Object) ([]byte, error) {
|
|||
return b.Bytes(), nil
|
||||
}
|
||||
|
||||
func (c*commonVFS) readConfig(configPath vfs.Path) (runtime.Object, error) {
|
||||
func (c *commonVFS) readConfig(configPath vfs.Path) (runtime.Object, error) {
|
||||
data, err := configPath.ReadFile()
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func newFederationVFS(c *VFSClientset) *FederationVFS {
|
|||
var _ simple.FederationInterface = &FederationVFS{}
|
||||
|
||||
func (c *FederationVFS) Get(name string) (*api.Federation, error) {
|
||||
o, err := c.get(name,)
|
||||
o, err := c.get(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ package vfsclientset
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
_ "k8s.io/kops/pkg/apis/kops/install"
|
||||
_ "k8s.io/kubernetes/pkg/api/install"
|
||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
_ "k8s.io/kops/pkg/apis/kops/install"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue