Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
677ab300
Commit
677ab300
authored
Mar 23, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move expander types
parent
3217ae8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
43 deletions
+164
-43
types.go
pkg/common/types.go
+70
-43
types.go
pkg/expander/types.go
+94
-0
No files found.
pkg/common/types.go
View file @
677ab300
...
...
@@ -21,17 +21,6 @@ import (
"time"
)
// SchemaImport represents an import as declared in a schema file.
type
SchemaImport
struct
{
Path
string
`json:"path"`
Name
string
`json:"name"`
}
// Schema is a partial DM schema. We only need access to the imports object at this level.
type
Schema
struct
{
Imports
[]
SchemaImport
`json:"imports"`
}
// Deployment defines a deployment that describes
// the creation, modification and/or deletion of a set of resources.
type
Deployment
struct
{
...
...
@@ -76,17 +65,6 @@ func (s DeploymentStatus) String() string {
return
string
(
s
)
}
// LayoutResource defines the structure of resources in the manifest layout.
type
LayoutResource
struct
{
Resource
Layout
}
// Layout defines the structure of a layout as returned from expansion.
type
Layout
struct
{
Resources
[]
*
LayoutResource
`json:"resources,omitempty"`
}
// Manifest contains the input configuration for a deployment, the fully
// expanded configuration, and the layout structure of the manifest.
//
...
...
@@ -103,22 +81,43 @@ type CreateDeploymentRequest struct {
ChartInvocation
*
Resource
`json:"chart_invocation"`
}
// ExpansionRequest defines the API to expander.
type
ExpansionRequest
struct
{
ChartInvocation
*
Resource
`json:"chart_invocation"`
Chart
*
chart
.
ChartContent
`json:"chart"`
// TypeInstance defines the metadata for an instantiation of a template type
// in a deployment.
type
TypeInstance
struct
{
Name
string
`json:"name"`
// instance name
Type
string
`json:"type"`
// instance type
Deployment
string
`json:"deployment"`
// deployment name
Manifest
string
`json:"manifest"`
// manifest name
Path
string
`json:"path"`
// JSON path within manifest
}
// ExpansionResponse defines the API to expander.
type
ExpansionResponse
struct
{
Resources
[]
interface
{}
`json:"resources"`
// ChartInstance defines the metadata for an instantiation of a chart.
type
ChartInstance
struct
{
Name
string
`json:"name"`
// instance name
Type
string
`json:"type"`
// instance type
Deployment
string
`json:"deployment"`
// deployment name
Manifest
string
`json:"manifest"`
// manifest name
Path
string
`json:"path"`
// JSON path within manifest
}
// Expander abstracts interactions with the expander and deployer services.
type
Expander
interface
{
ExpandChart
(
request
*
ExpansionRequest
)
(
*
ExpansionResponse
,
error
)
// KubernetesObject represents a native 'bare' Kubernetes object.
type
KubernetesObject
struct
{
Kind
string
`json:"kind"`
APIVersion
string
`json:"apiVersion"`
Metadata
map
[
string
]
interface
{}
`json:"metadata"`
Spec
map
[
string
]
interface
{}
`json:"spec"`
}
// KubernetesSecret represents a Kubernetes secret
type
KubernetesSecret
struct
{
Kind
string
`json:"kind"`
APIVersion
string
`json:"apiVersion"`
Metadata
map
[
string
]
string
`json:"metadata"`
Data
map
[
string
]
string
`json:"data,omitempty"`
}
// TODO: Remove the following section when the refactoring of templates is complete.
// Template describes a set of resources to be deployed.
// Manager expands a Template into a Configuration, which
// describes the set in a form that can be instantiated.
...
...
@@ -135,6 +134,44 @@ type ImportFile struct {
Content
string
`json:"content"`
}
// SchemaImport represents an import as declared in a schema file.
type
SchemaImport
struct
{
Path
string
`json:"path"`
Name
string
`json:"name"`
}
// Schema is a partial DM schema. We only need access to the imports object at this level.
type
Schema
struct
{
Imports
[]
SchemaImport
`json:"imports"`
}
// LayoutResource defines the structure of resources in the manifest layout.
type
LayoutResource
struct
{
Resource
Layout
}
// Layout defines the structure of a layout as returned from expansion.
type
Layout
struct
{
Resources
[]
*
LayoutResource
`json:"resources,omitempty"`
}
// ExpansionRequest defines the API to expander.
type
ExpansionRequest
struct
{
ChartInvocation
*
Resource
`json:"chart_invocation"`
Chart
*
chart
.
ChartContent
`json:"chart"`
}
// ExpansionResponse defines the API to expander.
type
ExpansionResponse
struct
{
Resources
[]
interface
{}
`json:"resources"`
}
// Expander abstracts interactions with the expander and deployer services.
type
Expander
interface
{
ExpandChart
(
request
*
ExpansionRequest
)
(
*
ExpansionResponse
,
error
)
}
// Configuration describes a set of resources in a form
// that can be instantiated.
type
Configuration
struct
{
...
...
@@ -170,17 +207,7 @@ type Resource struct {
State
*
ResourceState
`json:"state,omitempty"`
}
// ChartInstance defines the metadata for an instantiation of a template type
// in a deployment.
type
ChartInstance
struct
{
Name
string
`json:"name"`
// instance name
Type
string
`json:"type"`
// instance type
Deployment
string
`json:"deployment"`
// deployment name
Manifest
string
`json:"manifest"`
// manifest name
Path
string
`json:"path"`
// JSON path within manifest
}
// TODO: Remove the remainder of this file when the refactoring of pkg/registry is complete.
// TODO: Remove the following section when the refactoring of pkg/registry is complete.
// BasicAuthCredential holds a username and password.
type
BasicAuthCredential
struct
{
...
...
pkg/expander/types.go
0 → 100644
View file @
677ab300
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
expander
import
(
"github.com/kubernetes/helm/pkg/chart"
)
// SchemaImport represents an import as declared in a schema file.
type
SchemaImport
struct
{
Path
string
`json:"path"`
Name
string
`json:"name"`
}
// Schema is a partial DM schema. We only need access to the imports object at this level.
type
Schema
struct
{
Imports
[]
SchemaImport
`json:"imports"`
}
// LayoutResource defines the structure of resources in the manifest layout.
type
LayoutResource
struct
{
Resource
Layout
}
// Layout defines the structure of a layout as returned from expansion.
type
Layout
struct
{
Resources
[]
*
LayoutResource
`json:"resources,omitempty"`
}
// ExpansionRequest defines the API to expander.
type
ExpansionRequest
struct
{
ChartInvocation
*
Resource
`json:"chart_invocation"`
Chart
*
chart
.
ChartContent
`json:"chart"`
}
// ExpansionResponse defines the API to expander.
type
ExpansionResponse
struct
{
Resources
[]
interface
{}
`json:"resources"`
}
// Expander abstracts interactions with the expander and deployer services.
type
Expander
interface
{
ExpandChart
(
request
*
ExpansionRequest
)
(
*
ExpansionResponse
,
error
)
}
// Configuration describes a set of resources in a form
// that can be instantiated.
type
Configuration
struct
{
Resources
[]
*
Resource
`json:"resources"`
}
// ResourceStatus is an enumeration type for the status of a resource.
type
ResourceStatus
string
// These constants implement the resourceStatus enumeration type.
const
(
Created
ResourceStatus
=
"Created"
Failed
ResourceStatus
=
"Failed"
Aborted
ResourceStatus
=
"Aborted"
)
// ResourceState describes the state of a resource.
// Status is set during resource creation and is a terminal state.
type
ResourceState
struct
{
Status
ResourceStatus
`json:"status,omitempty"`
SelfLink
string
`json:"selflink,omitempty"`
Errors
[]
string
`json:"errors,omitempty"`
}
// Resource describes a resource in a configuration. A resource has
// a name, a type and a set of properties. The name and type are used
// to identify the resource in Kubernetes. The properties are passed
// to Kubernetes as the resource configuration.
type
Resource
struct
{
Name
string
`json:"name"`
Type
string
`json:"type"`
Properties
map
[
string
]
interface
{}
`json:"properties,omitempty"`
State
*
ResourceState
`json:"state,omitempty"`
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment