Vendoring update for v1alpha3

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
This commit is contained in:
Simon Ferquel 2019-01-16 12:56:15 +01:00
parent ebb121ee2d
commit c863dbabf7
21 changed files with 2670 additions and 57 deletions

View File

@ -14,7 +14,7 @@ github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76 # v1.1.0
github.com/dgrijalva/jwt-go a2c85815a77d0f951e33ba4db5ae93629a1530af
github.com/docker/distribution 83389a148052d74ac602f5f1d62f86ff2f3c4aa5
github.com/docker/docker f76d6a078d881f410c00e8d900dcdfc2e026c841
github.com/docker/compose-on-kubernetes a6086e2369e39c2058a003a7eb42e567ecfd1f03 # v0.4.17
github.com/docker/compose-on-kubernetes 1559927c6b456d56cc9c9b05438252ebb646640b # master w/ v1alpha3
github.com/docker/docker-credential-helpers 5241b46610f2491efdf9d1c85f1ddf5b02f6d962
# the docker/go package contains a customized version of canonical/json
# and is used by Notary. The package is periodically rebased on current Go versions.

View File

@ -185,3 +185,5 @@ See the [contributing](./CONTRIBUTING.md) and [debugging](./DEBUGGING.md) guides
# Deploying Compose on Kubernetes
- Guide for [Azure AKS](./docs/install-on-aks.md).
- Guide for [GKE](./docs/install-on-gke.md).
- Guide for [Minikube](./docs/install-on-minikube.md).

View File

@ -1,55 +0,0 @@
package apis
import (
apiv1beta1 "github.com/docker/compose-on-kubernetes/api/compose/v1beta1"
apiv1beta2 "github.com/docker/compose-on-kubernetes/api/compose/v1beta2"
"github.com/pkg/errors"
apimachinerymetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes"
)
// StackVersion represents the detected Compose Component on Kubernetes side.
type StackVersion string
const (
// StackAPIV1Beta1 is returned if it's the most recent version available.
StackAPIV1Beta1 = StackVersion("v1beta1")
// StackAPIV1Beta2 is returned if it's the most recent version available.
StackAPIV1Beta2 = StackVersion("v1beta2")
)
// GetStackAPIVersion returns the most recent stack API installed.
func GetStackAPIVersion(clientSet *kubernetes.Clientset) (StackVersion, error) {
groups, err := clientSet.Discovery().ServerGroups()
if err != nil {
return "", err
}
return getAPIVersion(groups)
}
func getAPIVersion(groups *metav1.APIGroupList) (StackVersion, error) {
switch {
case findVersion(apiv1beta2.SchemeGroupVersion, groups.Groups):
return StackAPIV1Beta2, nil
case findVersion(apiv1beta1.SchemeGroupVersion, groups.Groups):
return StackAPIV1Beta1, nil
default:
return "", errors.Errorf("failed to find a Stack API version")
}
}
func findVersion(stackAPI schema.GroupVersion, groups []apimachinerymetav1.APIGroup) bool {
for _, group := range groups {
if group.Name == stackAPI.Group {
for _, version := range group.Versions {
if version.Version == stackAPI.Version {
return true
}
}
}
}
return false
}

View File

