format comments for types.go

This commit is contained in:
ymqytw 2018-01-05 16:42:03 -08:00
parent 399b199e0c
commit 5c9c85eed9
1 changed files with 34 additions and 18 deletions

View File

@ -20,8 +20,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Descriptor contains all the metadata of the package and drives package searching and browsing,
// and support the fork/rebase upgrade workflow. It can be used by something like an app registry.
// Descriptor contains all the metadata of the package and drives package
// searching and browsing, and support the fork/rebase upgrade workflow.
// It can be used by something like an app registry.
type Descriptor struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
// Standard object's metadata.
@ -44,7 +45,8 @@ type Descriptor struct {
// Homepage of the application package.
Home string `json:"home,omitempty" yaml:"home,omitempty"`
// Source specifies the upstream URL, e.g. https://github.com/foo/bar.git, file://host/path, etc.
// Source specifies the upstream URL, e.g. https://github.com/foo/bar.git,
// file://host/path, etc.
// hosting the resource files specified in Base and Overlays.
// This is useful in the fork/rebase workflow.
Source string `json:"source,omitempty" yaml:"source,omitempty"`
@ -73,32 +75,39 @@ type Manifest struct {
// Labels to add to all objects and selectors.
// These labels would also be used to form the selector for apply --prune
// Named differently than “labels” to avoid confusion with metadata for this object
// Named differently than “labels” to avoid confusion with metadata for
// this object
ObjectLabels map[string]string `json:"objectLabels,omitempty" yaml:"objectLabels,omitempty"`
// Annotations to add to all objects.
ObjectAnnotations map[string]string `json:"objectAnnotations,omitempty" yaml:"objectAnnotations,omitempty"`
// Resources specifies the relative paths within the package.
// It could be any format that kubectl -f allows, i.e. files, directories, URLs and globs.
// It could be any format that kubectl -f allows, i.e. files, directories,
// URLs and globs.
Resources []string `json:"resources,omitempty" yaml:"resources,omitempty"`
// An Patch entry is very similar to an Resource entry.
// It specifies the relative paths within the package, and could be any format that kubectl -f allows.
// It should be able to be merged by Strategic Merge Patch on top of its corresponding base resource.
// It specifies the relative paths within the package, and could be any
// format that kubectl -f allows.
// It should be able to be merged by Strategic Merge Patch on top of its
// corresponding base resource.
Patches []string `json:"patches,omitempty" yaml:"patches,omitempty"`
// List of configmaps to generate from configuration sources.
// Base/overlay concept doesn't apply to this field.
// If a configmap want to have a base and an overlay, it should go to Bases and Overlays fields.
// If a configmap want to have a base and an overlay, it should go to Bases
// and Overlays fields.
Configmaps []ConfigMap `json:"configmaps,omitempty" yaml:"configmaps,omitempty"`
// List of secrets to generate from secret sources.
// Base/overlay concept doesn't apply to this field.
// If a secret want to have a base and an overlay, it should go to Bases and Overlays fields.
// If a secret want to have a base and an overlay, it should go to Bases and
// Overlays fields.
Secrets []Secret `json:"secrets,omitempty" yaml:"secrets,omitempty"`
// Whether prune resources not defined in Kube-manifest.yaml, similar to `kubectl apply --prune` behavior.
// Whether prune resources not defined in Kube-manifest.yaml, similar to
// `kubectl apply --prune` behavior.
Prune bool `json:"prune,omitempty" yaml:"prune,omitempty"`
// TODO: figure out what the behavior details should be.
@ -106,7 +115,8 @@ type Manifest struct {
// OwnPersistentVolumeClaims bool `json:"ownPersistentVolumeClaims,omitempty" yaml:"ownPersistentVolumeClaims,omitempty"`
// TODO: figure out what the behavior details should be.
// Whether recursive look for Kube-manifest.yaml, similar to `kubectl --recursive` behavior.
// Whether recursive look for Kube-manifest.yaml, similar to
// `kubectl --recursive` behavior.
// Recursive bool `json:"recursive,omitempty" yaml:"recursive,omitempty"`
}
@ -116,7 +126,8 @@ type ConfigMap struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// Name prefix of the configmap.
// The full name should be Manifest.NamePrefix + Configmap.NamePrefix + hash(content of configmap).
// The full name should be Manifest.NamePrefix + Configmap.NamePrefix +
// hash(content of configmap).
NamePrefix string `json:"namePrefix,omitempty" yaml:"namePrefix,omitempty"`
// Generic source for configmap, it could of one of `env`, `file`, `literal`
@ -130,7 +141,8 @@ type Secret struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// Name prefix of the secret.
// The full name should be Manifest.NamePrefix + Secret.NamePrefix + hash(content of secret).
// The full name should be Manifest.NamePrefix + Secret.NamePrefix +
// hash(content of secret).
NamePrefix string `json:"namePrefix,omitempty" yaml:"namePrefix,omitempty"`
// Generic source for secret, it could of one of `env`, `file`, `literal`
@ -146,18 +158,22 @@ type Secret struct {
// Only one field can be set.
type Generic struct {
// LiteralSources is a list of literal sources.
// Each literal source should be a key and literal value, e.g. `somekey=somevalue`
// Each literal source should be a key and literal value,
// e.g. `somekey=somevalue`
// It will be similar to kubectl create configmap|secret --from-literal
LiteralSources []string `json:"literals,omitempty" yaml:"literals,omitempty"`
// FileSources is a list of file sources.
// Each file source can be specified using its file path, in which case file basename will be used as configmap key,
// or optionally with a key and file path, in which case the given key will be used.
// Specifying a directory will iterate each named file in the directory whose basename is a valid configmap key.
// Each file source can be specified using its file path, in which case file
// basename will be used as configmap key, or optionally with a key and file
// path, in which case the given key will be used.
// Specifying a directory will iterate each named file in the directory
// whose basename is a valid configmap key.
// It will be similar to kubectl create configmap|secret --from-file
FileSources []string `json:"files,omitempty" yaml:"files,omitempty"`
// EnvSource format should be a path to a file to read lines of key=val pairs to create a configmap.
// EnvSource format should be a path to a file to read lines of key=val
// pairs to create a configmap.
// i.e. a Docker .env file or a .ini file.
EnvSource string `json:"env,omitempty" yaml:"env,omitempty"`
}