Documentation
¶
Index ¶
- Constants
- Variables
- func StubUpdateLibData(fs afero.Fs, k8sSpecFlag, libPath string, useVersionPath bool) (string, error)
- func Write(fs afero.Fs, appRoot string, spec *Spec) error
- type App
- type App001
- func (a *App001) AddEnvironment(name, k8sSpecFlag string, spec *EnvironmentSpec) error
- func (a *App001) Environment(name string) (*EnvironmentSpec, error)
- func (a *App001) Environments() (EnvironmentSpecs, error)
- func (a *App001) Init() error
- func (a *App001) LibPath(envName string) (string, error)
- func (a *App001) Libraries() LibraryRefSpecs
- func (a *App001) Registries() RegistryRefSpecs
- func (a *App001) RemoveEnvironment(envName string) error
- func (a *App001) RenameEnvironment(from, to string) error
- func (a *App001) Upgrade(dryRun bool) error
- type App010
- func (a *App010) AddEnvironment(name, k8sSpecFlag string, spec *EnvironmentSpec) error
- func (a *App010) Environment(name string) (*EnvironmentSpec, error)
- func (a *App010) Environments() (EnvironmentSpecs, error)
- func (a *App010) Init() error
- func (a *App010) LibPath(envName string) (string, error)
- func (a *App010) Libraries() LibraryRefSpecs
- func (a *App010) Registries() RegistryRefSpecs
- func (a *App010) RemoveEnvironment(envName string) error
- func (a *App010) RenameEnvironment(from, to string) error
- func (a *App010) Upgrade(dryRun bool) error
- type ContributorSpec
- type ContributorSpecs
- type EnvironmentDestinationSpec
- type EnvironmentSpec
- type EnvironmentSpecs
- type GitVersionSpec
- type LibraryRefSpec
- type LibraryRefSpecs
- type RegistryRefSpec
- type RegistryRefSpecs
- type RepositorySpec
- type Spec
- func (s *Spec) AddEnvironmentSpec(spec *EnvironmentSpec) error
- func (s *Spec) AddRegistryRef(registryRefSpec *RegistryRefSpec) error
- func (s *Spec) DeleteEnvironmentSpec(name string) error
- func (s *Spec) GetEnvironmentSpec(name string) (*EnvironmentSpec, bool)
- func (s *Spec) GetEnvironmentSpecs() EnvironmentSpecs
- func (s *Spec) GetRegistryRef(name string) (*RegistryRefSpec, bool)
- func (s *Spec) Marshal() ([]byte, error)
- func (s *Spec) UpdateEnvironmentSpec(name string, spec *EnvironmentSpec) error
Constants ¶
const ( // EnvironmentDirName is the directory name for environments. EnvironmentDirName = "environments" // LibDirName is the directory name for libraries. LibDirName = "lib" )
const ( // DefaultAPIVersion is the default ks API version to use if not specified. DefaultAPIVersion = "0.1.0" // Kind is the schema resource type. Kind = "ksonnet.io/app" // DefaultVersion is the default version of the app schema. DefaultVersion = "0.0.1" )
Variables ¶
var ( // DefaultFilePermissions are the default permissions for a file. DefaultFilePermissions = os.FileMode(0644) // DefaultFolderPermissions are the default permissions for a folder. DefaultFolderPermissions = os.FileMode(0755) // LibUpdater updates ksonnet lib versions. LibUpdater = updateLibData )
var ( // ErrRegistryNameInvalid is the error where a registry name is invalid. ErrRegistryNameInvalid = fmt.Errorf("Registry name is invalid") // ErrRegistryExists is the error when trying to create a registry that already exists. ErrRegistryExists = fmt.Errorf("Registry with name already exists") // ErrEnvironmentNameInvalid is the error where an environment name is invalid. ErrEnvironmentNameInvalid = fmt.Errorf("Environment name is invalid") // ErrEnvironmentExists is the error when trying to create an environment that already exists. ErrEnvironmentExists = fmt.Errorf("Environment with name already exists") // ErrEnvironmentNotExists is the error when trying to update an environment that doesn't exist. ErrEnvironmentNotExists = fmt.Errorf("Environment with name doesn't exist") )
Functions ¶
Types ¶
type App ¶ added in v0.9.0
type App interface {
AddEnvironment(name, k8sSpecFlag string, spec *EnvironmentSpec) error
Environment(name string) (*EnvironmentSpec, error)
Environments() (EnvironmentSpecs, error)
Libraries() LibraryRefSpecs
LibPath(envName string) (string, error)
Init() error
Registries() RegistryRefSpecs
RenameEnvironment(from, to string) error
RemoveEnvironment(name string) error
Upgrade(dryRun bool) error
}
App is a ksonnet application.
type App001 ¶ added in v0.9.0
type App001 struct {
// contains filtered or unexported fields
}
App001 is a ksonnet 0.0.1 application.
func (*App001) AddEnvironment ¶ added in v0.9.0
func (a *App001) AddEnvironment(name, k8sSpecFlag string, spec *EnvironmentSpec) error
AddEnvironment adds an environment spec to the app spec. If the spec already exists, it is overwritten.
func (*App001) Environment ¶ added in v0.9.0
func (a *App001) Environment(name string) (*EnvironmentSpec, error)
Environment returns the spec for an environment. In 0.1.0, the file lives in /environments/name/spec.json.
func (*App001) Environments ¶ added in v0.9.0
func (a *App001) Environments() (EnvironmentSpecs, error)
Environments returns specs for all environments. In 0.1.0, the environment spec lives in spec.json files.
func (*App001) Libraries ¶ added in v0.9.0
func (a *App001) Libraries() LibraryRefSpecs
Libraries returns application libraries.
func (*App001) Registries ¶ added in v0.9.0
func (a *App001) Registries() RegistryRefSpecs
Registries returns application registries.
func (*App001) RemoveEnvironment ¶ added in v0.9.0
RemoveEnvironment removes an environment.
func (*App001) RenameEnvironment ¶ added in v0.9.1
RenameEnvironment renames environments.
type App010 ¶ added in v0.9.0
type App010 struct {
// contains filtered or unexported fields
}
App010 is a ksonnet 0.1.0 application.
func (*App010) AddEnvironment ¶ added in v0.9.0
func (a *App010) AddEnvironment(name, k8sSpecFlag string, spec *EnvironmentSpec) error
AddEnvironment adds an environment spec to the app spec. If the spec already exists, it is overwritten.
func (*App010) Environment ¶ added in v0.9.0
func (a *App010) Environment(name string) (*EnvironmentSpec, error)
Environment returns the spec for an environment.
func (*App010) Environments ¶ added in v0.9.0
func (a *App010) Environments() (EnvironmentSpecs, error)
Environments returns all environment specs.
func (*App010) Libraries ¶ added in v0.9.0
func (a *App010) Libraries() LibraryRefSpecs
Libraries returns application libraries.
func (*App010) Registries ¶ added in v0.9.0
func (a *App010) Registries() RegistryRefSpecs
Registries returns application registries.
func (*App010) RemoveEnvironment ¶ added in v0.9.0
RemoveEnvironment removes an environment.
func (*App010) RenameEnvironment ¶ added in v0.9.1
RenameEnvironment renames environments.
type ContributorSpec ¶
ContributorSpec is a specification for the project contributors.
type ContributorSpecs ¶
type ContributorSpecs []*ContributorSpec
ContributorSpecs is a list of 0 or more contributors.
type EnvironmentDestinationSpec ¶ added in v0.9.0
type EnvironmentDestinationSpec struct {
// Server is the Kubernetes server that the cluster is running on.
Server string `json:"server"`
// Namespace is the namespace of the Kubernetes server that targets should
// be deployed to. This is "default", if not specified.
Namespace string `json:"namespace"`
}
EnvironmentDestinationSpec contains the specification for the cluster address that the environment points to.
type EnvironmentSpec ¶ added in v0.9.0
type EnvironmentSpec struct {
// Name is the user defined name of an environment
Name string `json:"-"`
// KubernetesVersion is the kubernetes version the targetted cluster is
// running on.
KubernetesVersion string `json:"k8sVersion"`
// Path is the relative project path containing metadata for this
// environment.
Path string `json:"path"`
// Destination stores the cluster address that this environment points to.
Destination *EnvironmentDestinationSpec `json:"destination"`
// Targets contain the relative component paths that this environment
// wishes to deploy on it's destination.
Targets []string `json:"targets,omitempty"`
}
EnvironmentSpec contains the specification for ksonnet environments.
type EnvironmentSpecs ¶ added in v0.9.0
type EnvironmentSpecs map[string]*EnvironmentSpec
EnvironmentSpecs contains one or more EnvironmentSpec.
type GitVersionSpec ¶
GitVersionSpec is the specification for a Registry's Git Version.
type LibraryRefSpec ¶
type LibraryRefSpec struct {
Name string `json:"name"`
Registry string `json:"registry"`
GitVersion *GitVersionSpec `json:"gitVersion"`
}
LibraryRefSpec is the specification for a library part.
type LibraryRefSpecs ¶
type LibraryRefSpecs map[string]*LibraryRefSpec
LibraryRefSpecs is a mapping of a library name to it's LibraryRefSpec.
type RegistryRefSpec ¶
type RegistryRefSpec struct {
Name string `json:"-"`
Protocol string `json:"protocol"`
URI string `json:"uri"`
GitVersion *GitVersionSpec `json:"gitVersion"`
}
RegistryRefSpec defines the spec for a registry. A registry is a collection of library parts.
type RegistryRefSpecs ¶
type RegistryRefSpecs map[string]*RegistryRefSpec
RegistryRefSpecs is a map of the registry name to a RegistryRefSpec.
type RepositorySpec ¶
RepositorySpec defines the spec for the upstream repository of this project.
type Spec ¶
type Spec struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Authors []string `json:"authors,omitempty"`
Contributors ContributorSpecs `json:"contributors,omitempty"`
Repository *RepositorySpec `json:"repository,omitempty"`
Bugs string `json:"bugs,omitempty"`
Keywords []string `json:"keywords,omitempty"`
Registries RegistryRefSpecs `json:"registries,omitempty"`
Environments EnvironmentSpecs `json:"environments,omitempty"`
Libraries LibraryRefSpecs `json:"libraries,omitempty"`
License string `json:"license,omitempty"`
}
Spec defines all the ksonnet project metadata. This includes details such as the project name, authors, environments, and registries.
func Unmarshal ¶ added in v0.9.0
Unmarshal attempts to parse the bytes representing a spec file and convert it into a app.Spec.
func (*Spec) AddEnvironmentSpec ¶ added in v0.9.0
func (s *Spec) AddEnvironmentSpec(spec *EnvironmentSpec) error
AddEnvironmentSpec adds an EnvironmentSpec to the list of EnvironmentSpecs. This is equivalent to registering the environment for a ksonnet app.
func (*Spec) AddRegistryRef ¶
func (s *Spec) AddRegistryRef(registryRefSpec *RegistryRefSpec) error
AddRegistryRef adds the RegistryRefSpec to the app spec.
func (*Spec) DeleteEnvironmentSpec ¶ added in v0.9.0
DeleteEnvironmentSpec removes the environment specification from the app spec.
func (*Spec) GetEnvironmentSpec ¶ added in v0.9.0
func (s *Spec) GetEnvironmentSpec(name string) (*EnvironmentSpec, bool)
GetEnvironmentSpec returns the environment specification for the environment.
func (*Spec) GetEnvironmentSpecs ¶ added in v0.9.0
func (s *Spec) GetEnvironmentSpecs() EnvironmentSpecs
GetEnvironmentSpecs returns all environment specifications. We need to pre-populate th EnvironmentSpec name before returning.
func (*Spec) GetRegistryRef ¶
func (s *Spec) GetRegistryRef(name string) (*RegistryRefSpec, bool)
GetRegistryRef returns a populated RegistryRefSpec given a registry name.
func (*Spec) UpdateEnvironmentSpec ¶ added in v0.9.0
func (s *Spec) UpdateEnvironmentSpec(name string, spec *EnvironmentSpec) error
UpdateEnvironmentSpec updates the environment with the provided name to the specified spec.