@ -1,6 +1,7 @@
package clientset
import (
composev1alpha3 "github.com/docker/compose-on-kubernetes/api/client/clientset/typed/compose/v1alpha3"
composev1beta1 "github.com/docker/compose-on-kubernetes/api/client/clientset/typed/compose/v1beta1"
composev1beta2 "github.com/docker/compose-on-kubernetes/api/client/clientset/typed/compose/v1beta2"
glog "github.com/golang/glog"
@ -13,20 +14,36 @@ import (
// FIXME(vdemeester) is it required ?
type Interface interface {
Discovery() discovery.DiscoveryInterface
ComposeV1alpha3() composev1alpha3.ComposeV1alpha3Interface
ComposeV1beta2() composev1beta2.ComposeV1beta2Interface
ComposeV1beta1() composev1beta1.ComposeV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Compose() composev1beta1.ComposeV1beta1Interface
ComposeLatest() composev1alpha3.ComposeV1alpha3Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*composev1alpha3.ComposeV1alpha3Client
*composev1beta2.ComposeV1beta2Client
*composev1beta1.ComposeV1beta1Client
}
// ComposeV1alpha3 retrieves the ComposeV1alpha3Client
func (c *Clientset) ComposeV1alpha3() composev1alpha3.ComposeV1alpha3Interface {
if c == nil {
return nil
}
return c.ComposeV1alpha3Client
}
// ComposeLatest retrieves the latest version of the client
func (c *Clientset) ComposeLatest() composev1alpha3.ComposeV1alpha3Interface {
return c.ComposeV1alpha3()
}
// ComposeV1beta2 retrieves the ComposeV1beta2Client
func (c *Clientset) ComposeV1beta2() composev1beta2.ComposeV1beta2Interface {
if c == nil {
@ -68,6 +85,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
}
var cs Clientset
var err error
cs.ComposeV1alpha3Client, err = composev1alpha3.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.ComposeV1beta2Client, err = composev1beta2.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@ -89,6 +110,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.ComposeV1alpha3Client = composev1alpha3.NewForConfigOrDie(c)
cs.ComposeV1beta2Client = composev1beta2.NewForConfigOrDie(c)
cs.ComposeV1beta1Client = composev1beta1.NewForConfigOrDie(c)
@ -99,6 +121,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.ComposeV1alpha3Client = composev1alpha3.New(c)
cs.ComposeV1beta2Client = composev1beta2.New(c)
cs.ComposeV1beta1Client = composev1beta1.New(c)

View File

@ -1,6 +1,7 @@
package scheme
import (
composev1alpha3 "github.com/docker/compose-on-kubernetes/api/compose/v1alpha3"
composev1beta1 "github.com/docker/compose-on-kubernetes/api/compose/v1beta1"
composev1beta2 "github.com/docker/compose-on-kubernetes/api/compose/v1beta2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -39,6 +40,7 @@ func init() {
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
composev1alpha3.AddToScheme(scheme)
composev1beta2.AddToScheme(scheme)
composev1beta1.AddToScheme(scheme)

View File

@ -0,0 +1,74 @@
package v1alpha3
import (
"github.com/docker/compose-on-kubernetes/api/client/clientset/scheme"
v1alpha3 "github.com/docker/compose-on-kubernetes/api/compose/v1alpha3"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
)
// ComposeV1alpha3Interface defines the methods a compose v1alpha3 client has
type ComposeV1alpha3Interface interface {
RESTClient() rest.Interface
StacksGetter
}
// ComposeV1alpha3Client is used to interact with features provided by the compose.docker.com group.
type ComposeV1alpha3Client struct {
restClient rest.Interface
}
// Stacks returns a stack client
func (c *ComposeV1alpha3Client) Stacks(namespace string) StackInterface {
return newStacks(c, namespace)
}
// NewForConfig creates a new ComposeV1alpha3Client for the given config.
func NewForConfig(c *rest.Config) (*ComposeV1alpha3Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &ComposeV1alpha3Client{client}, nil
}
// NewForConfigOrDie creates a new ComposeV1alpha3Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *ComposeV1alpha3Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new ComposeV1alpha3Client for the given RESTClient.
func New(c rest.Interface) *ComposeV1alpha3Client {
return &ComposeV1alpha3Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha3.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *ComposeV1alpha3Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,172 @@
package v1alpha3
import (
scheme "github.com/docker/compose-on-kubernetes/api/client/clientset/scheme"
v1alpha3 "github.com/docker/compose-on-kubernetes/api/compose/v1alpha3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// StacksGetter has a method to return a StackInterface.
// A group's client should implement this interface.
type StacksGetter interface {
Stacks(namespace string) StackInterface
}
// StackInterface has methods to work with Stack resources.
type StackInterface interface {
Create(*v1alpha3.Stack) (*v1alpha3.Stack, error)
Update(*v1alpha3.Stack) (*v1alpha3.Stack, error)
UpdateStatus(*v1alpha3.Stack) (*v1alpha3.Stack, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha3.Stack, error)
List(opts v1.ListOptions) (*v1alpha3.StackList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v1alpha3.Stack, error)
WithSkipValidation() StackInterface
}
// stacks implements StackInterface
type stacks struct {
skipValidation bool
client rest.Interface
ns string
}
// newStacks returns a Stacks
func newStacks(c *ComposeV1alpha3Client, namespace string) *stacks {
return &stacks{
client: c.RESTClient(),
ns: namespace,
}
}
func (c *stacks) handleSkipValidation(req *rest.Request) *rest.Request {
if !c.skipValidation {
return req
}
return req.Param("skip-validation", "1")
}
// Create takes the representation of a stack and creates it. Returns the server's representation of the stack, and an error, if there is any.
func (c *stacks) Create(stack *v1alpha3.Stack) (*v1alpha3.Stack, error) {
result := &v1alpha3.Stack{}
err := c.handleSkipValidation(c.client.Post().
Namespace(c.ns).
Resource("stacks").
Body(stack)).
Do().
Into(result)
return result, err
}
// Update takes the representation of a stack and updates it. Returns the server's representation of the stack, and an error, if there is any.
func (c *stacks) Update(stack *v1alpha3.Stack) (*v1alpha3.Stack, error) {
result := &v1alpha3.Stack{}
err := c.handleSkipValidation(c.client.Put().
Namespace(c.ns).
Resource("stacks").
Name(stack.Name).
Body(stack)).
Do().
Into(result)
return result, err
}
// UpdateStatus was generated because the type contains a Status member.
func (c *stacks) UpdateStatus(stack *v1alpha3.Stack) (*v1alpha3.Stack, error) {
result := &v1alpha3.Stack{}
err := c.handleSkipValidation(c.client.Put().
Namespace(c.ns).
Resource("stacks").
Name(stack.Name).
SubResource("status").
Body(stack)).
Do().
Into(result)
return result, err
}
// Delete takes name of the stack and deletes it. Returns an error if one occurs.
func (c *stacks) Delete(name string, options *v1.DeleteOptions) error {
return c.handleSkipValidation(c.client.Delete().
Namespace(c.ns).
Resource("stacks").
Name(name).
Body(options)).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *stacks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.handleSkipValidation(c.client.Delete().
Namespace(c.ns).
Resource("stacks").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options)).
Do().
Error()
}
// Get takes name of the stack, and returns the corresponding stack object, and an error if there is any.
func (c *stacks) Get(name string, options v1.GetOptions) (*v1alpha3.Stack, error) {
result := &v1alpha3.Stack{}
err := c.client.Get().
Namespace(c.ns).
Resource("stacks").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return result, err
}
// List takes label and field selectors, and returns the list of Stacks that match those selectors.
func (c *stacks) List(opts v1.ListOptions) (*v1alpha3.StackList, error) {
result := &v1alpha3.StackList{}
err := c.client.Get().
Namespace(c.ns).
Resource("stacks").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return result, err
}
// Watch returns a watch.Interface that watches the requested stacks.
func (c *stacks) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("stacks").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched stack.
func (c *stacks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*v1alpha3.Stack, error) {
result := &v1alpha3.Stack{}
err := c.handleSkipValidation(c.client.Patch(pt).
Namespace(c.ns).
Resource("stacks").
SubResource(subresources...).
Name(name).
Body(data)).
Do().
Into(result)
return result, err
}
// WithSkipValidation creates a new Stack Client interface with validation disabled
func (c *stacks) WithSkipValidation() StackInterface {
return &stacks{
skipValidation: true,
client: c.client,
ns: c.ns,
}
}

View File

@ -1,6 +1,7 @@
package compose
import (
"github.com/docker/compose-on-kubernetes/api/client/informers/compose/v1alpha3"
"github.com/docker/compose-on-kubernetes/api/client/informers/compose/v1beta2"
"github.com/docker/compose-on-kubernetes/api/client/informers/internalinterfaces"
)
@ -8,6 +9,7 @@ import (
// Interface provides access to each of this group's versions.
type Interface interface {
V1beta2() v1beta2.Interface
V1alpha3() v1alpha3.Interface
}
type group struct {
@ -23,3 +25,8 @@ func New(f internalinterfaces.SharedInformerFactory) Interface {
func (g *group) V1beta2() v1beta2.Interface {
return v1beta2.New(g.SharedInformerFactory)
}
// V1alpha3 returns a new V1alpha3.Interface.
func (g *group) V1alpha3() v1alpha3.Interface {
return v1alpha3.New(g.SharedInformerFactory)
}

View File

@ -0,0 +1,25 @@
package v1alpha3
import (
"github.com/docker/compose-on-kubernetes/api/client/informers/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// Stacks returns a StackInformer.
Stacks() StackInformer
}
type version struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// Stacks returns a StackInformer.
func (v *version) Stacks() StackInformer {
return &stackInformer{factory: v.SharedInformerFactory}
}

View File

@ -0,0 +1,51 @@
package v1alpha3
import (
"time"
"github.com/docker/compose-on-kubernetes/api/client/clientset"
"github.com/docker/compose-on-kubernetes/api/client/informers/internalinterfaces"
"github.com/docker/compose-on-kubernetes/api/client/listers/compose/v1alpha3"
compose_v1alpha3 "github.com/docker/compose-on-kubernetes/api/compose/v1alpha3"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
// StackInformer provides access to a shared informer and lister for
// Stacks.
type StackInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha3.StackLister
}
type stackInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newStackInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.ComposeV1alpha3().Stacks(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.ComposeV1alpha3().Stacks(v1.NamespaceAll).Watch(options)
},
},
&compose_v1alpha3.Stack{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *stackInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&compose_v1alpha3.Stack{}, newStackInformer)
}
func (f *stackInformer) Lister() v1alpha3.StackLister {
return v1alpha3.NewStackLister(f.Informer().GetIndexer())
}

View File

@ -3,6 +3,7 @@ package informers
import (
"fmt"
"github.com/docker/compose-on-kubernetes/api/compose/v1alpha3"
"github.com/docker/compose-on-kubernetes/api/compose/v1beta2"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/tools/cache"
@ -37,7 +38,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=Compose, Version=V1beta1
case v1beta2.SchemeGroupVersion.WithResource("stacks"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Compose().V1beta2().Stacks().Informer()}, nil
case v1alpha3.SchemeGroupVersion.WithResource("stacks"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Compose().V1alpha3().Stacks().Informer()}, nil
}
return nil, fmt.Errorf("no informer found for %v", resource)

View File

@ -0,0 +1,9 @@
package v1alpha3
// StackListerExpansion allows custom methods to be added to
// StackLister.
type StackListerExpansion interface{}
// StackNamespaceListerExpansion allows custom methods to be added to
// StackNamespaceLister.
type StackNamespaceListerExpansion interface{}

View File

@ -0,0 +1,78 @@
package v1alpha3
import (
"github.com/docker/compose-on-kubernetes/api/compose/v1alpha3"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// StackLister helps list Stacks.
type StackLister interface {
// List lists all Stacks in the indexer.
List(selector labels.Selector) ([]*v1alpha3.Stack, error)
// Stacks returns an object that can list and get Stacks.
Stacks(namespace string) StackNamespaceLister
StackListerExpansion
}
// stackLister implements the StackLister interface.
type stackLister struct {
indexer cache.Indexer
}
// NewStackLister returns a new StackLister.
func NewStackLister(indexer cache.Indexer) StackLister {
return &stackLister{indexer: indexer}
}
// List lists all Stacks in the indexer.
func (s *stackLister) List(selector labels.Selector) ([]*v1alpha3.Stack, error) {
stacks := []*v1alpha3.Stack{}
err := cache.ListAll(s.indexer, selector, func(m interface{}) {
stacks = append(stacks, m.(*v1alpha3.Stack))
})
return stacks, err
}
// Stacks returns an object that can list and get Stacks.
func (s *stackLister) Stacks(namespace string) StackNamespaceLister {
return stackNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// StackNamespaceLister helps list and get Stacks.
type StackNamespaceLister interface {
// List lists all Stacks in the indexer for a given namespace.
List(selector labels.Selector) ([]*v1alpha3.Stack, error)
// Get retrieves the Stack from the indexer for a given namespace and name.
Get(name string) (*v1alpha3.Stack, error)
StackNamespaceListerExpansion
}
// stackNamespaceLister implements the StackNamespaceLister
// interface.
type stackNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Stacks in the indexer for a given namespace.
func (s stackNamespaceLister) List(selector labels.Selector) ([]*v1alpha3.Stack, error) {
stacks := []*v1alpha3.Stack{}
err := cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
stacks = append(stacks, m.(*v1alpha3.Stack))
})
return stacks, err
}
// Get retrieves the Stack from the indexer for a given namespace and name.
func (s stackNamespaceLister) Get(name string) (*v1alpha3.Stack, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha3.GroupResource("stack"), name)
}
return obj.(*v1alpha3.Stack), nil
}

View File

@ -0,0 +1,26 @@
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// ComposeFile is the content of a stack's compose file if any
type ComposeFile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
ComposeFile string `json:"composeFile,omitempty"`
}
func (c *ComposeFile) clone() *ComposeFile {
if c == nil {
return nil
}
res := *c
return &res
}
// DeepCopyObject clones the ComposeFile
func (c *ComposeFile) DeepCopyObject() runtime.Object {
return c.clone()
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,660 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
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.
*/
// Code generated by C:\gohome\bin\deepcopy-gen.exe. DO NOT EDIT.
package v1alpha3
import (
time "time"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConfigObjConfig) DeepCopyInto(out *ConfigObjConfig) {
*out = *in
out.External = in.External
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigObjConfig.
func (in *ConfigObjConfig) DeepCopy() *ConfigObjConfig {
if in == nil {
return nil
}
out := new(ConfigObjConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Constraint) DeepCopyInto(out *Constraint) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Constraint.
func (in *Constraint) DeepCopy() *Constraint {
if in == nil {
return nil
}
out := new(Constraint)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Constraints) DeepCopyInto(out *Constraints) {
*out = *in
if in.OperatingSystem != nil {
in, out := &in.OperatingSystem, &out.OperatingSystem
if *in == nil {
*out = nil
} else {
*out = new(Constraint)
**out = **in
}
}
if in.Architecture != nil {
in, out := &in.Architecture, &out.Architecture
if *in == nil {
*out = nil
} else {
*out = new(Constraint)
**out = **in
}
}
if in.Hostname != nil {
in, out := &in.Hostname, &out.Hostname
if *in == nil {
*out = nil
} else {
*out = new(Constraint)
**out = **in
}
}
if in.MatchLabels != nil {
in, out := &in.MatchLabels, &out.MatchLabels
*out = make(map[string]Constraint, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Constraints.
func (in *Constraints) DeepCopy() *Constraints {
if in == nil {
return nil
}
out := new(Constraints)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeployConfig) DeepCopyInto(out *DeployConfig) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
if *in == nil {
*out = nil
} else {
*out = new(uint64)
**out = **in
}
}
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.UpdateConfig != nil {
in, out := &in.UpdateConfig, &out.UpdateConfig
if *in == nil {
*out = nil
} else {
*out = new(UpdateConfig)
(*in).DeepCopyInto(*out)
}
}
in.Resources.DeepCopyInto(&out.Resources)
if in.RestartPolicy != nil {
in, out := &in.RestartPolicy, &out.RestartPolicy
if *in == nil {
*out = nil
} else {
*out = new(RestartPolicy)
**out = **in
}
}
in.Placement.DeepCopyInto(&out.Placement)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployConfig.
func (in *DeployConfig) DeepCopy() *DeployConfig {
if in == nil {
return nil
}
out := new(DeployConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *External) DeepCopyInto(out *External) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new External.
func (in *External) DeepCopy() *External {
if in == nil {
return nil
}
out := new(External)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FileObjectConfig) DeepCopyInto(out *FileObjectConfig) {
*out = *in
out.External = in.External
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileObjectConfig.
func (in *FileObjectConfig) DeepCopy() *FileObjectConfig {
if in == nil {
return nil
}
out := new(FileObjectConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FileReferenceConfig) DeepCopyInto(out *FileReferenceConfig) {
*out = *in
if in.Mode != nil {
in, out := &in.Mode, &out.Mode
if *in == nil {
*out = nil
} else {
*out = new(uint32)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileReferenceConfig.
func (in *FileReferenceConfig) DeepCopy() *FileReferenceConfig {
if in == nil {
return nil
}
out := new(FileReferenceConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HealthCheckConfig) DeepCopyInto(out *HealthCheckConfig) {
*out = *in
if in.Test != nil {
in, out := &in.Test, &out.Test
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Timeout != nil {
in, out := &in.Timeout, &out.Timeout
if *in == nil {
*out = nil
} else {
*out = new(time.Duration)
**out = **in
}
}
if in.Interval != nil {
in, out := &in.Interval, &out.Interval
if *in == nil {
*out = nil
} else {
*out = new(time.Duration)
**out = **in
}
}
if in.Retries != nil {
in, out := &in.Retries, &out.Retries
if *in == nil {
*out = nil
} else {
*out = new(uint64)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckConfig.
func (in *HealthCheckConfig) DeepCopy() *HealthCheckConfig {
if in == nil {
return nil
}
out := new(HealthCheckConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Placement) DeepCopyInto(out *Placement) {
*out = *in
if in.Constraints != nil {
in, out := &in.Constraints, &out.Constraints
if *in == nil {
*out = nil
} else {
*out = new(Constraints)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement.
func (in *Placement) DeepCopy() *Placement {
if in == nil {
return nil
}
out := new(Placement)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Resource) DeepCopyInto(out *Resource) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource.
func (in *Resource) DeepCopy() *Resource {
if in == nil {
return nil
}
out := new(Resource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Resources) DeepCopyInto(out *Resources) {
*out = *in
if in.Limits != nil {
in, out := &in.Limits, &out.Limits
if *in == nil {
*out = nil
} else {
*out = new(Resource)
**out = **in
}
}
if in.Reservations != nil {
in, out := &in.Reservations, &out.Reservations
if *in == nil {
*out = nil
} else {
*out = new(Resource)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resources.
func (in *Resources) DeepCopy() *Resources {
if in == nil {
return nil
}
out := new(Resources)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RestartPolicy) DeepCopyInto(out *RestartPolicy) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestartPolicy.
func (in *RestartPolicy) DeepCopy() *RestartPolicy {
if in == nil {
return nil
}
out := new(RestartPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SecretConfig) DeepCopyInto(out *SecretConfig) {
*out = *in
out.External = in.External
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretConfig.
func (in *SecretConfig) DeepCopy() *SecretConfig {
if in == nil {
return nil
}
out := new(SecretConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceConfig) DeepCopyInto(out *ServiceConfig) {
*out = *in
if in.CapAdd != nil {
in, out := &in.CapAdd, &out.CapAdd
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.CapDrop != nil {
in, out := &in.CapDrop, &out.CapDrop
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Configs != nil {
in, out := &in.Configs, &out.Configs
*out = make([]ServiceConfigObjConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
in.Deploy.DeepCopyInto(&out.Deploy)
if in.Entrypoint != nil {
in, out := &in.Entrypoint, &out.Entrypoint
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Environment != nil {
in, out := &in.Environment, &out.Environment
*out = make(map[string]*string, len(*in))
for key, val := range *in {
if val == nil {
(*out)[key] = nil
} else {
outVal := *val
(*out)[key] = &outVal
}
}
}
if in.ExtraHosts != nil {
in, out := &in.ExtraHosts, &out.ExtraHosts
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.HealthCheck != nil {
in, out := &in.HealthCheck, &out.HealthCheck
if *in == nil {
*out = nil
} else {
*out = new(HealthCheckConfig)
(*in).DeepCopyInto(*out)
}
}
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]ServicePortConfig, len(*in))
copy(*out, *in)
}
if in.Secrets != nil {
in, out := &in.Secrets, &out.Secrets
*out = make([]ServiceSecretConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.StopGracePeriod != nil {
in, out := &in.StopGracePeriod, &out.StopGracePeriod
if *in == nil {
*out = nil
} else {
*out = new(time.Duration)
**out = **in
}
}
if in.Tmpfs != nil {
in, out := &in.Tmpfs, &out.Tmpfs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.User != nil {
in, out := &in.User, &out.User
if *in == nil {
*out = nil
} else {
*out = new(int64)
**out = **in
}
}
if in.Volumes != nil {
in, out := &in.Volumes, &out.Volumes
*out = make([]ServiceVolumeConfig, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfig.
func (in *ServiceConfig) DeepCopy() *ServiceConfig {
if in == nil {
return nil
}
out := new(ServiceConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceConfigObjConfig) DeepCopyInto(out *ServiceConfigObjConfig) {
*out = *in
if in.Mode != nil {
in, out := &in.Mode, &out.Mode
if *in == nil {
*out = nil
} else {
*out = new(uint32)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfigObjConfig.
func (in *ServiceConfigObjConfig) DeepCopy() *ServiceConfigObjConfig {
if in == nil {
return nil
}
out := new(ServiceConfigObjConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServicePortConfig) DeepCopyInto(out *ServicePortConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePortConfig.
func (in *ServicePortConfig) DeepCopy() *ServicePortConfig {
if in == nil {
return nil
}
out := new(ServicePortConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceSecretConfig) DeepCopyInto(out *ServiceSecretConfig) {
*out = *in
if in.Mode != nil {
in, out := &in.Mode, &out.Mode
if *in == nil {
*out = nil
} else {
*out = new(uint32)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSecretConfig.
func (in *ServiceSecretConfig) DeepCopy() *ServiceSecretConfig {
if in == nil {
return nil
}
out := new(ServiceSecretConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceVolumeConfig) DeepCopyInto(out *ServiceVolumeConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceVolumeConfig.
func (in *ServiceVolumeConfig) DeepCopy() *ServiceVolumeConfig {
if in == nil {
return nil
}
out := new(ServiceVolumeConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StackSpec) DeepCopyInto(out *StackSpec) {
*out = *in
if in.Services != nil {
in, out := &in.Services, &out.Services
*out = make([]ServiceConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Secrets != nil {
in, out := &in.Secrets, &out.Secrets
*out = make(map[string]SecretConfig, len(*in))
for key, val := range *in {
newVal := new(SecretConfig)
val.DeepCopyInto(newVal)
(*out)[key] = *newVal
}
}
if in.Configs != nil {
in, out := &in.Configs, &out.Configs
*out = make(map[string]ConfigObjConfig, len(*in))
for key, val := range *in {
newVal := new(ConfigObjConfig)
val.DeepCopyInto(newVal)
(*out)[key] = *newVal
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StackSpec.
func (in *StackSpec) DeepCopy() *StackSpec {
if in == nil {
return nil
}
out := new(StackSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UpdateConfig) DeepCopyInto(out *UpdateConfig) {
*out = *in
if in.Parallelism != nil {
in, out := &in.Parallelism, &out.Parallelism
if *in == nil {
*out = nil
} else {
*out = new(uint64)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdateConfig.
func (in *UpdateConfig) DeepCopy() *UpdateConfig {
if in == nil {
return nil
}
out := new(UpdateConfig)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,8 @@
// Api versions allow the api contract for a resource to be changed while keeping
// backward compatibility by support multiple concurrent versions
// of the same resource
// Package v1alpha3 is the current in dev version of the stack, containing evolution on top of v1beta2 structured spec
// +k8s:openapi-gen=true
// +k8s:conversion-gen=github.com/docker/compose-on-kubernetes/api/compose/v1beta2
package v1alpha3

View File

@ -0,0 +1,30 @@
package v1alpha3
import (
"github.com/docker/compose-on-kubernetes/api/compose/impersonation"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// Owner describes the user who created the stack
type Owner struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Owner impersonation.Config `json:"owner,omitempty"`
}
func (o *Owner) clone() *Owner {
if o == nil {
return nil
}
result := new(Owner)
result.TypeMeta = o.TypeMeta
result.ObjectMeta = o.ObjectMeta
result.Owner = *result.Owner.Clone()
return result
}
// DeepCopyObject clones the owner
func (o *Owner) DeepCopyObject() runtime.Object {
return o.clone()
}

View File

@ -0,0 +1,42 @@
package v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the name of the compose group
const GroupName = "compose.docker.com"
var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha3"}
// SchemeBuilder is the scheme builder
SchemeBuilder runtime.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
// AddToScheme adds to scheme
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {
localSchemeBuilder.Register(addKnownTypes)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Stack{},
&StackList{},
&Owner{},
&ComposeFile{},
&Scale{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
// GroupResource takes an unqualified resource and returns a Group qualified GroupResource
func GroupResource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

View File

@ -0,0 +1,29 @@
package v1alpha3
import (
"github.com/docker/compose-on-kubernetes/api/compose/clone"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// Scale contains the current/desired replica count for services in a stack.
type Scale struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec map[string]int `json:"spec,omitempty"`
Status map[string]int `json:"status,omitempty"`
}
func (s *Scale) clone() *Scale {
return &Scale{
TypeMeta: s.TypeMeta,
ObjectMeta: s.ObjectMeta,
Spec: clone.MapOfStringToInt(s.Spec),
Status: clone.MapOfStringToInt(s.Status),
}
}
// DeepCopyObject clones the scale
func (s *Scale) DeepCopyObject() runtime.Object {
return s.clone()
}

View File

@ -0,0 +1,270 @@
package v1alpha3
import (
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// StackList is a list of stacks
type StackList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []Stack `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// Stack is v1alpha3's representation of a Stack
type Stack struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec *StackSpec `json:"spec,omitempty"`
Status *StackStatus `json:"status,omitempty"`
}
// DeepCopyObject clones the stack
func (s *Stack) DeepCopyObject() runtime.Object {
return s.clone()
}
// DeepCopyObject clones the stack list
func (s *StackList) DeepCopyObject() runtime.Object {
if s == nil {
return nil
}
result := new(StackList)
result.TypeMeta = s.TypeMeta
result.ListMeta = s.ListMeta
if s.Items == nil {
return result
}
result.Items = make([]Stack, len(s.Items))
for ix, s := range s.Items {
result.Items[ix] = *s.clone()
}
return result
}
func (s *Stack) clone() *Stack {
if s == nil {
return nil
}
result := new(Stack)
result.TypeMeta = s.TypeMeta
result.ObjectMeta = s.ObjectMeta
result.Spec = s.Spec.DeepCopy()
result.Status = s.Status.clone()
return result
}
// StackSpec defines the desired state of Stack
// +k8s:deepcopy-gen=true
type StackSpec struct {
Services []ServiceConfig `json:"services,omitempty"`
Secrets map[string]SecretConfig `json:"secrets,omitempty"`
Configs map[string]ConfigObjConfig `json:"configs,omitempty"`
}
// ServiceConfig is the configuration of one service
// +k8s:deepcopy-gen=true
type ServiceConfig struct {
Name string `json:"name,omitempty"`
CapAdd []string `json:"cap_add,omitempty"`
CapDrop []string `json:"cap_drop,omitempty"`
Command []string `json:"command,omitempty"`
Configs []ServiceConfigObjConfig `json:"configs,omitempty"`
Deploy DeployConfig `json:"deploy,omitempty"`
Entrypoint []string `json:"entrypoint,omitempty"`
Environment map[string]*string `json:"environment,omitempty"`
ExtraHosts []string `json:"extra_hosts,omitempty"`
Hostname string `json:"hostname,omitempty"`
HealthCheck *HealthCheckConfig `json:"health_check,omitempty"`
Image string `json:"image,omitempty"`
Ipc string `json:"ipc,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Pid string `json:"pid,omitempty"`
Ports []ServicePortConfig `json:"ports,omitempty"`
Privileged bool `json:"privileged,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
Secrets []ServiceSecretConfig `json:"secrets,omitempty"`
StdinOpen bool `json:"stdin_open,omitempty"`
StopGracePeriod *time.Duration `json:"stop_grace_period,omitempty"`
Tmpfs []string `json:"tmpfs,omitempty"`
Tty bool `json:"tty,omitempty"`
User *int64 `json:"user,omitempty"`
Volumes []ServiceVolumeConfig `json:"volumes,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
}
// ServicePortConfig is the port configuration for a service
// +k8s:deepcopy-gen=true
type ServicePortConfig struct {
Mode string `json:"mode,omitempty"`
Target uint32 `json:"target,omitempty"`
Published uint32 `json:"published,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
// FileObjectConfig is a config type for a file used by a service
// +k8s:deepcopy-gen=true
type FileObjectConfig struct {
Name string `json:"name,omitempty"`
File string `json:"file,omitempty"`
External External `json:"external,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
// SecretConfig for a secret
// +k8s:deepcopy-gen=true
type SecretConfig FileObjectConfig
// ConfigObjConfig is the config for the swarm "Config" object
// +k8s:deepcopy-gen=true
type ConfigObjConfig FileObjectConfig
// External identifies a Volume or Network as a reference to a resource that is
// not managed, and should already exist.
// External.name is deprecated and replaced by Volume.name
// +k8s:deepcopy-gen=true
type External struct {
Name string `json:"name,omitempty"`
External bool `json:"external,omitempty"`
}
// FileReferenceConfig for a reference to a swarm file object
// +k8s:deepcopy-gen=true
type FileReferenceConfig struct {
Source string `json:"source,omitempty"`
Target string `json:"target,omitempty"`
UID string `json:"uid,omitempty"`
GID string `json:"gid,omitempty"`
Mode *uint32 `json:"mode,omitempty"`
}
// ServiceConfigObjConfig is the config obj configuration for a service
// +k8s:deepcopy-gen=true
type ServiceConfigObjConfig FileReferenceConfig
// ServiceSecretConfig is the secret configuration for a service
// +k8s:deepcopy-gen=true
type ServiceSecretConfig FileReferenceConfig
// DeployConfig is the deployment configuration for a service
// +k8s:deepcopy-gen=true
type DeployConfig struct {
Mode string `json:"mode,omitempty"`
Replicas *uint64 `json:"replicas,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
UpdateConfig *UpdateConfig `json:"update_config,omitempty"`
Resources Resources `json:"resources,omitempty"`
RestartPolicy *RestartPolicy `json:"restart_policy,omitempty"`
Placement Placement `json:"placement,omitempty"`
}
// UpdateConfig is the service update configuration
// +k8s:deepcopy-gen=true
type UpdateConfig struct {
Parallelism *uint64 `json:"paralellism,omitempty"`
}
// Resources the resource limits and reservations
// +k8s:deepcopy-gen=true
type Resources struct {
Limits *Resource `json:"limits,omitempty"`
Reservations *Resource `json:"reservations,omitempty"`
}
// Resource is a resource to be limited or reserved
// +k8s:deepcopy-gen=true
type Resource struct {
NanoCPUs string `json:"cpus,omitempty"`
MemoryBytes int64 `json:"memory,omitempty"`
}
// RestartPolicy is the service restart policy
// +k8s:deepcopy-gen=true
type RestartPolicy struct {
Condition string `json:"condition,omitempty"`
}
// Placement constraints for the service
// +k8s:deepcopy-gen=true
type Placement struct {
Constraints *Constraints `json:"constraints,omitempty"`
}
// Constraints lists constraints that can be set on the service
// +k8s:deepcopy-gen=true
type Constraints struct {
OperatingSystem *Constraint
Architecture *Constraint
Hostname *Constraint
MatchLabels map[string]Constraint
}
// Constraint defines a constraint and it's operator (== or !=)
// +k8s:deepcopy-gen=true
type Constraint struct {
Value string
Operator string
}
// HealthCheckConfig the healthcheck configuration for a service
// +k8s:deepcopy-gen=true
type HealthCheckConfig struct {
Test []string `json:"test,omitempty"`
Timeout *time.Duration `json:"timeout,omitempty"`
Interval *time.Duration `json:"interval,omitempty"`
Retries *uint64 `json:"retries,omitempty"`
}
// ServiceVolumeConfig are references to a volume used by a service
// +k8s:deepcopy-gen=true
type ServiceVolumeConfig struct {
Type string `json:"type,omitempty"`
Source string `json:"source,omitempty"`
Target string `json:"target,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
}
// StackPhase is the deployment phase of a stack
type StackPhase string
// These are valid conditions of a stack.
const (
// StackAvailable means the stack is available.
StackAvailable StackPhase = "Available"
// StackProgressing means the deployment is progressing.
StackProgressing StackPhase = "Progressing"
// StackFailure is added in a stack when one of its members fails to be created
// or deleted.
StackFailure StackPhase = "Failure"
// StackReconciliationPending means the stack has not yet been reconciled
StackReconciliationPending StackPhase = "ReconciliationPending"
)
// StackStatus defines the observed state of Stack
type StackStatus struct {
// Current condition of the stack.
// +optional
Phase StackPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=StackPhase"`
// A human readable message indicating details about the stack.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}
func (s *StackStatus) clone() *StackStatus {
if s == nil {
return nil
}
result := *s
return &result
}
// Clone clones a Stack
func (s *Stack) Clone() *Stack {
return s.clone()
}