{"modulePath":"github.com/LinuxGit/kops","version":"v1.15.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package model\n\n## Constants\n\n```go\nconst (\n\tCloudConfigFilePath = \"/etc/kubernetes/cloud.config\"\n\n\t// Required for vSphere CloudProvider\n\tMinimumVersionForVMUUID = \"1.5.3\"\n\n\t// VM UUID is set by cloud-init\n\tVM_UUID_FILE_PATH = \"/etc/vmware/vm_uuid\"\n)\n```\n\n```go\nconst (\n\tRoleLabelName15        = \"kubernetes.io/role\"\n\tRoleLabelName16        = \"kubernetes.io/role\"\n\tRoleMasterLabelValue15 = \"master\"\n\tRoleNodeLabelValue15   = \"node\"\n\n\tRoleLabelMaster16 = \"node-role.kubernetes.io/master\"\n\tRoleLabelNode16   = \"node-role.kubernetes.io/node\"\n)\n```\n\n```go\nconst DefaultDockerVersion = \"1.12.3\"\n```\nDefaultDockerVersion is the (legacy) docker version we use if one is not specified in the manifest. We don't change this with each version of kops, we expect newer versions of kops to populate the field.\n\n```go\nconst PathAuthnConfig = \"/etc/kubernetes/authn.config\"\n```\nPathAuthnConfig is the path to the custom webhook authentication config\n\n```go\nconst ServiceName = \"update-service\"\n```\nServiceName is the name given to the service to be created\n\n## Functions\n\n```go\nfunc EvaluateHostnameOverride(hostnameOverride string) (string, error)\n```\nEvaluateHostnameOverride returns the hostname after replacing some well-known placeholders\n\n## Types\n\n```go\ntype Architecture string\n```\n\n```go\nvar (\n\tArchitectureAmd64 Architecture = \"amd64\"\n\tArchitectureArm   Architecture = \"arm\"\n)\n```\n\n```go\ntype CloudConfigBuilder struct {\n\t*NodeupModelContext\n}\n```\nCloudConfigBuilder creates the cloud configuration file\n\n```go\nfunc (b *CloudConfigBuilder) Build(c *fi.ModelBuilderContext) error\n```\n\n```go\ntype DirectoryBuilder struct {\n\t*NodeupModelContext\n}\n```\nDirectoryBuilder creates required directories\n\n```go\nfunc (b *DirectoryBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for specific directories are created - os dependent\n\n```go\ntype DockerBuilder struct {\n\t*NodeupModelContext\n}\n```\nDockerBuilder install docker (just the packages at the moment)\n\n```go\nfunc (b *DockerBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring the docker daemon\n\n```go\ntype EtcdBuilder struct {\n\t*NodeupModelContext\n}\n```\nEtcdBuilder installs etcd\n\n```go\nfunc (b *EtcdBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for creating the etcd user\n\n```go\ntype EtcdManagerTLSBuilder struct {\n\t*NodeupModelContext\n}\n```\nEtcdManagerTLSBuilder configures TLS support for etcd-manager\n\n```go\nfunc (b *EtcdManagerTLSBuilder) Build(ctx *fi.ModelBuilderContext) error\n```\nBuild is responsible for TLS configuration for etcd-manager\n\n```go\ntype EtcdTLSBuilder struct {\n\t*NodeupModelContext\n}\n```\nEtcdTLSBuilder configures the etcd TLS support\n\n```go\nfunc (b *EtcdTLSBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for performing setup for CNIs that need etcd TLS support\n\n```go\ntype FileAssetsBuilder struct {\n\t*NodeupModelContext\n}\n```\nFileAssetsBuilder configures the hooks\n\n```go\nfunc (f *FileAssetsBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for writing out the file assets from cluster and instanceGroup\n\n```go\ntype FirewallBuilder struct {\n\t*NodeupModelContext\n}\n```\nFirewallBuilder configures the firewall (iptables)\n\n```go\nfunc (b *FirewallBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for generating any node firewall rules\n\n```go\ntype HookBuilder struct {\n\t*NodeupModelContext\n}\n```\nHookBuilder configures the hooks\n\n```go\nfunc (h *HookBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for implementing the cluster hook\n\n```go\ntype KubeAPIServerBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubeAPIServerBuilder install kube-apiserver (just the manifest at the moment)\n\n```go\nfunc (b *KubeAPIServerBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for generating the configuration for the kube-apiserver\n\n```go\ntype KubeControllerManagerBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubeControllerManagerBuilder install kube-controller-manager (just the manifest at the moment)\n\n```go\nfunc (b *KubeControllerManagerBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring the kube-controller-manager\n\n```go\ntype KubeProxyBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubeProxyBuilder installs kube-proxy\n\n```go\nfunc (b *KubeProxyBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for building the kube-proxy manifest @TODO we should probably change this to a daemonset in the future and follow the kubeadm path\n\n```go\ntype KubeRouterBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubeRouterBuilder installs kube-router\n\n```go\nfunc (b *KubeRouterBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring the kube-router\n\n```go\ntype KubeSchedulerBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubeSchedulerBuilder install kube-scheduler\n\n```go\nfunc (b *KubeSchedulerBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for building the manifest for the kube-scheduler\n\n```go\ntype KubectlBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubectlBuilder install kubectl\n\n```go\nfunc (b *KubectlBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for managing the kubectl on the nodes\n\n```go\ntype KubeletBuilder struct {\n\t*NodeupModelContext\n}\n```\nKubeletBuilder installs kubelet\n\n```go\nfunc (b *KubeletBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for building the kubelet configuration\n\n```go\ntype LogrotateBuilder struct {\n\t*NodeupModelContext\n}\n```\nLogrotateBuilder installs logrotate.d and configures log rotation for kubernetes logs\n\n```go\nfunc (b *LogrotateBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring logrotate\n\n```go\ntype ManifestsBuilder struct {\n\t*NodeupModelContext\n}\n```\nManifestsBuilder copies manifests from the store (e.g. etcdmanager)\n\n```go\nfunc (b *ManifestsBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild creates tasks for copying the manifests\n\n```go\ntype MiscUtilsBuilder struct {\n\t*NodeupModelContext\n}\n```\nMiscUtilsBuilder ensures that some system packages that are required for kubernetes are installed (e.g. socat)\n\n```go\nfunc (b *MiscUtilsBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring the miscellaneous packages we want installed\n\n```go\ntype NTPBuilder struct {\n\t*NodeupModelContext\n}\n```\nNTPBuilder installs and starts NTP, to ensure accurate clock times. As well as general log confusion, clock-skew of more than 5 minutes causes AWS API calls to fail\n\n```go\nfunc (b *NTPBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring NTP\n\n```go\ntype NetworkBuilder struct {\n\t*NodeupModelContext\n}\n```\nNetworkBuilder writes CNI assets\n\n```go\nfunc (b *NetworkBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring the network cni\n\n```go\ntype NodeAuthorizationBuilder struct {\n\t*NodeupModelContext\n}\n```\nNodeAuthorizationBuilder is responsible for node authorization\n\n```go\nfunc (b *NodeAuthorizationBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for handling the node authorization client\n\n```go\ntype NodeupModelContext struct {\n\tArchitecture  Architecture\n\tAssets        *fi.AssetStore\n\tCluster       *kops.Cluster\n\tDistribution  distros.Distribution\n\tInstanceGroup *kops.InstanceGroup\n\tKeyStore      fi.CAStore\n\tNodeupConfig  *nodeup.Config\n\tSecretStore   fi.SecretStore\n\n\t// IsMaster is true if the InstanceGroup has a role of master (populated by Init)\n\tIsMaster bool\n\t// contains filtered or unexported fields\n}\n```\nNodeupModelContext is the context supplied the nodeup tasks\n\n```go\nfunc (c *NodeupModelContext) BuildCertificatePairTask(ctx *fi.ModelBuilderContext, key, path, filename string) error\n```\nBuildCertificatePairTask creates the tasks to pull down the certificate and private key\n\n```go\nfunc (c *NodeupModelContext) BuildCertificateTask(ctx *fi.ModelBuilderContext, name, filename string) error\n```\nBuildCertificateTask is responsible for build a certificate request task\n\n```go\nfunc (c *NodeupModelContext) BuildKubeConfig(username string, ca, certificate, privateKey []byte) (string, error)\n```\nBuildKubeConfig is responsible for building a kubeconfig\n\n```go\nfunc (c *NodeupModelContext) BuildPKIKubeconfig(name string) (string, error)\n```\nBuildPKIKubeconfig generates a kubeconfig\n\n```go\nfunc (c *NodeupModelContext) BuildPrivateKeyTask(ctx *fi.ModelBuilderContext, name, filename string) error\n```\nBuildPrivateKeyTask is responsible for build a certificate request task\n\n```go\nfunc (c *NodeupModelContext) CNIBinDir() string\n```\nCNIBinDir returns the path for the CNI binaries\n\n```go\nfunc (c *NodeupModelContext) CNIConfDir() string\n```\nCNIConfDir returns the CNI directory\n\n```go\nfunc (c *NodeupModelContext) EnsureDirectory(path string) error\n```\nEnsureDirectory ensures the directory exists or creates it\n\n```go\nfunc (c *NodeupModelContext) EnsureSystemdSuffix(name string) string\n```\nEnsureSystemdSuffix ensures that the hook name ends with a valid systemd unit file extension. If it doesn't, it adds \".service\" for backwards-compatibility with older versions of Kops\n\n```go\nfunc (c *NodeupModelContext) FileAssetsDefaultPath() string\n```\nFileAssetsDefaultPath is the default location for assets which have no path\n\n```go\nfunc (c *NodeupModelContext) FindCert(name string) ([]byte, error)\n```\nFindCert is a helper method to retrieving a certificate from the store\n\n```go\nfunc (c *NodeupModelContext) FindPrivateKey(name string) ([]byte, error)\n```\nFindPrivateKey is a helper method to retrieving a private key from the store\n\n```go\nfunc (c *NodeupModelContext) Init() error\n```\nInit completes initialization of the object, for example pre-parsing the kubernetes version\n\n```go\nfunc (c *NodeupModelContext) IsKubernetesGTE(version string) bool\n```\nIsKubernetesGTE checks if the version is greater-than-or-equal\n\n```go\nfunc (c *NodeupModelContext) IsMounted(m mount.Interface, device, path string) (bool, error)\n```\nIsMounted checks if the device is mount\n\n```go\nfunc (c *NodeupModelContext) KubectlPath() string\n```\nKubectlPath returns distro based path for kubectl\n\n```go\nfunc (c *NodeupModelContext) KubeletBootstrapKubeconfig() string\n```\nKubeletBootstrapKubeconfig is the path the bootstrap config file\n\n```go\nfunc (c *NodeupModelContext) KubeletKubeConfig() string\n```\nKubeletKubeConfig is the path of the kubelet kubeconfig file\n\n```go\nfunc (c *NodeupModelContext) NodeName() (string, error)\n```\nNodeName returns the name of the local Node, as it will be created in k8s\n\n```go\nfunc (c *NodeupModelContext) PathSrvKubernetes() string\n```\nPathSrvKubernetes returns the path for the kubernetes service files\n\n```go\nfunc (c *NodeupModelContext) PathSrvSshproxy() string\n```\nPathSrvSshproxy returns the path for the SSL proxy\n\n```go\nfunc (c *NodeupModelContext) SSLHostPaths() []string\n```\nSSLHostPaths returns the TLS paths for the distribution\n\n```go\nfunc (c *NodeupModelContext) UseBootstrapTokens() bool\n```\nUseBootstrapTokens checks if we are using bootstrap tokens\n\n```go\nfunc (c *NodeupModelContext) UseEtcdManager() bool\n```\nUseEtcdManager checks if the etcd cluster has etcd-manager enabled\n\n```go\nfunc (c *NodeupModelContext) UseEtcdTLS() bool\n```\nUseEtcdTLS checks if the etcd cluster has TLS enabled bool\n\n```go\nfunc (c *NodeupModelContext) UseEtcdTLSAuth() bool\n```\nUseEtcdTLSAuth checks the peer-auth is set in both cluster @NOTE: in retrospect i think we should have consolidated the common config in the wrapper struct; it feels weird we set things like version, tls etc per cluster since they both have to be the same.\n\n```go\nfunc (c *NodeupModelContext) UseNodeAuthorization() bool\n```\nUseNodeAuthorization checks if have a node authorization policy\n\n```go\nfunc (c *NodeupModelContext) UseNodeAuthorizer() bool\n```\nUseNodeAuthorizer checks if node authorization is enabled\n\n```go\nfunc (c *NodeupModelContext) UseSecureKubelet() bool\n```\nUseSecureKubelet checks if the kubelet api should be protected by a client certificate. Note: the settings are in one of three section, master specific kubelet, cluster wide kubelet or the InstanceGroup. Though arguably is doesn't make much sense to unset this on a per InstanceGroup level, but hey :)\n\n```go\nfunc (c *NodeupModelContext) UseVolumeMounts() bool\n```\nUseVolumeMounts is used to check if we have volume mounts enabled as we need to insert requires and afters in various places\n\n```go\nfunc (c *NodeupModelContext) UsesCNI() bool\n```\nUsesCNI checks if the cluster has CNI configured\n\n```go\nfunc (c *NodeupModelContext) UsesSecondaryIP() bool\n```\nUsesSecondaryIP checks if the CNI in use attaches secondary interfaces to the host.\n\n```go\nfunc (c *NodeupModelContext) VolumesServiceName() string\n```\nVolumesServiceName is the name of the service which is downstream of any volume mounts\n\n```go\ntype PackagesBuilder struct {\n\t*NodeupModelContext\n}\n```\nPackagesBuilder adds miscellaneous OS packages that we need\n\n```go\nfunc (b *PackagesBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for installing packages\n\n```go\ntype ProtokubeBuilder struct {\n\t*NodeupModelContext\n}\n```\nProtokubeBuilder configures protokube\n\n```go\nfunc (t *ProtokubeBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for generating the options for protokube\n\n```go\nfunc (t *ProtokubeBuilder) ProtokubeEnvironmentVariables() string\n```\nProtokubeEnvironmentVariables generates the environments variables for docker\n\n```go\nfunc (t *ProtokubeBuilder) ProtokubeFlags(k8sVersion semver.Version) (*ProtokubeFlags, error)\n```\nProtokubeFlags is responsible for building the command line flags for protokube\n\n```go\nfunc (t *ProtokubeBuilder) ProtokubeImageName() string\n```\nProtokubeImageName returns the docker image for protokube\n\n```go\nfunc (t *ProtokubeBuilder) ProtokubeImagePullCommand() string\n```\nProtokubeImagePullCommand returns the command to pull the image\n\n```go\ntype ProtokubeFlags struct {\n\tApplyTaints *bool    `json:\"applyTaints,omitempty\" flag:\"apply-taints\"`\n\tChannels    []string `json:\"channels,omitempty\" flag:\"channels\"`\n\tCloud       *string  `json:\"cloud,omitempty\" flag:\"cloud\"`\n\t// ClusterID flag is required only for vSphere cloud type, to pass cluster id information to protokube. AWS and GCE workflows ignore this flag.\n\tClusterID                 *string  `json:\"cluster-id,omitempty\" flag:\"cluster-id\"`\n\tContainerized             *bool    `json:\"containerized,omitempty\" flag:\"containerized\"`\n\tDNSInternalSuffix         *string  `json:\"dnsInternalSuffix,omitempty\" flag:\"dns-internal-suffix\"`\n\tDNSProvider               *string  `json:\"dnsProvider,omitempty\" flag:\"dns\"`\n\tDNSServer                 *string  `json:\"dns-server,omitempty\" flag:\"dns-server\"`\n\tEtcdBackupImage           string   `json:\"etcd-backup-image,omitempty\" flag:\"etcd-backup-image\"`\n\tEtcdBackupStore           string   `json:\"etcd-backup-store,omitempty\" flag:\"etcd-backup-store\"`\n\tEtcdImage                 *string  `json:\"etcd-image,omitempty\" flag:\"etcd-image\"`\n\tEtcdLeaderElectionTimeout *string  `json:\"etcd-election-timeout,omitempty\" flag:\"etcd-election-timeout\"`\n\tEtcdHearbeatInterval      *string  `json:\"etcd-heartbeat-interval,omitempty\" flag:\"etcd-heartbeat-interval\"`\n\tInitializeRBAC            *bool    `json:\"initializeRBAC,omitempty\" flag:\"initialize-rbac\"`\n\tLogLevel                  *int32   `json:\"logLevel,omitempty\" flag:\"v\"`\n\tMaster                    *bool    `json:\"master,omitempty\" flag:\"master\"`\n\tPeerTLSCaFile             *string  `json:\"peer-ca,omitempty\" flag:\"peer-ca\"`\n\tPeerTLSCertFile           *string  `json:\"peer-cert,omitempty\" flag:\"peer-cert\"`\n\tPeerTLSKeyFile            *string  `json:\"peer-key,omitempty\" flag:\"peer-key\"`\n\tTLSAuth                   *bool    `json:\"tls-auth,omitempty\" flag:\"tls-auth\"`\n\tTLSCAFile                 *string  `json:\"tls-ca,omitempty\" flag:\"tls-ca\"`\n\tTLSCertFile               *string  `json:\"tls-cert,omitempty\" flag:\"tls-cert\"`\n\tTLSKeyFile                *string  `json:\"tls-key,omitempty\" flag:\"tls-key\"`\n\tZone                      []string `json:\"zone,omitempty\" flag:\"zone\"`\n\n\t// ManageEtcd is true if protokube should manage etcd; being replaced by etcd-manager\n\tManageEtcd bool `json:\"manageEtcd,omitempty\" flag:\"manage-etcd\"`\n\n\t// RemoveDNSNames allows us to remove dns records, so that they can be managed elsewhere\n\t// We use it e.g. for the switch to etcd-manager\n\tRemoveDNSNames string `json:\"removeDNSNames,omitempty\" flag:\"remove-dns-names\"`\n}\n```\nProtokubeFlags are the flags for protokube\n\n```go\ntype SecretBuilder struct {\n\t*NodeupModelContext\n}\n```\nSecretBuilder writes secrets\n\n```go\nfunc (b *SecretBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for pulling down the secrets\n\n```go\ntype SysctlBuilder struct {\n\t*NodeupModelContext\n}\n```\nSysctlBuilder set up our sysctls\n\n```go\nfunc (b *SysctlBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for configuring sysctl settings\n\n```go\ntype UpdateServiceBuilder struct {\n\t*NodeupModelContext\n}\n```\nUpdateServiceBuilder disables the OS automatic updates\n\n```go\nfunc (b *UpdateServiceBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for creating the relevant systemd service based on OS\n\n```go\ntype VolumesBuilder struct {\n\t*NodeupModelContext\n}\n```\nVolumesBuilder maintains the volume mounting\n\n```go\nfunc (b *VolumesBuilder) Build(c *fi.ModelBuilderContext) error\n```\nBuild is responsible for handling the mounting additional volumes onto the instance\n\n","path":"github.com/LinuxGit/kops/nodeup/pkg/model","name":"model","synopsis":"","isRedistributable":true}
