added OpenShifts fork of Kubernetes

reason for this is that openshift/kubernetes backported
k8s.io/kubernetes/pkg/securitycontextconstraints/util
that is currently required by something that
github.com/openshift/origin/pkg/deploy/api/v1 depends on
This commit is contained in:
Tomas Kral
2016-07-21 20:37:18 +02:00
parent 2626b51dee
commit 3db5069ff5
224 changed files with 95644 additions and 85623 deletions
+19
View File
@@ -0,0 +1,19 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"github.com/openshift/origin/pkg/api/extension"
)
// Convert_runtime_Object_To_runtime_RawExtension ensures an object is converted to the destination version of the conversion.
func Convert_runtime_Object_To_runtime_RawExtension(in *runtime.Object, out *runtime.RawExtension, s conversion.Scope) error {
return extension.Convert_runtime_Object_To_runtime_RawExtension(kapi.Scheme, in, out, s)
}
// Convert_runtime_RawExtension_To_runtime_Object ensures an object is converted to the destination version of the conversion.
func Convert_runtime_RawExtension_To_runtime_Object(in *runtime.RawExtension, out *runtime.Object, s conversion.Scope) error {
return extension.Convert_runtime_RawExtension_To_runtime_Object(kapi.Scheme, in, out, s)
}
+6
View File
@@ -0,0 +1,6 @@
// Package api includes all OpenShift-specific types used to communicate
// between the various parts of the OpenShift and the Kubernetes systems.
//
// Unlike the upstream Kubernetes, API objects in OpenShift are separated
// into individual packages.
package api
+104
View File
@@ -0,0 +1,104 @@
package extension
import (
"fmt"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
)
// Convert_runtime_Object_To_runtime_RawExtension attempts to convert runtime.Objects to the appropriate target, returning an error
// if there is insufficient information on the conversion scope to determine the target version.
func Convert_runtime_Object_To_runtime_RawExtension(c runtime.ObjectConvertor, in *runtime.Object, out *runtime.RawExtension, s conversion.Scope) error {
if *in == nil {
return nil
}
obj := *in
switch obj.(type) {
case *runtime.Unknown, *runtime.Unstructured:
out.Raw = nil
out.Object = obj
return nil
}
switch t := s.Meta().Context.(type) {
case runtime.GroupVersioner:
converted, err := c.ConvertToVersion(obj, t)
if err != nil {
return err
}
out.Raw = nil
out.Object = converted
default:
return fmt.Errorf("unrecognized conversion context for versioning: %#v", t)
}
return nil
}
// Convert_runtime_RawExtension_To_runtime_Object attempts to convert an incoming object into the
// appropriate output type.
func Convert_runtime_RawExtension_To_runtime_Object(c runtime.ObjectConvertor, in *runtime.RawExtension, out *runtime.Object, s conversion.Scope) error {
if in == nil || in.Object == nil {
return nil
}
switch in.Object.(type) {
case *runtime.Unknown, *runtime.Unstructured:
*out = in.Object
return nil
}
switch t := s.Meta().Context.(type) {
case runtime.GroupVersioner:
converted, err := c.ConvertToVersion(in.Object, t)
if err != nil {
return err
}
in.Object = converted
*out = converted
default:
return fmt.Errorf("unrecognized conversion context for conversion to internal: %#v (%T)", t, t)
}
return nil
}
// DecodeNestedRawExtensionOrUnknown
func DecodeNestedRawExtensionOrUnknown(d runtime.Decoder, ext *runtime.RawExtension) {
if ext.Raw == nil || ext.Object != nil {
return
}
obj, gvk, err := d.Decode(ext.Raw, nil, nil)
if err != nil {
unk := &runtime.Unknown{Raw: ext.Raw}
if runtime.IsNotRegisteredError(err) {
if _, gvk, err := d.Decode(ext.Raw, nil, unk); err == nil {
unk.APIVersion = gvk.GroupVersion().String()
unk.Kind = gvk.Kind
ext.Object = unk
return
}
}
// TODO: record mime-type with the object
if gvk != nil {
unk.APIVersion = gvk.GroupVersion().String()
unk.Kind = gvk.Kind
}
obj = unk
}
ext.Object = obj
}
// EncodeNestedRawExtension will encode the object in the RawExtension (if not nil) or
// return an error.
func EncodeNestedRawExtension(e runtime.Encoder, ext *runtime.RawExtension) error {
if ext.Raw != nil || ext.Object == nil {
return nil
}
data, err := runtime.Encode(e, ext.Object)
if err != nil {
return err
}
ext.Raw = data
return nil
}
+54
View File
@@ -0,0 +1,54 @@
package api
import (
"fmt"
"strings"
"k8s.io/kubernetes/pkg/api/validation"
)
var NameMayNotBe = []string{".", ".."}
var NameMayNotContain = []string{"/", "%"}
func MinimalNameRequirements(name string, prefix bool) []string {
for _, illegalName := range NameMayNotBe {
if name == illegalName {
return []string{fmt.Sprintf(`name may not be %q`, illegalName)}
}
}
for _, illegalContent := range NameMayNotContain {
if strings.Contains(name, illegalContent) {
return []string{fmt.Sprintf(`name may not contain %q`, illegalContent)}
}
}
return nil
}
// GetNameValidationFunc returns a name validation function that includes the standard restrictions we want for all types
func GetNameValidationFunc(nameFunc validation.ValidateNameFunc) validation.ValidateNameFunc {
return func(name string, prefix bool) []string {
if reasons := MinimalNameRequirements(name, prefix); len(reasons) != 0 {
return reasons
}
return nameFunc(name, prefix)
}
}
// GetFieldLabelConversionFunc returns a field label conversion func, which does the following:
// * returns overrideLabels[label], value, nil if the specified label exists in the overrideLabels map
// * returns label, value, nil if the specified label exists as a key in the supportedLabels map (values in this map are unused, it is intended to be a prototypical label/value map)
// * otherwise, returns an error
func GetFieldLabelConversionFunc(supportedLabels map[string]string, overrideLabels map[string]string) func(label, value string) (string, string, error) {
return func(label, value string) (string, string, error) {
if label, overridden := overrideLabels[label]; overridden {
return label, value, nil
}
if _, supported := supportedLabels[label]; supported {
return label, value, nil
}
return "", "", fmt.Errorf("field label not supported: %s", label)
}
}
+19
View File
@@ -0,0 +1,19 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
)
func ListOptionsToSelectors(options *kapi.ListOptions) (labels.Selector, fields.Selector) {
label := labels.Everything()
if options != nil && options.LabelSelector != nil {
label = options.LabelSelector
}
field := fields.Everything()
if options != nil && options.FieldSelector != nil {
field = options.FieldSelector
}
return label, field
}
+33
View File
@@ -0,0 +1,33 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
_ "github.com/openshift/origin/pkg/authorization/api"
_ "github.com/openshift/origin/pkg/build/api"
_ "github.com/openshift/origin/pkg/deploy/api"
_ "github.com/openshift/origin/pkg/image/api"
_ "github.com/openshift/origin/pkg/oauth/api"
_ "github.com/openshift/origin/pkg/project/api"
_ "github.com/openshift/origin/pkg/route/api"
_ "github.com/openshift/origin/pkg/sdn/api"
_ "github.com/openshift/origin/pkg/security/api"
_ "github.com/openshift/origin/pkg/template/api"
_ "github.com/openshift/origin/pkg/user/api"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
+1
View File
@@ -0,0 +1 @@
package api
+248
View File
@@ -0,0 +1,248 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
)
// policies
func ToPolicyList(in *ClusterPolicyList) *PolicyList {
ret := &PolicyList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToPolicy(&curr))
}
return ret
}
func ToPolicy(in *ClusterPolicy) *Policy {
if in == nil {
return nil
}
ret := &Policy{}
ret.ObjectMeta = in.ObjectMeta
ret.LastModified = in.LastModified
ret.Roles = ToRoleMap(in.Roles)
return ret
}
func ToRoleMap(in map[string]*ClusterRole) map[string]*Role {
ret := map[string]*Role{}
for key, role := range in {
ret[key] = ToRole(role)
}
return ret
}
func ToRoleList(in *ClusterRoleList) *RoleList {
ret := &RoleList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToRole(&curr))
}
return ret
}
func ToRole(in *ClusterRole) *Role {
if in == nil {
return nil
}
ret := &Role{}
ret.ObjectMeta = in.ObjectMeta
ret.Rules = in.Rules
return ret
}
func ToClusterPolicyList(in *PolicyList) *ClusterPolicyList {
ret := &ClusterPolicyList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToClusterPolicy(&curr))
}
return ret
}
func ToClusterPolicy(in *Policy) *ClusterPolicy {
if in == nil {
return nil
}
ret := &ClusterPolicy{}
ret.ObjectMeta = in.ObjectMeta
ret.LastModified = in.LastModified
ret.Roles = ToClusterRoleMap(in.Roles)
return ret
}
func ToClusterRoleMap(in map[string]*Role) map[string]*ClusterRole {
ret := map[string]*ClusterRole{}
for key, role := range in {
ret[key] = ToClusterRole(role)
}
return ret
}
func ToClusterRoleList(in *RoleList) *ClusterRoleList {
ret := &ClusterRoleList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToClusterRole(&curr))
}
return ret
}
func ToClusterRole(in *Role) *ClusterRole {
if in == nil {
return nil
}
ret := &ClusterRole{}
ret.ObjectMeta = in.ObjectMeta
ret.Rules = in.Rules
return ret
}
// policy bindings
func ToPolicyBindingList(in *ClusterPolicyBindingList) *PolicyBindingList {
ret := &PolicyBindingList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToPolicyBinding(&curr))
}
return ret
}
func ToPolicyBinding(in *ClusterPolicyBinding) *PolicyBinding {
if in == nil {
return nil
}
ret := &PolicyBinding{}
ret.ObjectMeta = in.ObjectMeta
ret.LastModified = in.LastModified
ret.PolicyRef = ToPolicyRef(in.PolicyRef)
ret.RoleBindings = ToRoleBindingMap(in.RoleBindings)
return ret
}
func ToPolicyRef(in kapi.ObjectReference) kapi.ObjectReference {
ret := kapi.ObjectReference{}
ret.Name = in.Name
return ret
}
func ToRoleBindingMap(in map[string]*ClusterRoleBinding) map[string]*RoleBinding {
ret := map[string]*RoleBinding{}
for key, RoleBinding := range in {
ret[key] = ToRoleBinding(RoleBinding)
}
return ret
}
func ToRoleBindingList(in *ClusterRoleBindingList) *RoleBindingList {
ret := &RoleBindingList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToRoleBinding(&curr))
}
return ret
}
func ToRoleBinding(in *ClusterRoleBinding) *RoleBinding {
if in == nil {
return nil
}
ret := &RoleBinding{}
ret.ObjectMeta = in.ObjectMeta
ret.Subjects = in.Subjects
ret.RoleRef = ToRoleRef(in.RoleRef)
return ret
}
func ToRoleRef(in kapi.ObjectReference) kapi.ObjectReference {
ret := kapi.ObjectReference{}
ret.Name = in.Name
return ret
}
func ToClusterPolicyBindingList(in *PolicyBindingList) *ClusterPolicyBindingList {
ret := &ClusterPolicyBindingList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToClusterPolicyBinding(&curr))
}
return ret
}
func ToClusterPolicyBinding(in *PolicyBinding) *ClusterPolicyBinding {
if in == nil {
return nil
}
ret := &ClusterPolicyBinding{}
ret.ObjectMeta = in.ObjectMeta
ret.LastModified = in.LastModified
ret.PolicyRef = ToClusterPolicyRef(in.PolicyRef)
ret.RoleBindings = ToClusterRoleBindingMap(in.RoleBindings)
return ret
}
func ToClusterPolicyRef(in kapi.ObjectReference) kapi.ObjectReference {
ret := kapi.ObjectReference{}
ret.Name = in.Name
return ret
}
func ToClusterRoleBindingMap(in map[string]*RoleBinding) map[string]*ClusterRoleBinding {
ret := map[string]*ClusterRoleBinding{}
for key, RoleBinding := range in {
ret[key] = ToClusterRoleBinding(RoleBinding)
}
return ret
}
func ToClusterRoleBindingList(in *RoleBindingList) *ClusterRoleBindingList {
ret := &ClusterRoleBindingList{}
for _, curr := range in.Items {
ret.Items = append(ret.Items, *ToClusterRoleBinding(&curr))
}
return ret
}
func ToClusterRoleBinding(in *RoleBinding) *ClusterRoleBinding {
if in == nil {
return nil
}
ret := &ClusterRoleBinding{}
ret.ObjectMeta = in.ObjectMeta
ret.Subjects = in.Subjects
ret.RoleRef = ToClusterRoleRef(in.RoleRef)
return ret
}
func ToClusterRoleRef(in kapi.ObjectReference) kapi.ObjectReference {
ret := kapi.ObjectReference{}
ret.Name = in.Name
return ret
}
@@ -0,0 +1,678 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
sets "k8s.io/kubernetes/pkg/util/sets"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_AuthorizationAttributes,
DeepCopy_api_ClusterPolicy,
DeepCopy_api_ClusterPolicyBinding,
DeepCopy_api_ClusterPolicyBindingList,
DeepCopy_api_ClusterPolicyList,
DeepCopy_api_ClusterRole,
DeepCopy_api_ClusterRoleBinding,
DeepCopy_api_ClusterRoleBindingList,
DeepCopy_api_ClusterRoleList,
DeepCopy_api_IsPersonalSubjectAccessReview,
DeepCopy_api_LocalResourceAccessReview,
DeepCopy_api_LocalSubjectAccessReview,
DeepCopy_api_Policy,
DeepCopy_api_PolicyBinding,
DeepCopy_api_PolicyBindingList,
DeepCopy_api_PolicyList,
DeepCopy_api_PolicyRule,
DeepCopy_api_ResourceAccessReview,
DeepCopy_api_ResourceAccessReviewResponse,
DeepCopy_api_Role,
DeepCopy_api_RoleBinding,
DeepCopy_api_RoleBindingList,
DeepCopy_api_RoleList,
DeepCopy_api_SelfSubjectRulesReview,
DeepCopy_api_SelfSubjectRulesReviewSpec,
DeepCopy_api_SubjectAccessReview,
DeepCopy_api_SubjectAccessReviewResponse,
DeepCopy_api_SubjectRulesReviewStatus,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_AuthorizationAttributes(in AuthorizationAttributes, out *AuthorizationAttributes, c *conversion.Cloner) error {
out.Namespace = in.Namespace
out.Verb = in.Verb
out.Group = in.Group
out.Version = in.Version
out.Resource = in.Resource
out.ResourceName = in.ResourceName
if in.Content == nil {
out.Content = nil
} else if newVal, err := c.DeepCopy(in.Content); err != nil {
return err
} else {
out.Content = newVal.(runtime.Object)
}
return nil
}
func DeepCopy_api_ClusterPolicy(in ClusterPolicy, out *ClusterPolicy, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastModified, &out.LastModified, c); err != nil {
return err
}
if in.Roles != nil {
in, out := in.Roles, &out.Roles
*out = make(map[string]*ClusterRole)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(*ClusterRole)
}
}
} else {
out.Roles = nil
}
return nil
}
func DeepCopy_api_ClusterPolicyBinding(in ClusterPolicyBinding, out *ClusterPolicyBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastModified, &out.LastModified, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectReference(in.PolicyRef, &out.PolicyRef, c); err != nil {
return err
}
if in.RoleBindings != nil {
in, out := in.RoleBindings, &out.RoleBindings
*out = make(map[string]*ClusterRoleBinding)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(*ClusterRoleBinding)
}
}
} else {
out.RoleBindings = nil
}
return nil
}
func DeepCopy_api_ClusterPolicyBindingList(in ClusterPolicyBindingList, out *ClusterPolicyBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterPolicyBinding, len(in))
for i := range in {
if err := DeepCopy_api_ClusterPolicyBinding(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_ClusterPolicyList(in ClusterPolicyList, out *ClusterPolicyList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterPolicy, len(in))
for i := range in {
if err := DeepCopy_api_ClusterPolicy(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_ClusterRole(in ClusterRole, out *ClusterRole, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.Rules != nil {
in, out := in.Rules, &out.Rules
*out = make([]PolicyRule, len(in))
for i := range in {
if err := DeepCopy_api_PolicyRule(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Rules = nil
}
return nil
}
func DeepCopy_api_ClusterRoleBinding(in ClusterRoleBinding, out *ClusterRoleBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.Subjects != nil {
in, out := in.Subjects, &out.Subjects
*out = make([]api.ObjectReference, len(in))
for i := range in {
if err := api.DeepCopy_api_ObjectReference(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Subjects = nil
}
if err := api.DeepCopy_api_ObjectReference(in.RoleRef, &out.RoleRef, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_ClusterRoleBindingList(in ClusterRoleBindingList, out *ClusterRoleBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterRoleBinding, len(in))
for i := range in {
if err := DeepCopy_api_ClusterRoleBinding(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_ClusterRoleList(in ClusterRoleList, out *ClusterRoleList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterRole, len(in))
for i := range in {
if err := DeepCopy_api_ClusterRole(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_IsPersonalSubjectAccessReview(in IsPersonalSubjectAccessReview, out *IsPersonalSubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_LocalResourceAccessReview(in LocalResourceAccessReview, out *LocalResourceAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_AuthorizationAttributes(in.Action, &out.Action, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_LocalSubjectAccessReview(in LocalSubjectAccessReview, out *LocalSubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_AuthorizationAttributes(in.Action, &out.Action, c); err != nil {
return err
}
out.User = in.User
if in.Groups != nil {
in, out := in.Groups, &out.Groups
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.Groups = nil
}
if in.Scopes != nil {
in, out := in.Scopes, &out.Scopes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Scopes = nil
}
return nil
}
func DeepCopy_api_Policy(in Policy, out *Policy, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastModified, &out.LastModified, c); err != nil {
return err
}
if in.Roles != nil {
in, out := in.Roles, &out.Roles
*out = make(map[string]*Role)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(*Role)
}
}
} else {
out.Roles = nil
}
return nil
}
func DeepCopy_api_PolicyBinding(in PolicyBinding, out *PolicyBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastModified, &out.LastModified, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectReference(in.PolicyRef, &out.PolicyRef, c); err != nil {
return err
}
if in.RoleBindings != nil {
in, out := in.RoleBindings, &out.RoleBindings
*out = make(map[string]*RoleBinding)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(*RoleBinding)
}
}
} else {
out.RoleBindings = nil
}
return nil
}
func DeepCopy_api_PolicyBindingList(in PolicyBindingList, out *PolicyBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]PolicyBinding, len(in))
for i := range in {
if err := DeepCopy_api_PolicyBinding(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_PolicyList(in PolicyList, out *PolicyList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Policy, len(in))
for i := range in {
if err := DeepCopy_api_Policy(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_PolicyRule(in PolicyRule, out *PolicyRule, c *conversion.Cloner) error {
if in.Verbs != nil {
in, out := in.Verbs, &out.Verbs
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.Verbs = nil
}
if in.AttributeRestrictions == nil {
out.AttributeRestrictions = nil
} else if newVal, err := c.DeepCopy(in.AttributeRestrictions); err != nil {
return err
} else {
out.AttributeRestrictions = newVal.(runtime.Object)
}
if in.APIGroups != nil {
in, out := in.APIGroups, &out.APIGroups
*out = make([]string, len(in))
copy(*out, in)
} else {
out.APIGroups = nil
}
if in.Resources != nil {
in, out := in.Resources, &out.Resources
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.Resources = nil
}
if in.ResourceNames != nil {
in, out := in.ResourceNames, &out.ResourceNames
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.ResourceNames = nil
}
if in.NonResourceURLs != nil {
in, out := in.NonResourceURLs, &out.NonResourceURLs
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.NonResourceURLs = nil
}
return nil
}
func DeepCopy_api_ResourceAccessReview(in ResourceAccessReview, out *ResourceAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_AuthorizationAttributes(in.Action, &out.Action, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_ResourceAccessReviewResponse(in ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Namespace = in.Namespace
if in.Users != nil {
in, out := in.Users, &out.Users
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.Users = nil
}
if in.Groups != nil {
in, out := in.Groups, &out.Groups
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.Groups = nil
}
out.EvaluationError = in.EvaluationError
return nil
}
func DeepCopy_api_Role(in Role, out *Role, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.Rules != nil {
in, out := in.Rules, &out.Rules
*out = make([]PolicyRule, len(in))
for i := range in {
if err := DeepCopy_api_PolicyRule(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Rules = nil
}
return nil
}
func DeepCopy_api_RoleBinding(in RoleBinding, out *RoleBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.Subjects != nil {
in, out := in.Subjects, &out.Subjects
*out = make([]api.ObjectReference, len(in))
for i := range in {
if err := api.DeepCopy_api_ObjectReference(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Subjects = nil
}
if err := api.DeepCopy_api_ObjectReference(in.RoleRef, &out.RoleRef, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_RoleBindingList(in RoleBindingList, out *RoleBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]RoleBinding, len(in))
for i := range in {
if err := DeepCopy_api_RoleBinding(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_RoleList(in RoleList, out *RoleList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Role, len(in))
for i := range in {
if err := DeepCopy_api_Role(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_SelfSubjectRulesReview(in SelfSubjectRulesReview, out *SelfSubjectRulesReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_SelfSubjectRulesReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_SubjectRulesReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_SelfSubjectRulesReviewSpec(in SelfSubjectRulesReviewSpec, out *SelfSubjectRulesReviewSpec, c *conversion.Cloner) error {
if in.Scopes != nil {
in, out := in.Scopes, &out.Scopes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Scopes = nil
}
return nil
}
func DeepCopy_api_SubjectAccessReview(in SubjectAccessReview, out *SubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_AuthorizationAttributes(in.Action, &out.Action, c); err != nil {
return err
}
out.User = in.User
if in.Groups != nil {
in, out := in.Groups, &out.Groups
*out = make(sets.String)
for key, val := range in {
if newVal, err := c.DeepCopy(val); err != nil {
return err
} else {
(*out)[key] = newVal.(sets.Empty)
}
}
} else {
out.Groups = nil
}
if in.Scopes != nil {
in, out := in.Scopes, &out.Scopes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Scopes = nil
}
return nil
}
func DeepCopy_api_SubjectAccessReviewResponse(in SubjectAccessReviewResponse, out *SubjectAccessReviewResponse, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Namespace = in.Namespace
out.Allowed = in.Allowed
out.Reason = in.Reason
return nil
}
func DeepCopy_api_SubjectRulesReviewStatus(in SubjectRulesReviewStatus, out *SubjectRulesReviewStatus, c *conversion.Cloner) error {
if in.Rules != nil {
in, out := in.Rules, &out.Rules
*out = make([]PolicyRule, len(in))
for i := range in {
if err := DeepCopy_api_PolicyRule(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Rules = nil
}
out.EvaluationError = in.EvaluationError
return nil
}
@@ -0,0 +1,91 @@
package api
import (
"k8s.io/kubernetes/pkg/util/sets"
)
// NEVER TOUCH ANYTHING IN THIS FILE!
const (
// resourceGroupPrefix is the prefix for indicating that a resource entry is actually a group of resources. The groups are defined in code and indicate resources that are commonly permissioned together
resourceGroupPrefix = "resourcegroup:"
buildGroupName = resourceGroupPrefix + "builds"
deploymentGroupName = resourceGroupPrefix + "deployments"
imageGroupName = resourceGroupPrefix + "images"
oauthGroupName = resourceGroupPrefix + "oauth"
userGroupName = resourceGroupPrefix + "users"
templateGroupName = resourceGroupPrefix + "templates"
sdnGroupName = resourceGroupPrefix + "sdn"
// policyOwnerGroupName includes the physical resources behind the permissionGrantingGroupName. Unless these physical objects are created first, users with privileges to permissionGrantingGroupName will
// only be able to bind to global roles
policyOwnerGroupName = resourceGroupPrefix + "policy"
// permissionGrantingGroupName includes resources that are necessary to maintain authorization roles and bindings. By itself, this group is insufficient to create anything except for bindings
// to master roles. If a local Policy already exists, then privileges to this group will allow for modification of local roles.
permissionGrantingGroupName = resourceGroupPrefix + "granter"
// openshiftExposedGroupName includes resources that are commonly viewed and modified by end users of the system. It does not include any sensitive resources that control authentication or authorization
openshiftExposedGroupName = resourceGroupPrefix + "exposedopenshift"
openshiftAllGroupName = resourceGroupPrefix + "allopenshift"
openshiftStatusGroupName = resourceGroupPrefix + "allopenshift-status"
quotaGroupName = resourceGroupPrefix + "quota"
// kubeInternalsGroupName includes those resources that should reasonably be viewable to end users, but that most users should probably not modify. Kubernetes herself will maintain these resources
kubeInternalsGroupName = resourceGroupPrefix + "privatekube"
// kubeExposedGroupName includes resources that are commonly viewed and modified by end users of the system.
kubeExposedGroupName = resourceGroupPrefix + "exposedkube"
kubeAllGroupName = resourceGroupPrefix + "allkube"
kubeStatusGroupName = resourceGroupPrefix + "allkube-status"
// nonescalatingResourcesGroupName contains all resources that can be viewed without exposing the risk of using view rights to locate a secret to escalate privileges. For example, view
// rights on secrets could be used locate a secret that happened to be serviceaccount token that has more privileges
nonescalatingResourcesGroupName = resourceGroupPrefix + "non-escalating"
kubeNonEscalatingViewableGroupName = resourceGroupPrefix + "kube-non-escalating"
openshiftNonEscalatingViewableGroupName = resourceGroupPrefix + "openshift-non-escalating"
// escalatingResourcesGroupName contains all resources that can be used to escalate privileges when simply viewed
escalatingResourcesGroupName = resourceGroupPrefix + "escalating"
kubeEscalatingViewableGroupName = resourceGroupPrefix + "kube-escalating"
openshiftEscalatingViewableGroupName = resourceGroupPrefix + "openshift-escalating"
)
var (
groupsToResources = map[string][]string{
buildGroupName: {"builds", "buildconfigs", "buildlogs", "buildconfigs/instantiate", "buildconfigs/instantiatebinary", "builds/log", "builds/clone", "buildconfigs/webhooks"},
imageGroupName: {"imagestreams", "imagestreammappings", "imagestreamtags", "imagestreamimages", "imagestreamimports"},
deploymentGroupName: {"deploymentconfigs", "generatedeploymentconfigs", "deploymentconfigrollbacks", "deploymentconfigs/log", "deploymentconfigs/scale"},
sdnGroupName: {"clusternetworks", "hostsubnets", "netnamespaces"},
templateGroupName: {"templates", "templateconfigs", "processedtemplates"},
userGroupName: {"identities", "users", "useridentitymappings", "groups"},
oauthGroupName: {"oauthauthorizetokens", "oauthaccesstokens", "oauthclients", "oauthclientauthorizations"},
policyOwnerGroupName: {"policies", "policybindings"},
// RAR and SAR are in this list to support backwards compatibility with clients that expect access to those resource in a namespace scope and a cluster scope.
// TODO remove once we have eliminated the namespace scoped resource.
permissionGrantingGroupName: {"roles", "rolebindings", "resourceaccessreviews" /* cluster scoped*/, "subjectaccessreviews" /* cluster scoped*/, "localresourceaccessreviews", "localsubjectaccessreviews"},
openshiftExposedGroupName: {buildGroupName, imageGroupName, deploymentGroupName, templateGroupName, "routes"},
openshiftAllGroupName: {openshiftExposedGroupName, userGroupName, oauthGroupName, policyOwnerGroupName, sdnGroupName, permissionGrantingGroupName, openshiftStatusGroupName, "projects",
"clusterroles", "clusterrolebindings", "clusterpolicies", "clusterpolicybindings", "images" /* cluster scoped*/, "projectrequests", "builds/details", "imagestreams/secrets",
"selfsubjectrulesreviews"},
openshiftStatusGroupName: {"imagestreams/status", "routes/status", "deploymentconfigs/status"},
quotaGroupName: {"limitranges", "resourcequotas", "resourcequotausages"},
kubeExposedGroupName: {"pods", "replicationcontrollers", "serviceaccounts", "services", "endpoints", "persistentvolumeclaims", "pods/log", "configmaps"},
kubeInternalsGroupName: {"minions", "nodes", "bindings", "events", "namespaces", "persistentvolumes", "securitycontextconstraints"},
kubeAllGroupName: {kubeInternalsGroupName, kubeExposedGroupName, quotaGroupName},
kubeStatusGroupName: {"pods/status", "resourcequotas/status", "namespaces/status", "replicationcontrollers/status"},
openshiftEscalatingViewableGroupName: {"oauthauthorizetokens", "oauthaccesstokens", "imagestreams/secrets"},
kubeEscalatingViewableGroupName: {"secrets"},
escalatingResourcesGroupName: {openshiftEscalatingViewableGroupName, kubeEscalatingViewableGroupName},
nonescalatingResourcesGroupName: {openshiftNonEscalatingViewableGroupName, kubeNonEscalatingViewableGroupName},
}
)
func init() {
// set the non-escalating groups
groupsToResources[openshiftNonEscalatingViewableGroupName] = NormalizeResources(sets.NewString(groupsToResources[openshiftAllGroupName]...)).
Difference(NormalizeResources(sets.NewString(groupsToResources[openshiftEscalatingViewableGroupName]...))).List()
groupsToResources[kubeNonEscalatingViewableGroupName] = NormalizeResources(sets.NewString(groupsToResources[kubeAllGroupName]...)).
Difference(NormalizeResources(sets.NewString(groupsToResources[kubeEscalatingViewableGroupName]...))).List()
}
+56
View File
@@ -0,0 +1,56 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// ClusterPolicyToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func ClusterPolicyToSelectableFields(policy *ClusterPolicy) fields.Set {
return fields.Set{
"metadata.name": policy.Name,
}
}
// ClusterPolicyBindingToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func ClusterPolicyBindingToSelectableFields(policyBinding *ClusterPolicyBinding) fields.Set {
return fields.Set{
"metadata.name": policyBinding.Name,
}
}
// PolicyToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func PolicyToSelectableFields(policy *Policy) fields.Set {
return fields.Set{
"metadata.name": policy.Name,
"metadata.namespace": policy.Namespace,
}
}
// PolicyBindingToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func PolicyBindingToSelectableFields(policyBinding *PolicyBinding) fields.Set {
return fields.Set{
"metadata.name": policyBinding.Name,
"metadata.namespace": policyBinding.Namespace,
"policyRef.namespace": policyBinding.PolicyRef.Namespace,
}
}
// RoleToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func RoleToSelectableFields(role *Role) fields.Set {
return fields.Set{
"metadata.name": role.Name,
"metadata.namespace": role.Namespace,
}
}
// RoleBindingToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func RoleBindingToSelectableFields(roleBinding *RoleBinding) fields.Set {
return fields.Set{
"metadata.name": roleBinding.Name,
"metadata.namespace": roleBinding.Namespace,
}
}
+337
View File
@@ -0,0 +1,337 @@
package api
import (
"fmt"
"sort"
"strings"
"unicode"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/auth/user"
"k8s.io/kubernetes/pkg/serviceaccount"
"k8s.io/kubernetes/pkg/util/sets"
// uservalidation "github.com/openshift/origin/pkg/user/api/validation"
)
// NormalizeResources expands all resource groups and forces all resources to lower case.
// If the rawResources are already normalized, it returns the original set to avoid the
// allocation and GC cost, since this is hit multiple times for every REST call.
// That means you should NEVER MODIFY THE RESULT of this call.
func NormalizeResources(rawResources sets.String) sets.String {
// we only need to expand groups if the exist and we don't create them with groups
// by default. Only accept the cost of expansion if we're doing work.
needsNormalization := false
for currResource := range rawResources {
if needsNormalizing(currResource) {
needsNormalization = true
break
}
}
if !needsNormalization {
return rawResources
}
ret := sets.String{}
toVisit := rawResources.List()
visited := sets.String{}
for i := 0; i < len(toVisit); i++ {
currResource := toVisit[i]
if visited.Has(currResource) {
continue
}
visited.Insert(currResource)
if !strings.HasPrefix(currResource, resourceGroupPrefix) {
ret.Insert(strings.ToLower(currResource))
continue
}
if resourceTypes, exists := groupsToResources[currResource]; exists {
toVisit = append(toVisit, resourceTypes...)
}
}
return ret
}
func needsNormalizing(in string) bool {
if strings.HasPrefix(in, resourceGroupPrefix) {
return true
}
for _, r := range in {
if unicode.IsUpper(r) {
return true
}
}
return false
}
func (r PolicyRule) String() string {
return "PolicyRule" + r.CompactString()
}
// CompactString exposes a compact string representation for use in escalation error messages
func (r PolicyRule) CompactString() string {
formatStringParts := []string{}
formatArgs := []interface{}{}
if len(r.Verbs) > 0 {
formatStringParts = append(formatStringParts, "Verbs:%q")
formatArgs = append(formatArgs, r.Verbs.List())
}
if len(r.APIGroups) > 0 {
formatStringParts = append(formatStringParts, "APIGroups:%q")
formatArgs = append(formatArgs, r.APIGroups)
}
if len(r.Resources) > 0 {
formatStringParts = append(formatStringParts, "Resources:%q")
formatArgs = append(formatArgs, r.Resources.List())
}
if len(r.ResourceNames) > 0 {
formatStringParts = append(formatStringParts, "ResourceNames:%q")
formatArgs = append(formatArgs, r.ResourceNames.List())
}
if r.AttributeRestrictions != nil {
formatStringParts = append(formatStringParts, "Restrictions:%q")
formatArgs = append(formatArgs, r.AttributeRestrictions)
}
if len(r.NonResourceURLs) > 0 {
formatStringParts = append(formatStringParts, "NonResourceURLs:%q")
formatArgs = append(formatArgs, r.NonResourceURLs.List())
}
formatString := "{" + strings.Join(formatStringParts, ", ") + "}"
return fmt.Sprintf(formatString, formatArgs...)
}
func getRoleBindingValues(roleBindingMap map[string]*RoleBinding) []*RoleBinding {
ret := []*RoleBinding{}
for _, currBinding := range roleBindingMap {
ret = append(ret, currBinding)
}
return ret
}
func SortRoleBindings(roleBindingMap map[string]*RoleBinding, reverse bool) []*RoleBinding {
roleBindings := getRoleBindingValues(roleBindingMap)
if reverse {
sort.Sort(sort.Reverse(RoleBindingSorter(roleBindings)))
} else {
sort.Sort(RoleBindingSorter(roleBindings))
}
return roleBindings
}
type PolicyBindingSorter []PolicyBinding
func (s PolicyBindingSorter) Len() int {
return len(s)
}
func (s PolicyBindingSorter) Less(i, j int) bool {
return s[i].Name < s[j].Name
}
func (s PolicyBindingSorter) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
type RoleBindingSorter []*RoleBinding
func (s RoleBindingSorter) Len() int {
return len(s)
}
func (s RoleBindingSorter) Less(i, j int) bool {
return s[i].Name < s[j].Name
}
func (s RoleBindingSorter) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func GetPolicyBindingName(policyRefNamespace string) string {
return fmt.Sprintf("%s:%s", policyRefNamespace, PolicyName)
}
var ClusterPolicyBindingName = GetPolicyBindingName("")
func BuildSubjects(users, groups []string, userNameValidator, groupNameValidator validation.ValidateNameFunc) []kapi.ObjectReference {
subjects := []kapi.ObjectReference{}
for _, user := range users {
saNamespace, saName, err := serviceaccount.SplitUsername(user)
if err == nil {
subjects = append(subjects, kapi.ObjectReference{Kind: ServiceAccountKind, Namespace: saNamespace, Name: saName})
continue
}
kind := UserKind
if len(userNameValidator(user, false)) != 0 {
kind = SystemUserKind
}
subjects = append(subjects, kapi.ObjectReference{Kind: kind, Name: user})
}
for _, group := range groups {
kind := GroupKind
if len(groupNameValidator(group, false)) != 0 {
kind = SystemGroupKind
}
subjects = append(subjects, kapi.ObjectReference{Kind: kind, Name: group})
}
return subjects
}
// StringSubjectsFor returns users and groups for comparison against user.Info. currentNamespace is used to
// to create usernames for service accounts where namespace=="".
func StringSubjectsFor(currentNamespace string, subjects []kapi.ObjectReference) ([]string, []string) {
// these MUST be nil to indicate empty
var users, groups []string
for _, subject := range subjects {
switch subject.Kind {
case ServiceAccountKind:
namespace := currentNamespace
if len(subject.Namespace) > 0 {
namespace = subject.Namespace
}
if len(namespace) > 0 {
users = append(users, serviceaccount.MakeUsername(namespace, subject.Name))
}
case UserKind, SystemUserKind:
users = append(users, subject.Name)
case GroupKind, SystemGroupKind:
groups = append(groups, subject.Name)
}
}
return users, groups
}
// SubjectsStrings returns users, groups, serviceaccounts, unknown for display purposes. currentNamespace is used to
// hide the subject.Namespace for ServiceAccounts in the currentNamespace
func SubjectsStrings(currentNamespace string, subjects []kapi.ObjectReference) ([]string, []string, []string, []string) {
users := []string{}
groups := []string{}
sas := []string{}
others := []string{}
for _, subject := range subjects {
switch subject.Kind {
case ServiceAccountKind:
if len(subject.Namespace) > 0 && currentNamespace != subject.Namespace {
sas = append(sas, subject.Namespace+"/"+subject.Name)
} else {
sas = append(sas, subject.Name)
}
case UserKind, SystemUserKind:
users = append(users, subject.Name)
case GroupKind, SystemGroupKind:
groups = append(groups, subject.Name)
default:
others = append(others, fmt.Sprintf("%s/%s/%s", subject.Kind, subject.Namespace, subject.Name))
}
}
return users, groups, sas, others
}
func AddUserToSAR(user user.Info, sar *SubjectAccessReview) *SubjectAccessReview {
origScopes := user.GetExtra()[ScopesKey]
scopes := make([]string, len(origScopes), len(origScopes))
copy(scopes, origScopes)
sar.User = user.GetName()
sar.Groups = sets.NewString(user.GetGroups()...)
sar.Scopes = scopes
return sar
}
func AddUserToLSAR(user user.Info, lsar *LocalSubjectAccessReview) *LocalSubjectAccessReview {
origScopes := user.GetExtra()[ScopesKey]
scopes := make([]string, len(origScopes), len(origScopes))
copy(scopes, origScopes)
lsar.User = user.GetName()
lsar.Groups = sets.NewString(user.GetGroups()...)
lsar.Scopes = scopes
return lsar
}
// +gencopy=false
// PolicyRuleBuilder let's us attach methods. A no-no for API types
type PolicyRuleBuilder struct {
PolicyRule PolicyRule
}
func NewRule(verbs ...string) *PolicyRuleBuilder {
return &PolicyRuleBuilder{
PolicyRule: PolicyRule{
Verbs: sets.NewString(verbs...),
Resources: sets.String{},
ResourceNames: sets.String{},
},
}
}
func (r *PolicyRuleBuilder) Groups(groups ...string) *PolicyRuleBuilder {
r.PolicyRule.APIGroups = append(r.PolicyRule.APIGroups, groups...)
return r
}
func (r *PolicyRuleBuilder) Resources(resources ...string) *PolicyRuleBuilder {
r.PolicyRule.Resources.Insert(resources...)
return r
}
func (r *PolicyRuleBuilder) Names(names ...string) *PolicyRuleBuilder {
r.PolicyRule.ResourceNames.Insert(names...)
return r
}
func (r *PolicyRuleBuilder) RuleOrDie() PolicyRule {
ret, err := r.Rule()
if err != nil {
panic(err)
}
return ret
}
func (r *PolicyRuleBuilder) Rule() (PolicyRule, error) {
if len(r.PolicyRule.Verbs) == 0 {
return PolicyRule{}, fmt.Errorf("verbs are required: %#v", r.PolicyRule)
}
switch {
case len(r.PolicyRule.NonResourceURLs) > 0:
if len(r.PolicyRule.APIGroups) != 0 || len(r.PolicyRule.Resources) != 0 || len(r.PolicyRule.ResourceNames) != 0 {
return PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule)
}
case len(r.PolicyRule.Resources) > 0:
if len(r.PolicyRule.NonResourceURLs) != 0 {
return PolicyRule{}, fmt.Errorf("resource rule may not have nonResourceURLs: %#v", r.PolicyRule)
}
if len(r.PolicyRule.APIGroups) == 0 {
return PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule)
}
default:
return PolicyRule{}, fmt.Errorf("a rule must have either nonResourceURLs or resources: %#v", r.PolicyRule)
}
return r.PolicyRule, nil
}
type SortableRuleSlice []PolicyRule
func (s SortableRuleSlice) Len() int { return len(s) }
func (s SortableRuleSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s SortableRuleSlice) Less(i, j int) bool {
return strings.Compare(s[i].String(), s[j].String()) < 0
}
+58
View File
@@ -0,0 +1,58 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&Role{},
&RoleBinding{},
&Policy{},
&PolicyBinding{},
&PolicyList{},
&PolicyBindingList{},
&RoleBindingList{},
&RoleList{},
&SelfSubjectRulesReview{},
&ResourceAccessReview{},
&SubjectAccessReview{},
&LocalResourceAccessReview{},
&LocalSubjectAccessReview{},
&ResourceAccessReviewResponse{},
&SubjectAccessReviewResponse{},
&IsPersonalSubjectAccessReview{},
&ClusterRole{},
&ClusterRoleBinding{},
&ClusterPolicy{},
&ClusterPolicyBinding{},
&ClusterPolicyList{},
&ClusterPolicyBindingList{},
&ClusterRoleBindingList{},
&ClusterRoleList{},
)
}
+15
View File
@@ -0,0 +1,15 @@
package api
// Synthetic authorization endpoints
const (
DockerBuildResource = "builds/docker"
SourceBuildResource = "builds/source"
CustomBuildResource = "builds/custom"
JenkinsPipelineBuildResource = "builds/jenkinspipeline"
NodeMetricsResource = "nodes/metrics"
NodeStatsResource = "nodes/stats"
NodeLogResource = "nodes/log"
RestrictedEndpointsResource = "endpoints/restricted"
)
+398
View File
@@ -0,0 +1,398 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
kruntime "k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/sets"
)
// Authorization is calculated against
// 1. all deny RoleBinding PolicyRules in the master namespace - short circuit on match
// 2. all allow RoleBinding PolicyRules in the master namespace - short circuit on match
// 3. all deny RoleBinding PolicyRules in the namespace - short circuit on match
// 4. all allow RoleBinding PolicyRules in the namespace - short circuit on match
// 5. deny by default
const (
// PolicyName is the name of Policy
PolicyName = "default"
APIGroupAll = "*"
ResourceAll = "*"
VerbAll = "*"
NonResourceAll = "*"
ScopesKey = "authorization.openshift.io/scopes"
ScopesAllNamespaces = "*"
UserKind = "User"
GroupKind = "Group"
ServiceAccountKind = "ServiceAccount"
SystemUserKind = "SystemUser"
SystemGroupKind = "SystemGroup"
UserResource = "users"
GroupResource = "groups"
ServiceAccountResource = "serviceaccounts"
SystemUserResource = "systemusers"
SystemGroupResource = "systemgroups"
)
// DiscoveryRule is a rule that allows a client to discover the API resources available on this server
var DiscoveryRule = PolicyRule{
Verbs: sets.NewString("get"),
NonResourceURLs: sets.NewString(
// Server version checking
"/version", "/version/*",
// API discovery/negotiation
"/api", "/api/*",
"/apis", "/apis/*",
"/oapi", "/oapi/*",
"/osapi", "/osapi/", // these cannot be removed until we can drop support for pre 3.1 clients
),
}
// PolicyRule holds information that describes a policy rule, but does not contain information
// about who the rule applies to or which namespace the rule applies to.
type PolicyRule struct {
// Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds.
Verbs sets.String
// AttributeRestrictions will vary depending on what the Authorizer/AuthorizationAttributeBuilder pair supports.
// If the Authorizer does not recognize how to handle the AttributeRestrictions, the Authorizer should report an error.
AttributeRestrictions kruntime.Object
// APIGroups is the name of the APIGroup that contains the resources. If this field is empty, then both kubernetes and origin API groups are assumed.
// That means that if an action is requested against one of the enumerated resources in either the kubernetes or the origin API group, the request
// will be allowed
APIGroups []string
// Resources is a list of resources this rule applies to. ResourceAll represents all resources.
Resources sets.String
// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.
ResourceNames sets.String
// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path
// If an action is not a resource API request, then the URL is split on '/' and is checked against the NonResourceURLs to look for a match.
NonResourceURLs sets.String
}
// IsPersonalSubjectAccessReview is a marker for PolicyRule.AttributeRestrictions that denotes that subjectaccessreviews on self should be allowed
type IsPersonalSubjectAccessReview struct {
unversioned.TypeMeta
}
// Role is a logical grouping of PolicyRules that can be referenced as a unit by RoleBindings.
type Role struct {
unversioned.TypeMeta
// Standard object's metadata.
kapi.ObjectMeta
// Rules holds all the PolicyRules for this Role
Rules []PolicyRule
}
// RoleBinding references a Role, but not contain it. It can reference any Role in the same namespace or in the global namespace.
// It adds who information via Users and Groups and namespace information by which namespace it exists in. RoleBindings in a given
// namespace only have effect in that namespace (excepting the master namespace which has power in all namespaces).
type RoleBinding struct {
unversioned.TypeMeta
kapi.ObjectMeta
// Subjects hold object references of to authorize with this rule
Subjects []kapi.ObjectReference
// RoleRef can only reference the current namespace and the global namespace
// If the RoleRef cannot be resolved, the Authorizer must return an error.
// Since Policy is a singleton, this is sufficient knowledge to locate a role
RoleRef kapi.ObjectReference
}
// +genclient=true
// Policy is a object that holds all the Roles for a particular namespace. There is at most
// one Policy document per namespace.
type Policy struct {
unversioned.TypeMeta
kapi.ObjectMeta
// LastModified is the last time that any part of the Policy was created, updated, or deleted
LastModified unversioned.Time
// Roles holds all the Roles held by this Policy, mapped by Role.Name
Roles map[string]*Role
}
// PolicyBinding is a object that holds all the RoleBindings for a particular namespace. There is
// one PolicyBinding document per referenced Policy namespace
type PolicyBinding struct {
unversioned.TypeMeta
// Standard object's metadata.
kapi.ObjectMeta
// LastModified is the last time that any part of the PolicyBinding was created, updated, or deleted
LastModified unversioned.Time
// PolicyRef is a reference to the Policy that contains all the Roles that this PolicyBinding's RoleBindings may reference
PolicyRef kapi.ObjectReference
// RoleBindings holds all the RoleBindings held by this PolicyBinding, mapped by RoleBinding.Name
RoleBindings map[string]*RoleBinding
}
// SelfSubjectRulesReview is a resource you can create to determine which actions you can perform in a namespace
type SelfSubjectRulesReview struct {
unversioned.TypeMeta
// Spec adds information about how to conduct the check
Spec SelfSubjectRulesReviewSpec
// Status is completed by the server to tell which permissions you have
Status SubjectRulesReviewStatus
}
// SelfSubjectRulesReviewSpec adds information about how to conduct the check
type SelfSubjectRulesReviewSpec struct {
// Scopes to use for the evaluation. Empty means "use the unscoped (full) permissions of the user/groups".
// Nil for a self-SubjectRulesReview, means "use the scopes on this request".
// Nil for a regular SubjectRulesReview, means the same as empty.
Scopes []string
}
// SubjectRulesReviewStatus is contains the result of a rules check
type SubjectRulesReviewStatus struct {
// Rules is the list of rules (no particular sort) that are allowed for the subject
Rules []PolicyRule
// EvaluationError can appear in combination with Rules. It means some error happened during evaluation
// that may have prevented additional rules from being populated.
EvaluationError string
}
// ResourceAccessReviewResponse describes who can perform the action
type ResourceAccessReviewResponse struct {
unversioned.TypeMeta
// Namespace is the namespace used for the access review
Namespace string
// Users is the list of users who can perform the action
Users sets.String
// Groups is the list of groups who can perform the action
Groups sets.String
// EvaluationError is an indication that some error occurred during resolution, but partial results can still be returned.
// It is entirely possible to get an error and be able to continue determine authorization status in spite of it. This is
// most common when a bound role is missing, but enough roles are still present and bound to reason about the request.
EvaluationError string
}
// ResourceAccessReview is a means to request a list of which users and groups are authorized to perform the
// action specified by spec
type ResourceAccessReview struct {
unversioned.TypeMeta
// Action describes the action being tested
Action AuthorizationAttributes
}
// SubjectAccessReviewResponse describes whether or not a user or group can perform an action
type SubjectAccessReviewResponse struct {
unversioned.TypeMeta
// Namespace is the namespace used for the access review
Namespace string
// Allowed is required. True if the action would be allowed, false otherwise.
Allowed bool
// Reason is optional. It indicates why a request was allowed or denied.
Reason string
}
// SubjectAccessReview is an object for requesting information about whether a user or group can perform an action
type SubjectAccessReview struct {
unversioned.TypeMeta
// Action describes the action being tested
Action AuthorizationAttributes
// User is optional. If both User and Groups are empty, the current authenticated user is used.
User string
// Groups is optional. Groups is the list of groups to which the User belongs.
Groups sets.String
// Scopes to use for the evaluation. Empty means "use the unscoped (full) permissions of the user/groups".
// Nil for a self-SAR, means "use the scopes on this request".
// Nil for a regular SAR, means the same as empty.
Scopes []string
}
// LocalResourceAccessReview is a means to request a list of which users and groups are authorized to perform the action specified by spec in a particular namespace
type LocalResourceAccessReview struct {
unversioned.TypeMeta
// Action describes the action being tested
Action AuthorizationAttributes
}
// LocalSubjectAccessReview is an object for requesting information about whether a user or group can perform an action in a particular namespace
type LocalSubjectAccessReview struct {
unversioned.TypeMeta
// Action describes the action being tested. The Namespace element is FORCED to the current namespace.
Action AuthorizationAttributes
// User is optional. If both User and Groups are empty, the current authenticated user is used.
User string
// Groups is optional. Groups is the list of groups to which the User belongs.
Groups sets.String
// Scopes to use for the evaluation. Empty means "use the unscoped (full) permissions of the user/groups".
// Nil for a self-SAR, means "use the scopes on this request".
// Nil for a regular SAR, means the same as empty.
Scopes []string
}
// AuthorizationAttributes describes a request to be authorized
type AuthorizationAttributes struct {
// Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
Namespace string
// Verb is one of: get, list, watch, create, update, delete
Verb string
// Group is the API group of the resource
Group string
// Version is the API version of the resource
Version string
// Resource is one of the existing resource types
Resource string
// ResourceName is the name of the resource being requested for a "get" or deleted for a "delete"
ResourceName string
// Content is the actual content of the request for create and update
Content kruntime.Object
}
// PolicyList is a collection of Policies
type PolicyList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of policies
Items []Policy
}
// PolicyBindingList is a collection of PolicyBindings
type PolicyBindingList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of policyBindings
Items []PolicyBinding
}
// RoleBindingList is a collection of RoleBindings
type RoleBindingList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of roleBindings
Items []RoleBinding
}
// RoleList is a collection of Roles
type RoleList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of roles
Items []Role
}
// ClusterRole is a logical grouping of PolicyRules that can be referenced as a unit by ClusterRoleBindings.
type ClusterRole struct {
unversioned.TypeMeta
// Standard object's metadata.
kapi.ObjectMeta
// Rules holds all the PolicyRules for this ClusterRole
Rules []PolicyRule
}
// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference any ClusterRole in the same namespace or in the global namespace.
// It adds who information via Users and Groups and namespace information by which namespace it exists in. ClusterRoleBindings in a given
// namespace only have effect in that namespace (excepting the master namespace which has power in all namespaces).
type ClusterRoleBinding struct {
unversioned.TypeMeta
// Standard object's metadata.
kapi.ObjectMeta
// Subjects hold object references of to authorize with this rule
Subjects []kapi.ObjectReference
// RoleRef can only reference the current namespace and the global namespace
// If the ClusterRoleRef cannot be resolved, the Authorizer must return an error.
// Since Policy is a singleton, this is sufficient knowledge to locate a role
RoleRef kapi.ObjectReference
}
// ClusterPolicy is a object that holds all the ClusterRoles for a particular namespace. There is at most
// one ClusterPolicy document per namespace.
type ClusterPolicy struct {
unversioned.TypeMeta
// Standard object's metadata.
kapi.ObjectMeta
// LastModified is the last time that any part of the ClusterPolicy was created, updated, or deleted
LastModified unversioned.Time
// Roles holds all the ClusterRoles held by this ClusterPolicy, mapped by Role.Name
Roles map[string]*ClusterRole
}
// ClusterPolicyBinding is a object that holds all the ClusterRoleBindings for a particular namespace. There is
// one ClusterPolicyBinding document per referenced ClusterPolicy namespace
type ClusterPolicyBinding struct {
unversioned.TypeMeta
// Standard object's metadata.
kapi.ObjectMeta
// LastModified is the last time that any part of the ClusterPolicyBinding was created, updated, or deleted
LastModified unversioned.Time
// ClusterPolicyRef is a reference to the ClusterPolicy that contains all the ClusterRoles that this ClusterPolicyBinding's RoleBindings may reference
PolicyRef kapi.ObjectReference
// RoleBindings holds all the RoleBindings held by this ClusterPolicyBinding, mapped by RoleBinding.Name
RoleBindings map[string]*ClusterRoleBinding
}
// ClusterPolicyList is a collection of ClusterPolicies
type ClusterPolicyList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of ClusterPolicies
Items []ClusterPolicy
}
// ClusterPolicyBindingList is a collection of ClusterPolicyBindings
type ClusterPolicyBindingList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of ClusterPolicyBindings
Items []ClusterPolicyBinding
}
// ClusterRoleBindingList is a collection of ClusterRoleBindings
type ClusterRoleBindingList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of ClusterRoleBindings
Items []ClusterRoleBinding
}
// ClusterRoleList is a collection of ClusterRoles
type ClusterRoleList struct {
unversioned.TypeMeta
// Standard object's metadata.
unversioned.ListMeta
// Items is a list of ClusterRoles
Items []ClusterRole
}
+937
View File
@@ -0,0 +1,937 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_BinaryBuildRequestOptions,
DeepCopy_api_BinaryBuildSource,
DeepCopy_api_Build,
DeepCopy_api_BuildConfig,
DeepCopy_api_BuildConfigList,
DeepCopy_api_BuildConfigSpec,
DeepCopy_api_BuildConfigStatus,
DeepCopy_api_BuildList,
DeepCopy_api_BuildLog,
DeepCopy_api_BuildLogOptions,
DeepCopy_api_BuildOutput,
DeepCopy_api_BuildPostCommitSpec,
DeepCopy_api_BuildRequest,
DeepCopy_api_BuildSource,
DeepCopy_api_BuildSpec,
DeepCopy_api_BuildStatus,
DeepCopy_api_BuildStrategy,
DeepCopy_api_BuildTriggerCause,
DeepCopy_api_BuildTriggerPolicy,
DeepCopy_api_CommonSpec,
DeepCopy_api_CustomBuildStrategy,
DeepCopy_api_DockerBuildStrategy,
DeepCopy_api_GenericWebHookCause,
DeepCopy_api_GenericWebHookEvent,
DeepCopy_api_GitBuildSource,
DeepCopy_api_GitHubWebHookCause,
DeepCopy_api_GitInfo,
DeepCopy_api_GitRefInfo,
DeepCopy_api_GitSourceRevision,
DeepCopy_api_ImageChangeCause,
DeepCopy_api_ImageChangeTrigger,
DeepCopy_api_ImageSource,
DeepCopy_api_ImageSourcePath,
DeepCopy_api_JenkinsPipelineBuildStrategy,
DeepCopy_api_SecretBuildSource,
DeepCopy_api_SecretSpec,
DeepCopy_api_SourceBuildStrategy,
DeepCopy_api_SourceControlUser,
DeepCopy_api_SourceRevision,
DeepCopy_api_WebHookTrigger,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_BinaryBuildRequestOptions(in BinaryBuildRequestOptions, out *BinaryBuildRequestOptions, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.AsFile = in.AsFile
out.Commit = in.Commit
out.Message = in.Message
out.AuthorName = in.AuthorName
out.AuthorEmail = in.AuthorEmail
out.CommitterName = in.CommitterName
out.CommitterEmail = in.CommitterEmail
return nil
}
func DeepCopy_api_BinaryBuildSource(in BinaryBuildSource, out *BinaryBuildSource, c *conversion.Cloner) error {
out.AsFile = in.AsFile
return nil
}
func DeepCopy_api_Build(in Build, out *Build, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_api_BuildSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_BuildStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_BuildConfig(in BuildConfig, out *BuildConfig, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_api_BuildConfigSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_BuildConfigStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_BuildConfigList(in BuildConfigList, out *BuildConfigList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]BuildConfig, len(in))
for i := range in {
if err := DeepCopy_api_BuildConfig(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_BuildConfigSpec(in BuildConfigSpec, out *BuildConfigSpec, c *conversion.Cloner) error {
if in.Triggers != nil {
in, out := in.Triggers, &out.Triggers
*out = make([]BuildTriggerPolicy, len(in))
for i := range in {
if err := DeepCopy_api_BuildTriggerPolicy(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Triggers = nil
}
out.RunPolicy = in.RunPolicy
if err := DeepCopy_api_CommonSpec(in.CommonSpec, &out.CommonSpec, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_BuildConfigStatus(in BuildConfigStatus, out *BuildConfigStatus, c *conversion.Cloner) error {
out.LastVersion = in.LastVersion
return nil
}
func DeepCopy_api_BuildList(in BuildList, out *BuildList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Build, len(in))
for i := range in {
if err := DeepCopy_api_Build(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_BuildLog(in BuildLog, out *BuildLog, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_BuildLogOptions(in BuildLogOptions, out *BuildLogOptions, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Container = in.Container
out.Follow = in.Follow
out.Previous = in.Previous
if in.SinceSeconds != nil {
in, out := in.SinceSeconds, &out.SinceSeconds
*out = new(int64)
**out = *in
} else {
out.SinceSeconds = nil
}
if in.SinceTime != nil {
in, out := in.SinceTime, &out.SinceTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.SinceTime = nil
}
out.Timestamps = in.Timestamps
if in.TailLines != nil {
in, out := in.TailLines, &out.TailLines
*out = new(int64)
**out = *in
} else {
out.TailLines = nil
}
if in.LimitBytes != nil {
in, out := in.LimitBytes, &out.LimitBytes
*out = new(int64)
**out = *in
} else {
out.LimitBytes = nil
}
out.NoWait = in.NoWait
if in.Version != nil {
in, out := in.Version, &out.Version
*out = new(int64)
**out = *in
} else {
out.Version = nil
}
return nil
}
func DeepCopy_api_BuildOutput(in BuildOutput, out *BuildOutput, c *conversion.Cloner) error {
if in.To != nil {
in, out := in.To, &out.To
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.To = nil
}
if in.PushSecret != nil {
in, out := in.PushSecret, &out.PushSecret
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.PushSecret = nil
}
return nil
}
func DeepCopy_api_BuildPostCommitSpec(in BuildPostCommitSpec, out *BuildPostCommitSpec, c *conversion.Cloner) error {
if in.Command != nil {
in, out := in.Command, &out.Command
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Command = nil
}
if in.Args != nil {
in, out := in.Args, &out.Args
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Args = nil
}
out.Script = in.Script
return nil
}
func DeepCopy_api_BuildRequest(in BuildRequest, out *BuildRequest, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.Revision != nil {
in, out := in.Revision, &out.Revision
*out = new(SourceRevision)
if err := DeepCopy_api_SourceRevision(*in, *out, c); err != nil {
return err
}
} else {
out.Revision = nil
}
if in.TriggeredByImage != nil {
in, out := in.TriggeredByImage, &out.TriggeredByImage
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.TriggeredByImage = nil
}
if in.From != nil {
in, out := in.From, &out.From
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.From = nil
}
if in.Binary != nil {
in, out := in.Binary, &out.Binary
*out = new(BinaryBuildSource)
if err := DeepCopy_api_BinaryBuildSource(*in, *out, c); err != nil {
return err
}
} else {
out.Binary = nil
}
if in.LastVersion != nil {
in, out := in.LastVersion, &out.LastVersion
*out = new(int64)
**out = *in
} else {
out.LastVersion = nil
}
if in.Env != nil {
in, out := in.Env, &out.Env
*out = make([]api.EnvVar, len(in))
for i := range in {
if err := api.DeepCopy_api_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Env = nil
}
if in.TriggeredBy != nil {
in, out := in.TriggeredBy, &out.TriggeredBy
*out = make([]BuildTriggerCause, len(in))
for i := range in {
if err := DeepCopy_api_BuildTriggerCause(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.TriggeredBy = nil
}
return nil
}
func DeepCopy_api_BuildSource(in BuildSource, out *BuildSource, c *conversion.Cloner) error {
if in.Binary != nil {
in, out := in.Binary, &out.Binary
*out = new(BinaryBuildSource)
if err := DeepCopy_api_BinaryBuildSource(*in, *out, c); err != nil {
return err
}
} else {
out.Binary = nil
}
if in.Dockerfile != nil {
in, out := in.Dockerfile, &out.Dockerfile
*out = new(string)
**out = *in
} else {
out.Dockerfile = nil
}
if in.Git != nil {
in, out := in.Git, &out.Git
*out = new(GitBuildSource)
if err := DeepCopy_api_GitBuildSource(*in, *out, c); err != nil {
return err
}
} else {
out.Git = nil
}
if in.Images != nil {
in, out := in.Images, &out.Images
*out = make([]ImageSource, len(in))
for i := range in {
if err := DeepCopy_api_ImageSource(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Images = nil
}
out.ContextDir = in.ContextDir
if in.SourceSecret != nil {
in, out := in.SourceSecret, &out.SourceSecret
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.SourceSecret = nil
}
if in.Secrets != nil {
in, out := in.Secrets, &out.Secrets
*out = make([]SecretBuildSource, len(in))
for i := range in {
if err := DeepCopy_api_SecretBuildSource(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Secrets = nil
}
return nil
}
func DeepCopy_api_BuildSpec(in BuildSpec, out *BuildSpec, c *conversion.Cloner) error {
if err := DeepCopy_api_CommonSpec(in.CommonSpec, &out.CommonSpec, c); err != nil {
return err
}
if in.TriggeredBy != nil {
in, out := in.TriggeredBy, &out.TriggeredBy
*out = make([]BuildTriggerCause, len(in))
for i := range in {
if err := DeepCopy_api_BuildTriggerCause(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.TriggeredBy = nil
}
return nil
}
func DeepCopy_api_BuildStatus(in BuildStatus, out *BuildStatus, c *conversion.Cloner) error {
out.Phase = in.Phase
out.Cancelled = in.Cancelled
out.Reason = in.Reason
out.Message = in.Message
if in.StartTimestamp != nil {
in, out := in.StartTimestamp, &out.StartTimestamp
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.StartTimestamp = nil
}
if in.CompletionTimestamp != nil {
in, out := in.CompletionTimestamp, &out.CompletionTimestamp
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.CompletionTimestamp = nil
}
out.Duration = in.Duration
out.OutputDockerImageReference = in.OutputDockerImageReference
if in.Config != nil {
in, out := in.Config, &out.Config
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.Config = nil
}
return nil
}
func DeepCopy_api_BuildStrategy(in BuildStrategy, out *BuildStrategy, c *conversion.Cloner) error {
if in.DockerStrategy != nil {
in, out := in.DockerStrategy, &out.DockerStrategy
*out = new(DockerBuildStrategy)
if err := DeepCopy_api_DockerBuildStrategy(*in, *out, c); err != nil {
return err
}
} else {
out.DockerStrategy = nil
}
if in.SourceStrategy != nil {
in, out := in.SourceStrategy, &out.SourceStrategy
*out = new(SourceBuildStrategy)
if err := DeepCopy_api_SourceBuildStrategy(*in, *out, c); err != nil {
return err
}
} else {
out.SourceStrategy = nil
}
if in.CustomStrategy != nil {
in, out := in.CustomStrategy, &out.CustomStrategy
*out = new(CustomBuildStrategy)
if err := DeepCopy_api_CustomBuildStrategy(*in, *out, c); err != nil {
return err
}
} else {
out.CustomStrategy = nil
}
if in.JenkinsPipelineStrategy != nil {
in, out := in.JenkinsPipelineStrategy, &out.JenkinsPipelineStrategy
*out = new(JenkinsPipelineBuildStrategy)
if err := DeepCopy_api_JenkinsPipelineBuildStrategy(*in, *out, c); err != nil {
return err
}
} else {
out.JenkinsPipelineStrategy = nil
}
return nil
}
func DeepCopy_api_BuildTriggerCause(in BuildTriggerCause, out *BuildTriggerCause, c *conversion.Cloner) error {
out.Message = in.Message
if in.GenericWebHook != nil {
in, out := in.GenericWebHook, &out.GenericWebHook
*out = new(GenericWebHookCause)
if err := DeepCopy_api_GenericWebHookCause(*in, *out, c); err != nil {
return err
}
} else {
out.GenericWebHook = nil
}
if in.GitHubWebHook != nil {
in, out := in.GitHubWebHook, &out.GitHubWebHook
*out = new(GitHubWebHookCause)
if err := DeepCopy_api_GitHubWebHookCause(*in, *out, c); err != nil {
return err
}
} else {
out.GitHubWebHook = nil
}
if in.ImageChangeBuild != nil {
in, out := in.ImageChangeBuild, &out.ImageChangeBuild
*out = new(ImageChangeCause)
if err := DeepCopy_api_ImageChangeCause(*in, *out, c); err != nil {
return err
}
} else {
out.ImageChangeBuild = nil
}
return nil
}
func DeepCopy_api_BuildTriggerPolicy(in BuildTriggerPolicy, out *BuildTriggerPolicy, c *conversion.Cloner) error {
out.Type = in.Type
if in.GitHubWebHook != nil {
in, out := in.GitHubWebHook, &out.GitHubWebHook
*out = new(WebHookTrigger)
if err := DeepCopy_api_WebHookTrigger(*in, *out, c); err != nil {
return err
}
} else {
out.GitHubWebHook = nil
}
if in.GenericWebHook != nil {
in, out := in.GenericWebHook, &out.GenericWebHook
*out = new(WebHookTrigger)
if err := DeepCopy_api_WebHookTrigger(*in, *out, c); err != nil {
return err
}
} else {
out.GenericWebHook = nil
}
if in.ImageChange != nil {
in, out := in.ImageChange, &out.ImageChange
*out = new(ImageChangeTrigger)
if err := DeepCopy_api_ImageChangeTrigger(*in, *out, c); err != nil {
return err
}
} else {
out.ImageChange = nil
}
return nil
}
func DeepCopy_api_CommonSpec(in CommonSpec, out *CommonSpec, c *conversion.Cloner) error {
out.ServiceAccount = in.ServiceAccount
if err := DeepCopy_api_BuildSource(in.Source, &out.Source, c); err != nil {
return err
}
if in.Revision != nil {
in, out := in.Revision, &out.Revision
*out = new(SourceRevision)
if err := DeepCopy_api_SourceRevision(*in, *out, c); err != nil {
return err
}
} else {
out.Revision = nil
}
if err := DeepCopy_api_BuildStrategy(in.Strategy, &out.Strategy, c); err != nil {
return err
}
if err := DeepCopy_api_BuildOutput(in.Output, &out.Output, c); err != nil {
return err
}
if err := api.DeepCopy_api_ResourceRequirements(in.Resources, &out.Resources, c); err != nil {
return err
}
if err := DeepCopy_api_BuildPostCommitSpec(in.PostCommit, &out.PostCommit, c); err != nil {
return err
}
if in.CompletionDeadlineSeconds != nil {
in, out := in.CompletionDeadlineSeconds, &out.CompletionDeadlineSeconds
*out = new(int64)
**out = *in
} else {
out.CompletionDeadlineSeconds = nil
}
return nil
}
func DeepCopy_api_CustomBuildStrategy(in CustomBuildStrategy, out *CustomBuildStrategy, c *conversion.Cloner) error {
if err := api.DeepCopy_api_ObjectReference(in.From, &out.From, c); err != nil {
return err
}
if in.PullSecret != nil {
in, out := in.PullSecret, &out.PullSecret
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.PullSecret = nil
}
if in.Env != nil {
in, out := in.Env, &out.Env
*out = make([]api.EnvVar, len(in))
for i := range in {
if err := api.DeepCopy_api_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Env = nil
}
out.ExposeDockerSocket = in.ExposeDockerSocket
out.ForcePull = in.ForcePull
if in.Secrets != nil {
in, out := in.Secrets, &out.Secrets
*out = make([]SecretSpec, len(in))
for i := range in {
if err := DeepCopy_api_SecretSpec(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Secrets = nil
}
out.BuildAPIVersion = in.BuildAPIVersion
return nil
}
func DeepCopy_api_DockerBuildStrategy(in DockerBuildStrategy, out *DockerBuildStrategy, c *conversion.Cloner) error {
if in.From != nil {
in, out := in.From, &out.From
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.From = nil
}
if in.PullSecret != nil {
in, out := in.PullSecret, &out.PullSecret
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.PullSecret = nil
}
out.NoCache = in.NoCache
if in.Env != nil {
in, out := in.Env, &out.Env
*out = make([]api.EnvVar, len(in))
for i := range in {
if err := api.DeepCopy_api_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Env = nil
}
out.ForcePull = in.ForcePull
out.DockerfilePath = in.DockerfilePath
return nil
}
func DeepCopy_api_GenericWebHookCause(in GenericWebHookCause, out *GenericWebHookCause, c *conversion.Cloner) error {
if in.Revision != nil {
in, out := in.Revision, &out.Revision
*out = new(SourceRevision)
if err := DeepCopy_api_SourceRevision(*in, *out, c); err != nil {
return err
}
} else {
out.Revision = nil
}
out.Secret = in.Secret
return nil
}
func DeepCopy_api_GenericWebHookEvent(in GenericWebHookEvent, out *GenericWebHookEvent, c *conversion.Cloner) error {
if in.Git != nil {
in, out := in.Git, &out.Git
*out = new(GitInfo)
if err := DeepCopy_api_GitInfo(*in, *out, c); err != nil {
return err
}
} else {
out.Git = nil
}
if in.Env != nil {
in, out := in.Env, &out.Env
*out = make([]api.EnvVar, len(in))
for i := range in {
if err := api.DeepCopy_api_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Env = nil
}
return nil
}
func DeepCopy_api_GitBuildSource(in GitBuildSource, out *GitBuildSource, c *conversion.Cloner) error {
out.URI = in.URI
out.Ref = in.Ref
if in.HTTPProxy != nil {
in, out := in.HTTPProxy, &out.HTTPProxy
*out = new(string)
**out = *in
} else {
out.HTTPProxy = nil
}
if in.HTTPSProxy != nil {
in, out := in.HTTPSProxy, &out.HTTPSProxy
*out = new(string)
**out = *in
} else {
out.HTTPSProxy = nil
}
return nil
}
func DeepCopy_api_GitHubWebHookCause(in GitHubWebHookCause, out *GitHubWebHookCause, c *conversion.Cloner) error {
if in.Revision != nil {
in, out := in.Revision, &out.Revision
*out = new(SourceRevision)
if err := DeepCopy_api_SourceRevision(*in, *out, c); err != nil {
return err
}
} else {
out.Revision = nil
}
out.Secret = in.Secret
return nil
}
func DeepCopy_api_GitInfo(in GitInfo, out *GitInfo, c *conversion.Cloner) error {
if err := DeepCopy_api_GitBuildSource(in.GitBuildSource, &out.GitBuildSource, c); err != nil {
return err
}
if err := DeepCopy_api_GitSourceRevision(in.GitSourceRevision, &out.GitSourceRevision, c); err != nil {
return err
}
if in.Refs != nil {
in, out := in.Refs, &out.Refs
*out = make([]GitRefInfo, len(in))
for i := range in {
if err := DeepCopy_api_GitRefInfo(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Refs = nil
}
return nil
}
func DeepCopy_api_GitRefInfo(in GitRefInfo, out *GitRefInfo, c *conversion.Cloner) error {
if err := DeepCopy_api_GitBuildSource(in.GitBuildSource, &out.GitBuildSource, c); err != nil {
return err
}
if err := DeepCopy_api_GitSourceRevision(in.GitSourceRevision, &out.GitSourceRevision, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_GitSourceRevision(in GitSourceRevision, out *GitSourceRevision, c *conversion.Cloner) error {
out.Commit = in.Commit
if err := DeepCopy_api_SourceControlUser(in.Author, &out.Author, c); err != nil {
return err
}
if err := DeepCopy_api_SourceControlUser(in.Committer, &out.Committer, c); err != nil {
return err
}
out.Message = in.Message
return nil
}
func DeepCopy_api_ImageChangeCause(in ImageChangeCause, out *ImageChangeCause, c *conversion.Cloner) error {
out.ImageID = in.ImageID
if in.FromRef != nil {
in, out := in.FromRef, &out.FromRef
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.FromRef = nil
}
return nil
}
func DeepCopy_api_ImageChangeTrigger(in ImageChangeTrigger, out *ImageChangeTrigger, c *conversion.Cloner) error {
out.LastTriggeredImageID = in.LastTriggeredImageID
if in.From != nil {
in, out := in.From, &out.From
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.From = nil
}
return nil
}
func DeepCopy_api_ImageSource(in ImageSource, out *ImageSource, c *conversion.Cloner) error {
if err := api.DeepCopy_api_ObjectReference(in.From, &out.From, c); err != nil {
return err
}
if in.Paths != nil {
in, out := in.Paths, &out.Paths
*out = make([]ImageSourcePath, len(in))
for i := range in {
if err := DeepCopy_api_ImageSourcePath(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Paths = nil
}
if in.PullSecret != nil {
in, out := in.PullSecret, &out.PullSecret
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.PullSecret = nil
}
return nil
}
func DeepCopy_api_ImageSourcePath(in ImageSourcePath, out *ImageSourcePath, c *conversion.Cloner) error {
out.SourcePath = in.SourcePath
out.DestinationDir = in.DestinationDir
return nil
}
func DeepCopy_api_JenkinsPipelineBuildStrategy(in JenkinsPipelineBuildStrategy, out *JenkinsPipelineBuildStrategy, c *conversion.Cloner) error {
out.JenkinsfilePath = in.JenkinsfilePath
out.Jenkinsfile = in.Jenkinsfile
return nil
}
func DeepCopy_api_SecretBuildSource(in SecretBuildSource, out *SecretBuildSource, c *conversion.Cloner) error {
if err := api.DeepCopy_api_LocalObjectReference(in.Secret, &out.Secret, c); err != nil {
return err
}
out.DestinationDir = in.DestinationDir
return nil
}
func DeepCopy_api_SecretSpec(in SecretSpec, out *SecretSpec, c *conversion.Cloner) error {
if err := api.DeepCopy_api_LocalObjectReference(in.SecretSource, &out.SecretSource, c); err != nil {
return err
}
out.MountPath = in.MountPath
return nil
}
func DeepCopy_api_SourceBuildStrategy(in SourceBuildStrategy, out *SourceBuildStrategy, c *conversion.Cloner) error {
if err := api.DeepCopy_api_ObjectReference(in.From, &out.From, c); err != nil {
return err
}
if in.PullSecret != nil {
in, out := in.PullSecret, &out.PullSecret
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.PullSecret = nil
}
if in.Env != nil {
in, out := in.Env, &out.Env
*out = make([]api.EnvVar, len(in))
for i := range in {
if err := api.DeepCopy_api_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Env = nil
}
out.Scripts = in.Scripts
out.Incremental = in.Incremental
out.ForcePull = in.ForcePull
return nil
}
func DeepCopy_api_SourceControlUser(in SourceControlUser, out *SourceControlUser, c *conversion.Cloner) error {
out.Name = in.Name
out.Email = in.Email
return nil
}
func DeepCopy_api_SourceRevision(in SourceRevision, out *SourceRevision, c *conversion.Cloner) error {
if in.Git != nil {
in, out := in.Git, &out.Git
*out = new(GitSourceRevision)
if err := DeepCopy_api_GitSourceRevision(*in, *out, c); err != nil {
return err
}
} else {
out.Git = nil
}
return nil
}
func DeepCopy_api_WebHookTrigger(in WebHookTrigger, out *WebHookTrigger, c *conversion.Cloner) error {
out.Secret = in.Secret
out.AllowEnv = in.AllowEnv
return nil
}
+23
View File
@@ -0,0 +1,23 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// BuildToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func BuildToSelectableFields(build *Build) fields.Set {
return fields.Set{
"metadata.name": build.Name,
"metadata.namespace": build.Namespace,
"status": string(build.Status.Phase),
"podName": GetBuildPodName(build),
}
}
// BuildConfigToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func BuildConfigToSelectableFields(buildConfig *BuildConfig) fields.Set {
return fields.Set{
"metadata.name": buildConfig.Name,
"metadata.namespace": buildConfig.Namespace,
}
}
+61
View File
@@ -0,0 +1,61 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
)
// BuildToPodLogOptions builds a PodLogOptions object out of a BuildLogOptions.
// Currently BuildLogOptions.Container and BuildLogOptions.Previous aren't used
// so they won't be copied to PodLogOptions.
func BuildToPodLogOptions(opts *BuildLogOptions) *kapi.PodLogOptions {
return &kapi.PodLogOptions{
Follow: opts.Follow,
SinceSeconds: opts.SinceSeconds,
SinceTime: opts.SinceTime,
Timestamps: opts.Timestamps,
TailLines: opts.TailLines,
LimitBytes: opts.LimitBytes,
}
}
// PredicateFunc is testing an argument and decides does it meet some criteria or not.
// It can be used for filtering elements based on some conditions.
type PredicateFunc func(interface{}) bool
// FilterBuilds returns array of builds that satisfies predicate function.
func FilterBuilds(builds []Build, predicate PredicateFunc) []Build {
if len(builds) == 0 {
return builds
}
result := make([]Build, 0)
for _, build := range builds {
if predicate(build) {
result = append(result, build)
}
}
return result
}
// ByBuildConfigPredicate matches all builds that have build config annotation or label with specified value.
func ByBuildConfigPredicate(labelValue string) PredicateFunc {
return func(arg interface{}) bool {
return (hasBuildConfigAnnotation(arg.(Build), BuildConfigAnnotation, labelValue) ||
hasBuildConfigLabel(arg.(Build), BuildConfigLabel, labelValue) ||
hasBuildConfigLabel(arg.(Build), BuildConfigLabelDeprecated, labelValue))
}
}
func hasBuildConfigLabel(build Build, labelName, labelValue string) bool {
value, ok := build.Labels[labelName]
return ok && value == labelValue
}
func hasBuildConfigAnnotation(build Build, annotationName, annotationValue string) bool {
if build.Annotations == nil {
return false
}
value, ok := build.Annotations[annotationName]
return ok && value == annotationValue
}
+49
View File
@@ -0,0 +1,49 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&Build{},
&BuildList{},
&BuildConfig{},
&BuildConfigList{},
&BuildLog{},
&BuildRequest{},
&BuildLogOptions{},
&BinaryBuildRequestOptions{},
)
}
func (obj *Build) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BuildList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BuildConfig) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BuildConfigList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BuildLog) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BuildRequest) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BuildLogOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *BinaryBuildRequestOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+33
View File
@@ -0,0 +1,33 @@
package api
// BuildSliceByCreationTimestamp implements sort.Interface for []Build
// based on the CreationTimestamp field.
type BuildSliceByCreationTimestamp []Build
func (b BuildSliceByCreationTimestamp) Len() int {
return len(b)
}
func (b BuildSliceByCreationTimestamp) Less(i, j int) bool {
return b[i].CreationTimestamp.Before(b[j].CreationTimestamp)
}
func (b BuildSliceByCreationTimestamp) Swap(i, j int) {
b[i], b[j] = b[j], b[i]
}
// BuildPtrSliceByCreationTimestamp implements sort.Interface for []*Build
// based on the CreationTimestamp field.
type BuildPtrSliceByCreationTimestamp []*Build
func (b BuildPtrSliceByCreationTimestamp) Len() int {
return len(b)
}
func (b BuildPtrSliceByCreationTimestamp) Less(i, j int) bool {
return b[i].CreationTimestamp.Before(b[j].CreationTimestamp)
}
func (b BuildPtrSliceByCreationTimestamp) Swap(i, j int) {
b[i], b[j] = b[j], b[i]
}
+915
View File
@@ -0,0 +1,915 @@
package api
import (
"time"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util/sets"
)
const (
// BuildAnnotation is an annotation that identifies a Pod as being for a Build
BuildAnnotation = "openshift.io/build.name"
// BuildConfigAnnotation is an annotation that identifies the BuildConfig that a Build was created from
BuildConfigAnnotation = "openshift.io/build-config.name"
// BuildNumberAnnotation is an annotation whose value is the sequential number for this Build
BuildNumberAnnotation = "openshift.io/build.number"
// BuildCloneAnnotation is an annotation whose value is the name of the build this build was cloned from
BuildCloneAnnotation = "openshift.io/build.clone-of"
// BuildPodNameAnnotation is an annotation whose value is the name of the pod running this build
BuildPodNameAnnotation = "openshift.io/build.pod-name"
// BuildLabel is the key of a Pod label whose value is the Name of a Build which is run.
// NOTE: The value for this label may not contain the entire Build name because it will be
// truncated to maximum label length.
BuildLabel = "openshift.io/build.name"
// BuildRunPolicyLabel represents the start policy used to to start the build.
BuildRunPolicyLabel = "openshift.io/build.start-policy"
// DefaultDockerLabelNamespace is the key of a Build label, whose values are build metadata.
DefaultDockerLabelNamespace = "io.openshift."
// OriginVersion is an environment variable key that indicates the version of origin that
// created this build definition.
OriginVersion = "ORIGIN_VERSION"
// AllowedUIDs is an environment variable that contains ranges of UIDs that are allowed in
// Source builder images
AllowedUIDs = "ALLOWED_UIDS"
// DropCapabilities is an environment variable that contains a list of capabilities to drop when
// executing a Source build
DropCapabilities = "DROP_CAPS"
// BuildConfigLabel is the key of a Build label whose value is the ID of a BuildConfig
// on which the Build is based. NOTE: The value for this label may not contain the entire
// BuildConfig name because it will be truncated to maximum label length.
BuildConfigLabel = "openshift.io/build-config.name"
// BuildConfigLabelDeprecated was used as BuildConfigLabel before adding namespaces.
// We keep it for backward compatibility.
BuildConfigLabelDeprecated = "buildconfig"
// BuildConfigPausedAnnotation is an annotation that marks a BuildConfig as paused.
// New Builds cannot be instantiated from a paused BuildConfig.
BuildConfigPausedAnnotation = "openshift.io/build-config.paused"
)
// +genclient=true
// Build encapsulates the inputs needed to produce a new deployable image, as well as
// the status of the execution and a reference to the Pod which executed the build.
type Build struct {
unversioned.TypeMeta
kapi.ObjectMeta
// Spec is all the inputs used to execute the build.
Spec BuildSpec
// Status is the current status of the build.
Status BuildStatus
}
// BuildSpec encapsulates all the inputs necessary to represent a build.
type BuildSpec struct {
CommonSpec
// TriggeredBy describes which triggers started the most recent update to the
// build configuration and contains information about those triggers.
TriggeredBy []BuildTriggerCause
}
// CommonSpec encapsulates all common fields between Build and BuildConfig.
type CommonSpec struct {
// ServiceAccount is the name of the ServiceAccount to use to run the pod
// created by this build.
// The pod will be allowed to use secrets referenced by the ServiceAccount.
ServiceAccount string
// Source describes the SCM in use.
Source BuildSource
// Revision is the information from the source for a specific repo
// snapshot.
// This is optional.
Revision *SourceRevision
// Strategy defines how to perform a build.
Strategy BuildStrategy
// Output describes the Docker image the Strategy should produce.
Output BuildOutput
// Resources computes resource requirements to execute the build.
Resources kapi.ResourceRequirements
// PostCommit is a build hook executed after the build output image is
// committed, before it is pushed to a registry.
PostCommit BuildPostCommitSpec
// CompletionDeadlineSeconds is an optional duration in seconds, counted from
// the time when a build pod gets scheduled in the system, that the build may
// be active on a node before the system actively tries to terminate the
// build; value must be positive integer.
CompletionDeadlineSeconds *int64
}
// BuildTriggerCause holds information about a triggered build. It is used for
// displaying build trigger data for each build and build configuration in oc
// describe. It is also used to describe which triggers led to the most recent
// update in the build configuration.
type BuildTriggerCause struct {
// Message is used to store a human readable message for why the build was
// triggered. E.g.: "Manually triggered by user", "Configuration change",etc.
Message string
// genericWebHook represents data for a generic webhook that fired a
// specific build.
GenericWebHook *GenericWebHookCause
// GitHubWebHook represents data for a GitHub webhook that fired a specific
// build.
GitHubWebHook *GitHubWebHookCause
// ImageChangeBuild stores information about an imagechange event that
// triggered a new build.
ImageChangeBuild *ImageChangeCause
}
// GenericWebHookCause holds information about a generic WebHook that
// triggered a build.
type GenericWebHookCause struct {
// Revision is an optional field that stores the git source revision
// information of the generic webhook trigger when it is available.
Revision *SourceRevision
// Secret is the obfuscated webhook secret that triggered a build.
Secret string
}
// GitHubWebHookCause has information about a GitHub webhook that triggered a
// build.
type GitHubWebHookCause struct {
// Revision is the git source revision information of the trigger.
Revision *SourceRevision
// Secret is the obfuscated webhook secret that triggered a build.
Secret string
}
// ImageChangeCause contains information about the image that triggered a
// build.
type ImageChangeCause struct {
// ImageID is the ID of the image that triggered a a new build.
ImageID string
// FromRef contains detailed information about an image that triggered a
// build
FromRef *kapi.ObjectReference
}
// BuildStatus contains the status of a build
type BuildStatus struct {
// Phase is the point in the build lifecycle.
Phase BuildPhase
// Cancelled describes if a cancel event was triggered for the build.
Cancelled bool
// Reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.
Reason StatusReason
// Message is a human-readable message indicating details about why the build has this status.
Message string
// StartTimestamp is a timestamp representing the server time when this Build started
// running in a Pod.
// It is represented in RFC3339 form and is in UTC.
StartTimestamp *unversioned.Time
// CompletionTimestamp is a timestamp representing the server time when this Build was
// finished, whether that build failed or succeeded. It reflects the time at which
// the Pod running the Build terminated.
// It is represented in RFC3339 form and is in UTC.
CompletionTimestamp *unversioned.Time
// Duration contains time.Duration object describing build time.
Duration time.Duration
// OutputDockerImageReference contains a reference to the Docker image that
// will be built by this build. It's value is computed from
// Build.Spec.Output.To, and should include the registry address, so that
// it can be used to push and pull the image.
OutputDockerImageReference string
// Config is an ObjectReference to the BuildConfig this Build is based on.
Config *kapi.ObjectReference
}
// BuildPhase represents the status of a build at a point in time.
type BuildPhase string
// Valid values for BuildPhase.
const (
// BuildPhaseNew is automatically assigned to a newly created build.
BuildPhaseNew BuildPhase = "New"
// BuildPhasePending indicates that a pod name has been assigned and a build is
// about to start running.
BuildPhasePending BuildPhase = "Pending"
// BuildPhaseRunning indicates that a pod has been created and a build is running.
BuildPhaseRunning BuildPhase = "Running"
// BuildPhaseComplete indicates that a build has been successful.
BuildPhaseComplete BuildPhase = "Complete"
// BuildPhaseFailed indicates that a build has executed and failed.
BuildPhaseFailed BuildPhase = "Failed"
// BuildPhaseError indicates that an error prevented the build from executing.
BuildPhaseError BuildPhase = "Error"
// BuildPhaseCancelled indicates that a running/pending build was stopped from executing.
BuildPhaseCancelled BuildPhase = "Cancelled"
)
// StatusReason is a brief CamelCase string that describes a temporary or
// permanent build error condition, meant for machine parsing and tidy display
// in the CLI.
type StatusReason string
// These are the valid reasons of build statuses.
const (
// StatusReasonError is a generic reason for a build error condition.
StatusReasonError StatusReason = "Error"
// StatusReasonCannotCreateBuildPodSpec is an error condition when the build
// strategy cannot create a build pod spec.
StatusReasonCannotCreateBuildPodSpec = "CannotCreateBuildPodSpec"
// StatusReasonCannotCreateBuildPod is an error condition when a build pod
// cannot be created.
StatusReasonCannotCreateBuildPod = "CannotCreateBuildPod"
// StatusReasonInvalidOutputReference is an error condition when the build
// output is an invalid reference.
StatusReasonInvalidOutputReference = "InvalidOutputReference"
// StatusReasonCancelBuildFailed is an error condition when cancelling a build
// fails.
StatusReasonCancelBuildFailed = "CancelBuildFailed"
// StatusReasonBuildPodDeleted is an error condition when the build pod is
// deleted before build completion.
StatusReasonBuildPodDeleted = "BuildPodDeleted"
// StatusReasonExceededRetryTimeout is an error condition when the build has
// not completed and retrying the build times out.
StatusReasonExceededRetryTimeout = "ExceededRetryTimeout"
// StatusReasonMissingPushSecret indicates that the build is missing required
// secret for pushing the output image.
// The build will stay in the pending state until the secret is created, or the build times out.
StatusReasonMissingPushSecret = "MissingPushSecret"
)
// BuildSource is the input used for the build.
type BuildSource struct {
// Binary builds accept a binary as their input. The binary is generally assumed to be a tar,
// gzipped tar, or zip file depending on the strategy. For Docker builds, this is the build
// context and an optional Dockerfile may be specified to override any Dockerfile in the
// build context. For Source builds, this is assumed to be an archive as described above. For
// Source and Docker builds, if binary.asFile is set the build will receive a directory with
// a single file. contextDir may be used when an archive is provided. Custom builds will
// receive this binary as input on STDIN.
Binary *BinaryBuildSource
// Dockerfile is the raw contents of a Dockerfile which should be built. When this option is
// specified, the FROM may be modified based on your strategy base image and additional ENV
// stanzas from your strategy environment will be added after the FROM, but before the rest
// of your Dockerfile stanzas. The Dockerfile source type may be used with other options like
// git - in those cases the Git repo will have any innate Dockerfile replaced in the context
// dir.
Dockerfile *string
// Git contains optional information about git build source
Git *GitBuildSource
// Images describes a set of images to be used to provide source for the build
Images []ImageSource
// ContextDir specifies the sub-directory where the source code for the application exists.
// This allows to have buildable sources in directory other than root of
// repository.
ContextDir string
// SourceSecret is the name of a Secret that would be used for setting
// up the authentication for cloning private repository.
// The secret contains valid credentials for remote repository, where the
// data's key represent the authentication method to be used and value is
// the base64 encoded credentials. Supported auth methods are: ssh-privatekey.
// TODO: This needs to move under the GitBuildSource struct since it's only
// used for git authentication
SourceSecret *kapi.LocalObjectReference
// Secrets represents a list of secrets and their destinations that will
// be used only for the build.
Secrets []SecretBuildSource
}
// ImageSource describes an image that is used as source for the build
type ImageSource struct {
// From is a reference to an ImageStreamTag, ImageStreamImage, or DockerImage to
// copy source from.
From kapi.ObjectReference
// Paths is a list of source and destination paths to copy from the image.
Paths []ImageSourcePath
// PullSecret is a reference to a secret to be used to pull the image from a registry
// If the image is pulled from the OpenShift registry, this field does not need to be set.
PullSecret *kapi.LocalObjectReference
}
// ImageSourcePath describes a path to be copied from a source image and its destination within the build directory.
type ImageSourcePath struct {
// SourcePath is the absolute path of the file or directory inside the image to
// copy to the build directory.
SourcePath string
// DestinationDir is the relative directory within the build directory
// where files copied from the image are placed.
DestinationDir string
}
// SecretBuildSource describes a secret and its destination directory that will be
// used only at the build time. The content of the secret referenced here will
// be copied into the destination directory instead of mounting.
type SecretBuildSource struct {
// Secret is a reference to an existing secret that you want to use in your
// build.
Secret kapi.LocalObjectReference
// DestinationDir is the directory where the files from the secret should be
// available for the build time.
// For the Source build strategy, these will be injected into a container
// where the assemble script runs. Later, when the script finishes, all files
// injected will be truncated to zero length.
// For the Docker build strategy, these will be copied into the build
// directory, where the Dockerfile is located, so users can ADD or COPY them
// during docker build.
DestinationDir string
}
type BinaryBuildSource struct {
// AsFile indicates that the provided binary input should be considered a single file
// within the build input. For example, specifying "webapp.war" would place the provided
// binary as `/webapp.war` for the builder. If left empty, the Docker and Source build
// strategies assume this file is a zip, tar, or tar.gz file and extract it as the source.
// The custom strategy receives this binary as standard input. This filename may not
// contain slashes or be '..' or '.'.
AsFile string
}
// SourceRevision is the revision or commit information from the source for the build
type SourceRevision struct {
// Git contains information about git-based build source
Git *GitSourceRevision
}
// GitSourceRevision is the commit information from a git source for a build
type GitSourceRevision struct {
// Commit is the commit hash identifying a specific commit
Commit string
// Author is the author of a specific commit
Author SourceControlUser
// Committer is the committer of a specific commit
Committer SourceControlUser
// Message is the description of a specific commit
Message string
}
// GitBuildSource defines the parameters of a Git SCM
type GitBuildSource struct {
// URI points to the source that will be built. The structure of the source
// will depend on the type of build to run
URI string
// Ref is the branch/tag/ref to build.
Ref string
// HTTPProxy is a proxy used to reach the git repository over http
HTTPProxy *string
// HTTPSProxy is a proxy used to reach the git repository over https
HTTPSProxy *string
}
// SourceControlUser defines the identity of a user of source control
type SourceControlUser struct {
// Name of the source control user
Name string
// Email of the source control user
Email string
}
// BuildStrategy contains the details of how to perform a build.
type BuildStrategy struct {
// DockerStrategy holds the parameters to the Docker build strategy.
DockerStrategy *DockerBuildStrategy
// SourceStrategy holds the parameters to the Source build strategy.
SourceStrategy *SourceBuildStrategy
// CustomStrategy holds the parameters to the Custom build strategy
CustomStrategy *CustomBuildStrategy
// JenkinsPipelineStrategy holds the parameters to the Jenkins Pipeline build strategy.
// This strategy is experimental.
JenkinsPipelineStrategy *JenkinsPipelineBuildStrategy
}
// BuildStrategyType describes a particular way of performing a build.
type BuildStrategyType string
const (
// CustomBuildStrategyBaseImageKey is the environment variable that indicates the base image to be used when
// performing a custom build, if needed.
CustomBuildStrategyBaseImageKey = "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE"
)
// CustomBuildStrategy defines input parameters specific to Custom build.
type CustomBuildStrategy struct {
// From is reference to an DockerImage, ImageStream, ImageStreamTag, or ImageStreamImage from which
// the docker image should be pulled
From kapi.ObjectReference
// PullSecret is the name of a Secret that would be used for setting up
// the authentication for pulling the Docker images from the private Docker
// registries
PullSecret *kapi.LocalObjectReference
// Env contains additional environment variables you want to pass into a builder container
Env []kapi.EnvVar
// ExposeDockerSocket will allow running Docker commands (and build Docker images) from
// inside the Docker container.
// TODO: Allow admins to enforce 'false' for this option
ExposeDockerSocket bool
// ForcePull describes if the controller should configure the build pod to always pull the images
// for the builder or only pull if it is not present locally
ForcePull bool
// Secrets is a list of additional secrets that will be included in the custom build pod
Secrets []SecretSpec
// BuildAPIVersion is the requested API version for the Build object serialized and passed to the custom builder
BuildAPIVersion string
}
// DockerBuildStrategy defines input parameters specific to Docker build.
type DockerBuildStrategy struct {
// From is reference to an DockerImage, ImageStream, ImageStreamTag, or ImageStreamImage from which
// the docker image should be pulled
// the resulting image will be used in the FROM line of the Dockerfile for this build.
From *kapi.ObjectReference
// PullSecret is the name of a Secret that would be used for setting up
// the authentication for pulling the Docker images from the private Docker
// registries
PullSecret *kapi.LocalObjectReference
// NoCache if set to true indicates that the docker build must be executed with the
// --no-cache=true flag
NoCache bool
// Env contains additional environment variables you want to pass into a builder container
Env []kapi.EnvVar
// ForcePull describes if the builder should pull the images from registry prior to building.
ForcePull bool
// DockerfilePath is the path of the Dockerfile that will be used to build the Docker image,
// relative to the root of the context (contextDir).
DockerfilePath string
}
// SourceBuildStrategy defines input parameters specific to an Source build.
type SourceBuildStrategy struct {
// From is reference to an DockerImage, ImageStream, ImageStreamTag, or ImageStreamImage from which
// the docker image should be pulled
From kapi.ObjectReference
// PullSecret is the name of a Secret that would be used for setting up
// the authentication for pulling the Docker images from the private Docker
// registries
PullSecret *kapi.LocalObjectReference
// Env contains additional environment variables you want to pass into a builder container
Env []kapi.EnvVar
// Scripts is the location of Source scripts
Scripts string
// Incremental flag forces the Source build to do incremental builds if true.
Incremental bool
// ForcePull describes if the builder should pull the images from registry prior to building.
ForcePull bool
}
// JenkinsPipelineStrategy holds parameters specific to a Jenkins Pipeline build.
// This strategy is experimental.
type JenkinsPipelineBuildStrategy struct {
// JenkinsfilePath is the optional path of the Jenkinsfile that will be used to configure the pipeline
// relative to the root of the context (contextDir). If both JenkinsfilePath & Jenkinsfile are
// both not specified, this defaults to Jenkinsfile in the root of the specified contextDir.
JenkinsfilePath string
// Jenkinsfile defines the optional raw contents of a Jenkinsfile which defines a Jenkins pipeline build.
Jenkinsfile string
}
// A BuildPostCommitSpec holds a build post commit hook specification. The hook
// executes a command in a temporary container running the build output image,
// immediately after the last layer of the image is committed and before the
// image is pushed to a registry. The command is executed with the current
// working directory ($PWD) set to the image's WORKDIR.
//
// The build will be marked as failed if the hook execution fails. It will fail
// if the script or command return a non-zero exit code, or if there is any
// other error related to starting the temporary container.
//
// There are five different ways to configure the hook. As an example, all forms
// below are equivalent and will execute `rake test --verbose`.
//
// 1. Shell script:
//
// BuildPostCommitSpec{
// Script: "rake test --verbose",
// }
//
// The above is a convenient form which is equivalent to:
//
// BuildPostCommitSpec{
// Command: []string{"/bin/sh", "-ic"},
// Args: []string{"rake test --verbose"},
// }
//
// 2. Command as the image entrypoint:
//
// BuildPostCommitSpec{
// Command: []string{"rake", "test", "--verbose"},
// }
//
// Command overrides the image entrypoint in the exec form, as documented in
// Docker: https://docs.docker.com/engine/reference/builder/#entrypoint.
//
// 3. Pass arguments to the default entrypoint:
//
// BuildPostCommitSpec{
// Args: []string{"rake", "test", "--verbose"},
// }
//
// This form is only useful if the image entrypoint can handle arguments.
//
// 4. Shell script with arguments:
//
// BuildPostCommitSpec{
// Script: "rake test $1",
// Args: []string{"--verbose"},
// }
//
// This form is useful if you need to pass arguments that would otherwise be
// hard to quote properly in the shell script. In the script, $0 will be
// "/bin/sh" and $1, $2, etc, are the positional arguments from Args.
//
// 5. Command with arguments:
//
// BuildPostCommitSpec{
// Command: []string{"rake", "test"},
// Args: []string{"--verbose"},
// }
//
// This form is equivalent to appending the arguments to the Command slice.
//
// It is invalid to provide both Script and Command simultaneously. If none of
// the fields are specified, the hook is not executed.
type BuildPostCommitSpec struct {
// Command is the command to run. It may not be specified with Script.
// This might be needed if the image doesn't have `/bin/sh`, or if you
// do not want to use a shell. In all other cases, using Script might be
// more convenient.
Command []string
// Args is a list of arguments that are provided to either Command,
// Script or the Docker image's default entrypoint. The arguments are
// placed immediately after the command to be run.
Args []string
// Script is a shell script to be run with `/bin/sh -ic`. It may not be
// specified with Command. Use Script when a shell script is appropriate
// to execute the post build hook, for example for running unit tests
// with `rake test`. If you need control over the image entrypoint, or
// if the image does not have `/bin/sh`, use Command and/or Args.
// The `-i` flag is needed to support CentOS and RHEL images that use
// Software Collections (SCL), in order to have the appropriate
// collections enabled in the shell. E.g., in the Ruby image, this is
// necessary to make `ruby`, `bundle` and other binaries available in
// the PATH.
Script string
}
// BuildOutput is input to a build strategy and describes the Docker image that the strategy
// should produce.
type BuildOutput struct {
// To defines an optional location to push the output of this build to.
// Kind must be one of 'ImageStreamTag' or 'DockerImage'.
// This value will be used to look up a Docker image repository to push to.
// In the case of an ImageStreamTag, the ImageStreamTag will be looked for in the namespace of
// the build unless Namespace is specified.
To *kapi.ObjectReference
// PushSecret is the name of a Secret that would be used for setting
// up the authentication for executing the Docker push to authentication
// enabled Docker Registry (or Docker Hub).
PushSecret *kapi.LocalObjectReference
}
// BuildConfig is a template which can be used to create new builds.
type BuildConfig struct {
unversioned.TypeMeta
kapi.ObjectMeta
// Spec holds all the input necessary to produce a new build, and the conditions when
// to trigger them.
Spec BuildConfigSpec
// Status holds any relevant information about a build config
Status BuildConfigStatus
}
// BuildConfigSpec describes when and how builds are created
type BuildConfigSpec struct {
// Triggers determine how new Builds can be launched from a BuildConfig. If
// no triggers are defined, a new build can only occur as a result of an
// explicit client build creation.
Triggers []BuildTriggerPolicy
// RunPolicy describes how the new build created from this build
// configuration will be scheduled for execution.
// This is optional, if not specified we default to "Serial".
RunPolicy BuildRunPolicy
// CommonSpec is the desired build specification
CommonSpec
}
// BuildRunPolicy defines the behaviour of how the new builds are executed
// from the existing build configuration.
type BuildRunPolicy string
const (
// BuildRunPolicyParallel schedules new builds immediately after they are
// created. Builds will be executed in parallel.
BuildRunPolicyParallel BuildRunPolicy = "Parallel"
// BuildRunPolicySerial schedules new builds to execute in a sequence as
// they are created. Every build gets queued up and will execute when the
// previous build completes. This is the default policy.
BuildRunPolicySerial BuildRunPolicy = "Serial"
// BuildRunPolicySerialLatestOnly schedules only the latest build to execute,
// cancelling all the previously queued build.
BuildRunPolicySerialLatestOnly BuildRunPolicy = "SerialLatestOnly"
)
// BuildConfigStatus contains current state of the build config object.
type BuildConfigStatus struct {
// LastVersion is used to inform about number of last triggered build.
LastVersion int64
}
// WebHookTrigger is a trigger that gets invoked using a webhook type of post
type WebHookTrigger struct {
// Secret used to validate requests.
Secret string
// AllowEnv determines whether the webhook can set environment variables; can only
// be set to true for GenericWebHook
AllowEnv bool
}
// ImageChangeTrigger allows builds to be triggered when an ImageStream changes
type ImageChangeTrigger struct {
// LastTriggeredImageID is used internally by the ImageChangeController to save last
// used image ID for build
LastTriggeredImageID string
// From is a reference to an ImageStreamTag that will trigger a build when updated
// It is optional. If no From is specified, the From image from the build strategy
// will be used. Only one ImageChangeTrigger with an empty From reference is allowed in
// a build configuration.
From *kapi.ObjectReference
}
// BuildTriggerPolicy describes a policy for a single trigger that results in a new Build.
type BuildTriggerPolicy struct {
// Type is the type of build trigger
Type BuildTriggerType
// GitHubWebHook contains the parameters for a GitHub webhook type of trigger
GitHubWebHook *WebHookTrigger
// GenericWebHook contains the parameters for a Generic webhook type of trigger
GenericWebHook *WebHookTrigger
// ImageChange contains parameters for an ImageChange type of trigger
ImageChange *ImageChangeTrigger
}
// BuildTriggerType refers to a specific BuildTriggerPolicy implementation.
type BuildTriggerType string
//NOTE: Adding a new trigger type requires adding the type to KnownTriggerTypes
var KnownTriggerTypes = sets.NewString(
string(GitHubWebHookBuildTriggerType),
string(GenericWebHookBuildTriggerType),
string(ImageChangeBuildTriggerType),
string(ConfigChangeBuildTriggerType),
)
const (
// GitHubWebHookBuildTriggerType represents a trigger that launches builds on
// GitHub webhook invocations
GitHubWebHookBuildTriggerType BuildTriggerType = "GitHub"
GitHubWebHookBuildTriggerTypeDeprecated BuildTriggerType = "github"
// GenericWebHookBuildTriggerType represents a trigger that launches builds on
// generic webhook invocations
GenericWebHookBuildTriggerType BuildTriggerType = "Generic"
GenericWebHookBuildTriggerTypeDeprecated BuildTriggerType = "generic"
// ImageChangeBuildTriggerType represents a trigger that launches builds on
// availability of a new version of an image
ImageChangeBuildTriggerType BuildTriggerType = "ImageChange"
ImageChangeBuildTriggerTypeDeprecated BuildTriggerType = "imageChange"
// ConfigChangeBuildTriggerType will trigger a build on an initial build config creation
// WARNING: In the future the behavior will change to trigger a build on any config change
ConfigChangeBuildTriggerType BuildTriggerType = "ConfigChange"
)
// BuildList is a collection of Builds.
type BuildList struct {
unversioned.TypeMeta
unversioned.ListMeta
// Items is a list of builds
Items []Build
}
// BuildConfigList is a collection of BuildConfigs.
type BuildConfigList struct {
unversioned.TypeMeta
unversioned.ListMeta
// Items is a list of build configs
Items []BuildConfig
}
// GenericWebHookEvent is the payload expected for a generic webhook post
type GenericWebHookEvent struct {
// Git is the git information, if any.
Git *GitInfo
// Env contains additional environment variables you want to pass into a builder container
Env []kapi.EnvVar
}
// GitInfo is the aggregated git information for a generic webhook post
type GitInfo struct {
GitBuildSource
GitSourceRevision
// Refs is a list of GitRefs for the provided repo - generally sent
// when used from a post-receive hook. This field is optional and is
// used when sending multiple refs
Refs []GitRefInfo
}
// GitRefInfo is a single ref
type GitRefInfo struct {
GitBuildSource
GitSourceRevision
}
// BuildLog is the (unused) resource associated with the build log redirector
type BuildLog struct {
unversioned.TypeMeta
}
// BuildRequest is the resource used to pass parameters to build generator
type BuildRequest struct {
unversioned.TypeMeta
// TODO: build request should allow name generation via Name and GenerateName, build config
// name should be provided as a separate field
kapi.ObjectMeta
// Revision is the information from the source for a specific repo snapshot.
Revision *SourceRevision
// TriggeredByImage is the Image that triggered this build.
TriggeredByImage *kapi.ObjectReference
// From is the reference to the ImageStreamTag that triggered the build.
From *kapi.ObjectReference
// Binary indicates a request to build from a binary provided to the builder
Binary *BinaryBuildSource
// LastVersion (optional) is the LastVersion of the BuildConfig that was used
// to generate the build. If the BuildConfig in the generator doesn't match,
// a build will not be generated.
LastVersion *int64
// Env contains additional environment variables you want to pass into a builder container.
Env []kapi.EnvVar
// TriggeredBy describes which triggers started the most recent update to the
// buildconfig and contains information about those triggers.
TriggeredBy []BuildTriggerCause
}
type BinaryBuildRequestOptions struct {
unversioned.TypeMeta
kapi.ObjectMeta
AsFile string
// TODO: support structs in query arguments in the future (inline and nested fields)
// Commit is the value identifying a specific commit
Commit string
// Message is the description of a specific commit
Message string
// AuthorName of the source control user
AuthorName string
// AuthorEmail of the source control user
AuthorEmail string
// CommitterName of the source control user
CommitterName string
// CommitterEmail of the source control user
CommitterEmail string
}
// BuildLogOptions is the REST options for a build log
type BuildLogOptions struct {
unversioned.TypeMeta
// Container for which to return logs
Container string
// Follow if true indicates that the build log should be streamed until
// the build terminates.
Follow bool
// If true, return previous build logs.
Previous bool
// A relative time in seconds before the current time from which to show logs. If this value
// precedes the time a pod was started, only logs since the pod start will be returned.
// If this value is in the future, no logs will be returned.
// Only one of sinceSeconds or sinceTime may be specified.
SinceSeconds *int64
// An RFC3339 timestamp from which to show logs. If this value
// precedes the time a pod was started, only logs since the pod start will be returned.
// If this value is in the future, no logs will be returned.
// Only one of sinceSeconds or sinceTime may be specified.
SinceTime *unversioned.Time
// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
// of log output.
Timestamps bool
// If set, the number of lines from the end of the logs to show. If not specified,
// logs are shown from the creation of the container or sinceSeconds or sinceTime
TailLines *int64
// If set, the number of bytes to read from the server before terminating the
// log output. This may not display a complete final line of logging, and may return
// slightly more or slightly less than the specified limit.
LimitBytes *int64
// NoWait if true causes the call to return immediately even if the build
// is not available yet. Otherwise the server will wait until the build has started.
NoWait bool
// Version of the build for which to view logs.
Version *int64
}
// SecretSpec specifies a secret to be included in a build pod and its corresponding mount point
type SecretSpec struct {
// SecretSource is a reference to the secret
SecretSource kapi.LocalObjectReference
// MountPath is the path at which to mount the secret
MountPath string
}
+68
View File
@@ -0,0 +1,68 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/util/validation"
"github.com/openshift/origin/pkg/util/namer"
)
const (
// BuildPodSuffix is the suffix used to append to a build pod name given a build name
BuildPodSuffix = "build"
)
// GetBuildPodName returns name of the build pod.
func GetBuildPodName(build *Build) string {
return namer.GetPodName(build.Name, BuildPodSuffix)
}
func StrategyType(strategy BuildStrategy) string {
switch {
case strategy.DockerStrategy != nil:
return "Docker"
case strategy.CustomStrategy != nil:
return "Custom"
case strategy.SourceStrategy != nil:
return "Source"
case strategy.JenkinsPipelineStrategy != nil:
return "JenkinsPipeline"
}
return ""
}
func SourceType(source BuildSource) string {
var sourceType string
if source.Git != nil {
sourceType = "Git"
}
if source.Dockerfile != nil {
if len(sourceType) != 0 {
sourceType = sourceType + ","
}
sourceType = sourceType + "Dockerfile"
}
if source.Binary != nil {
if len(sourceType) != 0 {
sourceType = sourceType + ","
}
sourceType = sourceType + "Binary"
}
return sourceType
}
// LabelValue returns a string to use as a value for the Build
// label in a pod. If the length of the string parameter exceeds
// the maximum label length, the value will be truncated.
func LabelValue(name string) string {
if len(name) <= validation.DNS1123LabelMaxLength {
return name
}
return name[:validation.DNS1123LabelMaxLength]
}
// GetBuildName returns the name of a Build associated with the
// given Pod.
func GetBuildName(pod *kapi.Pod) string {
return pod.Annotations[BuildAnnotation]
}
+152
View File
@@ -0,0 +1,152 @@
package v1
import (
"fmt"
"math"
"reflect"
"strings"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/intstr"
oapi "github.com/openshift/origin/pkg/api"
newer "github.com/openshift/origin/pkg/deploy/api"
imageapi "github.com/openshift/origin/pkg/image/api"
)
func Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*DeploymentTriggerImageChangeParams))(in)
}
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
switch in.From.Kind {
case "ImageStreamTag":
case "ImageStream", "ImageRepository":
out.From.Kind = "ImageStreamTag"
if !strings.Contains(out.From.Name, ":") {
out.From.Name = imageapi.JoinImageStreamTag(out.From.Name, imageapi.DefaultImageTag)
}
default:
// Will be handled by validation
}
return nil
}
func Convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
switch in.From.Kind {
case "ImageStreamTag":
case "ImageStream", "ImageRepository":
out.From.Kind = "ImageStreamTag"
if !strings.Contains(out.From.Name, ":") {
out.From.Name = imageapi.JoinImageStreamTag(out.From.Name, imageapi.DefaultImageTag)
}
default:
// Will be handled by validation
}
return nil
}
func Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams(in *RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*RollingDeploymentStrategyParams))(in)
}
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds
out.IntervalSeconds = in.IntervalSeconds
out.TimeoutSeconds = in.TimeoutSeconds
out.UpdatePercent = in.UpdatePercent
if in.Pre != nil {
if err := s.Convert(&in.Pre, &out.Pre, 0); err != nil {
return err
}
}
if in.Post != nil {
if err := s.Convert(&in.Post, &out.Post, 0); err != nil {
return err
}
}
if in.UpdatePercent != nil {
pct := intstr.FromString(fmt.Sprintf("%d%%", int(math.Abs(float64(*in.UpdatePercent)))))
if *in.UpdatePercent > 0 {
out.MaxSurge = pct
} else {
out.MaxUnavailable = pct
}
} else {
if err := s.Convert(in.MaxUnavailable, &out.MaxUnavailable, 0); err != nil {
return err
}
if err := s.Convert(in.MaxSurge, &out.MaxSurge, 0); err != nil {
return err
}
}
return nil
}
func Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, s conversion.Scope) error {
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds
out.IntervalSeconds = in.IntervalSeconds
out.TimeoutSeconds = in.TimeoutSeconds
out.UpdatePercent = in.UpdatePercent
if in.Pre != nil {
if err := s.Convert(&in.Pre, &out.Pre, 0); err != nil {
return err
}
}
if in.Post != nil {
if err := s.Convert(&in.Post, &out.Post, 0); err != nil {
return err
}
}
if out.MaxUnavailable == nil {
out.MaxUnavailable = &intstr.IntOrString{}
}
if out.MaxSurge == nil {
out.MaxSurge = &intstr.IntOrString{}
}
if in.UpdatePercent != nil {
pct := intstr.FromString(fmt.Sprintf("%d%%", int(math.Abs(float64(*in.UpdatePercent)))))
if *in.UpdatePercent > 0 {
out.MaxSurge = &pct
} else {
out.MaxUnavailable = &pct
}
} else {
if err := s.Convert(&in.MaxUnavailable, out.MaxUnavailable, 0); err != nil {
return err
}
if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil {
return err
}
}
return nil
}
func addConversionFuncs(scheme *runtime.Scheme) {
err := scheme.AddConversionFuncs(
Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams,
Convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams,
Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams,
Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams,
)
if err != nil {
panic(err)
}
if err := scheme.AddFieldLabelConversionFunc("v1", "DeploymentConfig",
oapi.GetFieldLabelConversionFunc(newer.DeploymentConfigToSelectableFields(&newer.DeploymentConfig{}), nil),
); err != nil {
panic(err)
}
}
@@ -0,0 +1,878 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1
import (
deploy_api "github.com/openshift/origin/pkg/deploy/api"
api "k8s.io/kubernetes/pkg/api"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedConversionFuncs(
Convert_v1_CustomDeploymentStrategyParams_To_api_CustomDeploymentStrategyParams,
Convert_api_CustomDeploymentStrategyParams_To_v1_CustomDeploymentStrategyParams,
Convert_v1_DeploymentCause_To_api_DeploymentCause,
Convert_api_DeploymentCause_To_v1_DeploymentCause,
Convert_v1_DeploymentCauseImageTrigger_To_api_DeploymentCauseImageTrigger,
Convert_api_DeploymentCauseImageTrigger_To_v1_DeploymentCauseImageTrigger,
Convert_v1_DeploymentConfig_To_api_DeploymentConfig,
Convert_api_DeploymentConfig_To_v1_DeploymentConfig,
Convert_v1_DeploymentConfigList_To_api_DeploymentConfigList,
Convert_api_DeploymentConfigList_To_v1_DeploymentConfigList,
Convert_v1_DeploymentConfigRollback_To_api_DeploymentConfigRollback,
Convert_api_DeploymentConfigRollback_To_v1_DeploymentConfigRollback,
Convert_v1_DeploymentConfigRollbackSpec_To_api_DeploymentConfigRollbackSpec,
Convert_api_DeploymentConfigRollbackSpec_To_v1_DeploymentConfigRollbackSpec,
Convert_v1_DeploymentConfigSpec_To_api_DeploymentConfigSpec,
Convert_api_DeploymentConfigSpec_To_v1_DeploymentConfigSpec,
Convert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus,
Convert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus,
Convert_v1_DeploymentDetails_To_api_DeploymentDetails,
Convert_api_DeploymentDetails_To_v1_DeploymentDetails,
Convert_v1_DeploymentLog_To_api_DeploymentLog,
Convert_api_DeploymentLog_To_v1_DeploymentLog,
Convert_v1_DeploymentLogOptions_To_api_DeploymentLogOptions,
Convert_api_DeploymentLogOptions_To_v1_DeploymentLogOptions,
Convert_v1_DeploymentStrategy_To_api_DeploymentStrategy,
Convert_api_DeploymentStrategy_To_v1_DeploymentStrategy,
Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams,
Convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams,
Convert_v1_DeploymentTriggerPolicy_To_api_DeploymentTriggerPolicy,
Convert_api_DeploymentTriggerPolicy_To_v1_DeploymentTriggerPolicy,
Convert_v1_ExecNewPodHook_To_api_ExecNewPodHook,
Convert_api_ExecNewPodHook_To_v1_ExecNewPodHook,
Convert_v1_LifecycleHook_To_api_LifecycleHook,
Convert_api_LifecycleHook_To_v1_LifecycleHook,
Convert_v1_RecreateDeploymentStrategyParams_To_api_RecreateDeploymentStrategyParams,
Convert_api_RecreateDeploymentStrategyParams_To_v1_RecreateDeploymentStrategyParams,
Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams,
Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams,
Convert_v1_TagImageHook_To_api_TagImageHook,
Convert_api_TagImageHook_To_v1_TagImageHook,
); err != nil {
// if one of the conversion functions is malformed, detect it immediately.
panic(err)
}
}
func autoConvert_v1_CustomDeploymentStrategyParams_To_api_CustomDeploymentStrategyParams(in *CustomDeploymentStrategyParams, out *deploy_api.CustomDeploymentStrategyParams, s conversion.Scope) error {
out.Image = in.Image
if in.Environment != nil {
in, out := &in.Environment, &out.Environment
*out = make([]api.EnvVar, len(*in))
for i := range *in {
if err := api_v1.Convert_v1_EnvVar_To_api_EnvVar(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Environment = nil
}
out.Command = in.Command
return nil
}
func Convert_v1_CustomDeploymentStrategyParams_To_api_CustomDeploymentStrategyParams(in *CustomDeploymentStrategyParams, out *deploy_api.CustomDeploymentStrategyParams, s conversion.Scope) error {
return autoConvert_v1_CustomDeploymentStrategyParams_To_api_CustomDeploymentStrategyParams(in, out, s)
}
func autoConvert_api_CustomDeploymentStrategyParams_To_v1_CustomDeploymentStrategyParams(in *deploy_api.CustomDeploymentStrategyParams, out *CustomDeploymentStrategyParams, s conversion.Scope) error {
out.Image = in.Image
if in.Environment != nil {
in, out := &in.Environment, &out.Environment
*out = make([]api_v1.EnvVar, len(*in))
for i := range *in {
if err := api_v1.Convert_api_EnvVar_To_v1_EnvVar(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Environment = nil
}
out.Command = in.Command
return nil
}
func Convert_api_CustomDeploymentStrategyParams_To_v1_CustomDeploymentStrategyParams(in *deploy_api.CustomDeploymentStrategyParams, out *CustomDeploymentStrategyParams, s conversion.Scope) error {
return autoConvert_api_CustomDeploymentStrategyParams_To_v1_CustomDeploymentStrategyParams(in, out, s)
}
func autoConvert_v1_DeploymentCause_To_api_DeploymentCause(in *DeploymentCause, out *deploy_api.DeploymentCause, s conversion.Scope) error {
out.Type = deploy_api.DeploymentTriggerType(in.Type)
if in.ImageTrigger != nil {
in, out := &in.ImageTrigger, &out.ImageTrigger
*out = new(deploy_api.DeploymentCauseImageTrigger)
if err := Convert_v1_DeploymentCauseImageTrigger_To_api_DeploymentCauseImageTrigger(*in, *out, s); err != nil {
return err
}
} else {
out.ImageTrigger = nil
}
return nil
}
func Convert_v1_DeploymentCause_To_api_DeploymentCause(in *DeploymentCause, out *deploy_api.DeploymentCause, s conversion.Scope) error {
return autoConvert_v1_DeploymentCause_To_api_DeploymentCause(in, out, s)
}
func autoConvert_api_DeploymentCause_To_v1_DeploymentCause(in *deploy_api.DeploymentCause, out *DeploymentCause, s conversion.Scope) error {
out.Type = DeploymentTriggerType(in.Type)
if in.ImageTrigger != nil {
in, out := &in.ImageTrigger, &out.ImageTrigger
*out = new(DeploymentCauseImageTrigger)
if err := Convert_api_DeploymentCauseImageTrigger_To_v1_DeploymentCauseImageTrigger(*in, *out, s); err != nil {
return err
}
} else {
out.ImageTrigger = nil
}
return nil
}
func Convert_api_DeploymentCause_To_v1_DeploymentCause(in *deploy_api.DeploymentCause, out *DeploymentCause, s conversion.Scope) error {
return autoConvert_api_DeploymentCause_To_v1_DeploymentCause(in, out, s)
}
func autoConvert_v1_DeploymentCauseImageTrigger_To_api_DeploymentCauseImageTrigger(in *DeploymentCauseImageTrigger, out *deploy_api.DeploymentCauseImageTrigger, s conversion.Scope) error {
if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
return nil
}
func Convert_v1_DeploymentCauseImageTrigger_To_api_DeploymentCauseImageTrigger(in *DeploymentCauseImageTrigger, out *deploy_api.DeploymentCauseImageTrigger, s conversion.Scope) error {
return autoConvert_v1_DeploymentCauseImageTrigger_To_api_DeploymentCauseImageTrigger(in, out, s)
}
func autoConvert_api_DeploymentCauseImageTrigger_To_v1_DeploymentCauseImageTrigger(in *deploy_api.DeploymentCauseImageTrigger, out *DeploymentCauseImageTrigger, s conversion.Scope) error {
if err := api_v1.Convert_api_ObjectReference_To_v1_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
return nil
}
func Convert_api_DeploymentCauseImageTrigger_To_v1_DeploymentCauseImageTrigger(in *deploy_api.DeploymentCauseImageTrigger, out *DeploymentCauseImageTrigger, s conversion.Scope) error {
return autoConvert_api_DeploymentCauseImageTrigger_To_v1_DeploymentCauseImageTrigger(in, out, s)
}
func autoConvert_v1_DeploymentConfig_To_api_DeploymentConfig(in *DeploymentConfig, out *deploy_api.DeploymentConfig, s conversion.Scope) error {
SetDefaults_DeploymentConfig(in)
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api_v1.Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil {
return err
}
if err := Convert_v1_DeploymentConfigSpec_To_api_DeploymentConfigSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_v1_DeploymentConfig_To_api_DeploymentConfig(in *DeploymentConfig, out *deploy_api.DeploymentConfig, s conversion.Scope) error {
return autoConvert_v1_DeploymentConfig_To_api_DeploymentConfig(in, out, s)
}
func autoConvert_api_DeploymentConfig_To_v1_DeploymentConfig(in *deploy_api.DeploymentConfig, out *DeploymentConfig, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api_v1.Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil {
return err
}
if err := Convert_api_DeploymentConfigSpec_To_v1_DeploymentConfigSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_api_DeploymentConfig_To_v1_DeploymentConfig(in *deploy_api.DeploymentConfig, out *DeploymentConfig, s conversion.Scope) error {
return autoConvert_api_DeploymentConfig_To_v1_DeploymentConfig(in, out, s)
}
func autoConvert_v1_DeploymentConfigList_To_api_DeploymentConfigList(in *DeploymentConfigList, out *deploy_api.DeploymentConfigList, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil {
return err
}
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]deploy_api.DeploymentConfig, len(*in))
for i := range *in {
if err := Convert_v1_DeploymentConfig_To_api_DeploymentConfig(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_v1_DeploymentConfigList_To_api_DeploymentConfigList(in *DeploymentConfigList, out *deploy_api.DeploymentConfigList, s conversion.Scope) error {
return autoConvert_v1_DeploymentConfigList_To_api_DeploymentConfigList(in, out, s)
}
func autoConvert_api_DeploymentConfigList_To_v1_DeploymentConfigList(in *deploy_api.DeploymentConfigList, out *DeploymentConfigList, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil {
return err
}
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]DeploymentConfig, len(*in))
for i := range *in {
if err := Convert_api_DeploymentConfig_To_v1_DeploymentConfig(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_api_DeploymentConfigList_To_v1_DeploymentConfigList(in *deploy_api.DeploymentConfigList, out *DeploymentConfigList, s conversion.Scope) error {
return autoConvert_api_DeploymentConfigList_To_v1_DeploymentConfigList(in, out, s)
}
func autoConvert_v1_DeploymentConfigRollback_To_api_DeploymentConfigRollback(in *DeploymentConfigRollback, out *deploy_api.DeploymentConfigRollback, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
out.Name = in.Name
out.UpdatedAnnotations = in.UpdatedAnnotations
if err := Convert_v1_DeploymentConfigRollbackSpec_To_api_DeploymentConfigRollbackSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
func Convert_v1_DeploymentConfigRollback_To_api_DeploymentConfigRollback(in *DeploymentConfigRollback, out *deploy_api.DeploymentConfigRollback, s conversion.Scope) error {
return autoConvert_v1_DeploymentConfigRollback_To_api_DeploymentConfigRollback(in, out, s)
}
func autoConvert_api_DeploymentConfigRollback_To_v1_DeploymentConfigRollback(in *deploy_api.DeploymentConfigRollback, out *DeploymentConfigRollback, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
out.Name = in.Name
out.UpdatedAnnotations = in.UpdatedAnnotations
if err := Convert_api_DeploymentConfigRollbackSpec_To_v1_DeploymentConfigRollbackSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
func Convert_api_DeploymentConfigRollback_To_v1_DeploymentConfigRollback(in *deploy_api.DeploymentConfigRollback, out *DeploymentConfigRollback, s conversion.Scope) error {
return autoConvert_api_DeploymentConfigRollback_To_v1_DeploymentConfigRollback(in, out, s)
}
func autoConvert_v1_DeploymentConfigRollbackSpec_To_api_DeploymentConfigRollbackSpec(in *DeploymentConfigRollbackSpec, out *deploy_api.DeploymentConfigRollbackSpec, s conversion.Scope) error {
if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
out.Revision = in.Revision
out.IncludeTriggers = in.IncludeTriggers
out.IncludeTemplate = in.IncludeTemplate
out.IncludeReplicationMeta = in.IncludeReplicationMeta
out.IncludeStrategy = in.IncludeStrategy
return nil
}
func Convert_v1_DeploymentConfigRollbackSpec_To_api_DeploymentConfigRollbackSpec(in *DeploymentConfigRollbackSpec, out *deploy_api.DeploymentConfigRollbackSpec, s conversion.Scope) error {
return autoConvert_v1_DeploymentConfigRollbackSpec_To_api_DeploymentConfigRollbackSpec(in, out, s)
}
func autoConvert_api_DeploymentConfigRollbackSpec_To_v1_DeploymentConfigRollbackSpec(in *deploy_api.DeploymentConfigRollbackSpec, out *DeploymentConfigRollbackSpec, s conversion.Scope) error {
if err := api_v1.Convert_api_ObjectReference_To_v1_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
out.Revision = in.Revision
out.IncludeTriggers = in.IncludeTriggers
out.IncludeTemplate = in.IncludeTemplate
out.IncludeReplicationMeta = in.IncludeReplicationMeta
out.IncludeStrategy = in.IncludeStrategy
return nil
}
func Convert_api_DeploymentConfigRollbackSpec_To_v1_DeploymentConfigRollbackSpec(in *deploy_api.DeploymentConfigRollbackSpec, out *DeploymentConfigRollbackSpec, s conversion.Scope) error {
return autoConvert_api_DeploymentConfigRollbackSpec_To_v1_DeploymentConfigRollbackSpec(in, out, s)
}
func autoConvert_v1_DeploymentConfigSpec_To_api_DeploymentConfigSpec(in *DeploymentConfigSpec, out *deploy_api.DeploymentConfigSpec, s conversion.Scope) error {
SetDefaults_DeploymentConfigSpec(in)
if err := Convert_v1_DeploymentStrategy_To_api_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {
return err
}
out.MinReadySeconds = in.MinReadySeconds
if in.Triggers != nil {
in, out := &in.Triggers, &out.Triggers
*out = make([]deploy_api.DeploymentTriggerPolicy, len(*in))
for i := range *in {
if err := Convert_v1_DeploymentTriggerPolicy_To_api_DeploymentTriggerPolicy(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Triggers = nil
}
out.Replicas = in.Replicas
out.RevisionHistoryLimit = in.RevisionHistoryLimit
out.Test = in.Test
out.Paused = in.Paused
out.Selector = in.Selector
if in.Template != nil {
in, out := &in.Template, &out.Template
*out = new(api.PodTemplateSpec)
if err := api_v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(*in, *out, s); err != nil {
return err
}
} else {
out.Template = nil
}
return nil
}
func Convert_v1_DeploymentConfigSpec_To_api_DeploymentConfigSpec(in *DeploymentConfigSpec, out *deploy_api.DeploymentConfigSpec, s conversion.Scope) error {
return autoConvert_v1_DeploymentConfigSpec_To_api_DeploymentConfigSpec(in, out, s)
}
func autoConvert_api_DeploymentConfigSpec_To_v1_DeploymentConfigSpec(in *deploy_api.DeploymentConfigSpec, out *DeploymentConfigSpec, s conversion.Scope) error {
if err := Convert_api_DeploymentStrategy_To_v1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {
return err
}
out.MinReadySeconds = in.MinReadySeconds
if in.Triggers != nil {
in, out := &in.Triggers, &out.Triggers
*out = make([]DeploymentTriggerPolicy, len(*in))
for i := range *in {
if err := Convert_api_DeploymentTriggerPolicy_To_v1_DeploymentTriggerPolicy(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Triggers = nil
}
out.Replicas = in.Replicas
out.RevisionHistoryLimit = in.RevisionHistoryLimit
out.Test = in.Test
out.Paused = in.Paused
out.Selector = in.Selector
if in.Template != nil {
in, out := &in.Template, &out.Template
*out = new(api_v1.PodTemplateSpec)
if err := api_v1.Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(*in, *out, s); err != nil {
return err
}
} else {
out.Template = nil
}
return nil
}
func Convert_api_DeploymentConfigSpec_To_v1_DeploymentConfigSpec(in *deploy_api.DeploymentConfigSpec, out *DeploymentConfigSpec, s conversion.Scope) error {
return autoConvert_api_DeploymentConfigSpec_To_v1_DeploymentConfigSpec(in, out, s)
}
func autoConvert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(in *DeploymentConfigStatus, out *deploy_api.DeploymentConfigStatus, s conversion.Scope) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := &in.Details, &out.Details
*out = new(deploy_api.DeploymentDetails)
if err := Convert_v1_DeploymentDetails_To_api_DeploymentDetails(*in, *out, s); err != nil {
return err
}
} else {
out.Details = nil
}
return nil
}
func Convert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(in *DeploymentConfigStatus, out *deploy_api.DeploymentConfigStatus, s conversion.Scope) error {
return autoConvert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(in, out, s)
}
func autoConvert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus(in *deploy_api.DeploymentConfigStatus, out *DeploymentConfigStatus, s conversion.Scope) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := &in.Details, &out.Details
*out = new(DeploymentDetails)
if err := Convert_api_DeploymentDetails_To_v1_DeploymentDetails(*in, *out, s); err != nil {
return err
}
} else {
out.Details = nil
}
return nil
}
func Convert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus(in *deploy_api.DeploymentConfigStatus, out *DeploymentConfigStatus, s conversion.Scope) error {
return autoConvert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus(in, out, s)
}
func autoConvert_v1_DeploymentDetails_To_api_DeploymentDetails(in *DeploymentDetails, out *deploy_api.DeploymentDetails, s conversion.Scope) error {
out.Message = in.Message
if in.Causes != nil {
in, out := &in.Causes, &out.Causes
*out = make([]deploy_api.DeploymentCause, len(*in))
for i := range *in {
if err := Convert_v1_DeploymentCause_To_api_DeploymentCause(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Causes = nil
}
return nil
}
func Convert_v1_DeploymentDetails_To_api_DeploymentDetails(in *DeploymentDetails, out *deploy_api.DeploymentDetails, s conversion.Scope) error {
return autoConvert_v1_DeploymentDetails_To_api_DeploymentDetails(in, out, s)
}
func autoConvert_api_DeploymentDetails_To_v1_DeploymentDetails(in *deploy_api.DeploymentDetails, out *DeploymentDetails, s conversion.Scope) error {
out.Message = in.Message
if in.Causes != nil {
in, out := &in.Causes, &out.Causes
*out = make([]DeploymentCause, len(*in))
for i := range *in {
if err := Convert_api_DeploymentCause_To_v1_DeploymentCause(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Causes = nil
}
return nil
}
func Convert_api_DeploymentDetails_To_v1_DeploymentDetails(in *deploy_api.DeploymentDetails, out *DeploymentDetails, s conversion.Scope) error {
return autoConvert_api_DeploymentDetails_To_v1_DeploymentDetails(in, out, s)
}
func autoConvert_v1_DeploymentLog_To_api_DeploymentLog(in *DeploymentLog, out *deploy_api.DeploymentLog, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
return nil
}
func Convert_v1_DeploymentLog_To_api_DeploymentLog(in *DeploymentLog, out *deploy_api.DeploymentLog, s conversion.Scope) error {
return autoConvert_v1_DeploymentLog_To_api_DeploymentLog(in, out, s)
}
func autoConvert_api_DeploymentLog_To_v1_DeploymentLog(in *deploy_api.DeploymentLog, out *DeploymentLog, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
return nil
}
func Convert_api_DeploymentLog_To_v1_DeploymentLog(in *deploy_api.DeploymentLog, out *DeploymentLog, s conversion.Scope) error {
return autoConvert_api_DeploymentLog_To_v1_DeploymentLog(in, out, s)
}
func autoConvert_v1_DeploymentLogOptions_To_api_DeploymentLogOptions(in *DeploymentLogOptions, out *deploy_api.DeploymentLogOptions, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
out.Container = in.Container
out.Follow = in.Follow
out.Previous = in.Previous
out.SinceSeconds = in.SinceSeconds
out.SinceTime = in.SinceTime
out.Timestamps = in.Timestamps
out.TailLines = in.TailLines
out.LimitBytes = in.LimitBytes
out.NoWait = in.NoWait
out.Version = in.Version
return nil
}
func Convert_v1_DeploymentLogOptions_To_api_DeploymentLogOptions(in *DeploymentLogOptions, out *deploy_api.DeploymentLogOptions, s conversion.Scope) error {
return autoConvert_v1_DeploymentLogOptions_To_api_DeploymentLogOptions(in, out, s)
}
func autoConvert_api_DeploymentLogOptions_To_v1_DeploymentLogOptions(in *deploy_api.DeploymentLogOptions, out *DeploymentLogOptions, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
out.Container = in.Container
out.Follow = in.Follow
out.Previous = in.Previous
out.SinceSeconds = in.SinceSeconds
out.SinceTime = in.SinceTime
out.Timestamps = in.Timestamps
out.TailLines = in.TailLines
out.LimitBytes = in.LimitBytes
out.NoWait = in.NoWait
out.Version = in.Version
return nil
}
func Convert_api_DeploymentLogOptions_To_v1_DeploymentLogOptions(in *deploy_api.DeploymentLogOptions, out *DeploymentLogOptions, s conversion.Scope) error {
return autoConvert_api_DeploymentLogOptions_To_v1_DeploymentLogOptions(in, out, s)
}
func autoConvert_v1_DeploymentStrategy_To_api_DeploymentStrategy(in *DeploymentStrategy, out *deploy_api.DeploymentStrategy, s conversion.Scope) error {
SetDefaults_DeploymentStrategy(in)
out.Type = deploy_api.DeploymentStrategyType(in.Type)
if in.CustomParams != nil {
in, out := &in.CustomParams, &out.CustomParams
*out = new(deploy_api.CustomDeploymentStrategyParams)
if err := Convert_v1_CustomDeploymentStrategyParams_To_api_CustomDeploymentStrategyParams(*in, *out, s); err != nil {
return err
}
} else {
out.CustomParams = nil
}
if in.RecreateParams != nil {
in, out := &in.RecreateParams, &out.RecreateParams
*out = new(deploy_api.RecreateDeploymentStrategyParams)
if err := Convert_v1_RecreateDeploymentStrategyParams_To_api_RecreateDeploymentStrategyParams(*in, *out, s); err != nil {
return err
}
} else {
out.RecreateParams = nil
}
if in.RollingParams != nil {
in, out := &in.RollingParams, &out.RollingParams
*out = new(deploy_api.RollingDeploymentStrategyParams)
if err := Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams(*in, *out, s); err != nil {
return err
}
} else {
out.RollingParams = nil
}
if err := api_v1.Convert_v1_ResourceRequirements_To_api_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil {
return err
}
out.Labels = in.Labels
out.Annotations = in.Annotations
return nil
}
func Convert_v1_DeploymentStrategy_To_api_DeploymentStrategy(in *DeploymentStrategy, out *deploy_api.DeploymentStrategy, s conversion.Scope) error {
return autoConvert_v1_DeploymentStrategy_To_api_DeploymentStrategy(in, out, s)
}
func autoConvert_api_DeploymentStrategy_To_v1_DeploymentStrategy(in *deploy_api.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error {
out.Type = DeploymentStrategyType(in.Type)
if in.RecreateParams != nil {
in, out := &in.RecreateParams, &out.RecreateParams
*out = new(RecreateDeploymentStrategyParams)
if err := Convert_api_RecreateDeploymentStrategyParams_To_v1_RecreateDeploymentStrategyParams(*in, *out, s); err != nil {
return err
}
} else {
out.RecreateParams = nil
}
if in.RollingParams != nil {
in, out := &in.RollingParams, &out.RollingParams
*out = new(RollingDeploymentStrategyParams)
if err := Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(*in, *out, s); err != nil {
return err
}
} else {
out.RollingParams = nil
}
if in.CustomParams != nil {
in, out := &in.CustomParams, &out.CustomParams
*out = new(CustomDeploymentStrategyParams)
if err := Convert_api_CustomDeploymentStrategyParams_To_v1_CustomDeploymentStrategyParams(*in, *out, s); err != nil {
return err
}
} else {
out.CustomParams = nil
}
if err := api_v1.Convert_api_ResourceRequirements_To_v1_ResourceRequirements(&in.Resources, &out.Resources, s); err != nil {
return err
}
out.Labels = in.Labels
out.Annotations = in.Annotations
return nil
}
func Convert_api_DeploymentStrategy_To_v1_DeploymentStrategy(in *deploy_api.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error {
return autoConvert_api_DeploymentStrategy_To_v1_DeploymentStrategy(in, out, s)
}
func autoConvert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *deploy_api.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
out.Automatic = in.Automatic
out.ContainerNames = in.ContainerNames
if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
out.LastTriggeredImage = in.LastTriggeredImage
return nil
}
func autoConvert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(in *deploy_api.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
out.Automatic = in.Automatic
out.ContainerNames = in.ContainerNames
if err := api_v1.Convert_api_ObjectReference_To_v1_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
out.LastTriggeredImage = in.LastTriggeredImage
return nil
}
func autoConvert_v1_DeploymentTriggerPolicy_To_api_DeploymentTriggerPolicy(in *DeploymentTriggerPolicy, out *deploy_api.DeploymentTriggerPolicy, s conversion.Scope) error {
out.Type = deploy_api.DeploymentTriggerType(in.Type)
if in.ImageChangeParams != nil {
in, out := &in.ImageChangeParams, &out.ImageChangeParams
*out = new(deploy_api.DeploymentTriggerImageChangeParams)
if err := Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(*in, *out, s); err != nil {
return err
}
} else {
out.ImageChangeParams = nil
}
return nil
}
func Convert_v1_DeploymentTriggerPolicy_To_api_DeploymentTriggerPolicy(in *DeploymentTriggerPolicy, out *deploy_api.DeploymentTriggerPolicy, s conversion.Scope) error {
return autoConvert_v1_DeploymentTriggerPolicy_To_api_DeploymentTriggerPolicy(in, out, s)
}
func autoConvert_api_DeploymentTriggerPolicy_To_v1_DeploymentTriggerPolicy(in *deploy_api.DeploymentTriggerPolicy, out *DeploymentTriggerPolicy, s conversion.Scope) error {
out.Type = DeploymentTriggerType(in.Type)
if in.ImageChangeParams != nil {
in, out := &in.ImageChangeParams, &out.ImageChangeParams
*out = new(DeploymentTriggerImageChangeParams)
if err := Convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(*in, *out, s); err != nil {
return err
}
} else {
out.ImageChangeParams = nil
}
return nil
}
func Convert_api_DeploymentTriggerPolicy_To_v1_DeploymentTriggerPolicy(in *deploy_api.DeploymentTriggerPolicy, out *DeploymentTriggerPolicy, s conversion.Scope) error {
return autoConvert_api_DeploymentTriggerPolicy_To_v1_DeploymentTriggerPolicy(in, out, s)
}
func autoConvert_v1_ExecNewPodHook_To_api_ExecNewPodHook(in *ExecNewPodHook, out *deploy_api.ExecNewPodHook, s conversion.Scope) error {
out.Command = in.Command
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]api.EnvVar, len(*in))
for i := range *in {
if err := api_v1.Convert_v1_EnvVar_To_api_EnvVar(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Env = nil
}
out.ContainerName = in.ContainerName
out.Volumes = in.Volumes
return nil
}
func Convert_v1_ExecNewPodHook_To_api_ExecNewPodHook(in *ExecNewPodHook, out *deploy_api.ExecNewPodHook, s conversion.Scope) error {
return autoConvert_v1_ExecNewPodHook_To_api_ExecNewPodHook(in, out, s)
}
func autoConvert_api_ExecNewPodHook_To_v1_ExecNewPodHook(in *deploy_api.ExecNewPodHook, out *ExecNewPodHook, s conversion.Scope) error {
out.Command = in.Command
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]api_v1.EnvVar, len(*in))
for i := range *in {
if err := api_v1.Convert_api_EnvVar_To_v1_EnvVar(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Env = nil
}
out.ContainerName = in.ContainerName
out.Volumes = in.Volumes
return nil
}
func Convert_api_ExecNewPodHook_To_v1_ExecNewPodHook(in *deploy_api.ExecNewPodHook, out *ExecNewPodHook, s conversion.Scope) error {
return autoConvert_api_ExecNewPodHook_To_v1_ExecNewPodHook(in, out, s)
}
func autoConvert_v1_LifecycleHook_To_api_LifecycleHook(in *LifecycleHook, out *deploy_api.LifecycleHook, s conversion.Scope) error {
out.FailurePolicy = deploy_api.LifecycleHookFailurePolicy(in.FailurePolicy)
if in.ExecNewPod != nil {
in, out := &in.ExecNewPod, &out.ExecNewPod
*out = new(deploy_api.ExecNewPodHook)
if err := Convert_v1_ExecNewPodHook_To_api_ExecNewPodHook(*in, *out, s); err != nil {
return err
}
} else {
out.ExecNewPod = nil
}
if in.TagImages != nil {
in, out := &in.TagImages, &out.TagImages
*out = make([]deploy_api.TagImageHook, len(*in))
for i := range *in {
if err := Convert_v1_TagImageHook_To_api_TagImageHook(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.TagImages = nil
}
return nil
}
func Convert_v1_LifecycleHook_To_api_LifecycleHook(in *LifecycleHook, out *deploy_api.LifecycleHook, s conversion.Scope) error {
return autoConvert_v1_LifecycleHook_To_api_LifecycleHook(in, out, s)
}
func autoConvert_api_LifecycleHook_To_v1_LifecycleHook(in *deploy_api.LifecycleHook, out *LifecycleHook, s conversion.Scope) error {
out.FailurePolicy = LifecycleHookFailurePolicy(in.FailurePolicy)
if in.ExecNewPod != nil {
in, out := &in.ExecNewPod, &out.ExecNewPod
*out = new(ExecNewPodHook)
if err := Convert_api_ExecNewPodHook_To_v1_ExecNewPodHook(*in, *out, s); err != nil {
return err
}
} else {
out.ExecNewPod = nil
}
if in.TagImages != nil {
in, out := &in.TagImages, &out.TagImages
*out = make([]TagImageHook, len(*in))
for i := range *in {
if err := Convert_api_TagImageHook_To_v1_TagImageHook(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.TagImages = nil
}
return nil
}
func Convert_api_LifecycleHook_To_v1_LifecycleHook(in *deploy_api.LifecycleHook, out *LifecycleHook, s conversion.Scope) error {
return autoConvert_api_LifecycleHook_To_v1_LifecycleHook(in, out, s)
}
func autoConvert_v1_RecreateDeploymentStrategyParams_To_api_RecreateDeploymentStrategyParams(in *RecreateDeploymentStrategyParams, out *deploy_api.RecreateDeploymentStrategyParams, s conversion.Scope) error {
SetDefaults_RecreateDeploymentStrategyParams(in)
out.TimeoutSeconds = in.TimeoutSeconds
if in.Pre != nil {
in, out := &in.Pre, &out.Pre
*out = new(deploy_api.LifecycleHook)
if err := Convert_v1_LifecycleHook_To_api_LifecycleHook(*in, *out, s); err != nil {
return err
}
} else {
out.Pre = nil
}
if in.Mid != nil {
in, out := &in.Mid, &out.Mid
*out = new(deploy_api.LifecycleHook)
if err := Convert_v1_LifecycleHook_To_api_LifecycleHook(*in, *out, s); err != nil {
return err
}
} else {
out.Mid = nil
}
if in.Post != nil {
in, out := &in.Post, &out.Post
*out = new(deploy_api.LifecycleHook)
if err := Convert_v1_LifecycleHook_To_api_LifecycleHook(*in, *out, s); err != nil {
return err
}
} else {
out.Post = nil
}
return nil
}
func Convert_v1_RecreateDeploymentStrategyParams_To_api_RecreateDeploymentStrategyParams(in *RecreateDeploymentStrategyParams, out *deploy_api.RecreateDeploymentStrategyParams, s conversion.Scope) error {
return autoConvert_v1_RecreateDeploymentStrategyParams_To_api_RecreateDeploymentStrategyParams(in, out, s)
}
func autoConvert_api_RecreateDeploymentStrategyParams_To_v1_RecreateDeploymentStrategyParams(in *deploy_api.RecreateDeploymentStrategyParams, out *RecreateDeploymentStrategyParams, s conversion.Scope) error {
out.TimeoutSeconds = in.TimeoutSeconds
if in.Pre != nil {
in, out := &in.Pre, &out.Pre
*out = new(LifecycleHook)
if err := Convert_api_LifecycleHook_To_v1_LifecycleHook(*in, *out, s); err != nil {
return err
}
} else {
out.Pre = nil
}
if in.Mid != nil {
in, out := &in.Mid, &out.Mid
*out = new(LifecycleHook)
if err := Convert_api_LifecycleHook_To_v1_LifecycleHook(*in, *out, s); err != nil {
return err
}
} else {
out.Mid = nil
}
if in.Post != nil {
in, out := &in.Post, &out.Post
*out = new(LifecycleHook)
if err := Convert_api_LifecycleHook_To_v1_LifecycleHook(*in, *out, s); err != nil {
return err
}
} else {
out.Post = nil
}
return nil
}
func Convert_api_RecreateDeploymentStrategyParams_To_v1_RecreateDeploymentStrategyParams(in *deploy_api.RecreateDeploymentStrategyParams, out *RecreateDeploymentStrategyParams, s conversion.Scope) error {
return autoConvert_api_RecreateDeploymentStrategyParams_To_v1_RecreateDeploymentStrategyParams(in, out, s)
}
func autoConvert_v1_TagImageHook_To_api_TagImageHook(in *TagImageHook, out *deploy_api.TagImageHook, s conversion.Scope) error {
out.ContainerName = in.ContainerName
if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(&in.To, &out.To, s); err != nil {
return err
}
return nil
}
func Convert_v1_TagImageHook_To_api_TagImageHook(in *TagImageHook, out *deploy_api.TagImageHook, s conversion.Scope) error {
return autoConvert_v1_TagImageHook_To_api_TagImageHook(in, out, s)
}
func autoConvert_api_TagImageHook_To_v1_TagImageHook(in *deploy_api.TagImageHook, out *TagImageHook, s conversion.Scope) error {
out.ContainerName = in.ContainerName
if err := api_v1.Convert_api_ObjectReference_To_v1_ObjectReference(&in.To, &out.To, s); err != nil {
return err
}
return nil
}
func Convert_api_TagImageHook_To_v1_TagImageHook(in *deploy_api.TagImageHook, out *TagImageHook, s conversion.Scope) error {
return autoConvert_api_TagImageHook_To_v1_TagImageHook(in, out, s)
}
@@ -0,0 +1,544 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
intstr "k8s.io/kubernetes/pkg/util/intstr"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_v1_CustomDeploymentStrategyParams,
DeepCopy_v1_DeploymentCause,
DeepCopy_v1_DeploymentCauseImageTrigger,
DeepCopy_v1_DeploymentConfig,
DeepCopy_v1_DeploymentConfigList,
DeepCopy_v1_DeploymentConfigRollback,
DeepCopy_v1_DeploymentConfigRollbackSpec,
DeepCopy_v1_DeploymentConfigSpec,
DeepCopy_v1_DeploymentConfigStatus,
DeepCopy_v1_DeploymentDetails,
DeepCopy_v1_DeploymentLog,
DeepCopy_v1_DeploymentLogOptions,
DeepCopy_v1_DeploymentStrategy,
DeepCopy_v1_DeploymentTriggerImageChangeParams,
DeepCopy_v1_DeploymentTriggerPolicy,
DeepCopy_v1_ExecNewPodHook,
DeepCopy_v1_LifecycleHook,
DeepCopy_v1_RecreateDeploymentStrategyParams,
DeepCopy_v1_RollingDeploymentStrategyParams,
DeepCopy_v1_TagImageHook,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_v1_CustomDeploymentStrategyParams(in CustomDeploymentStrategyParams, out *CustomDeploymentStrategyParams, c *conversion.Cloner) error {
out.Image = in.Image
if in.Environment != nil {
in, out := in.Environment, &out.Environment
*out = make([]api_v1.EnvVar, len(in))
for i := range in {
if err := api_v1.DeepCopy_v1_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Environment = nil
}
if in.Command != nil {
in, out := in.Command, &out.Command
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Command = nil
}
return nil
}
func DeepCopy_v1_DeploymentCause(in DeploymentCause, out *DeploymentCause, c *conversion.Cloner) error {
out.Type = in.Type
if in.ImageTrigger != nil {
in, out := in.ImageTrigger, &out.ImageTrigger
*out = new(DeploymentCauseImageTrigger)
if err := DeepCopy_v1_DeploymentCauseImageTrigger(*in, *out, c); err != nil {
return err
}
} else {
out.ImageTrigger = nil
}
return nil
}
func DeepCopy_v1_DeploymentCauseImageTrigger(in DeploymentCauseImageTrigger, out *DeploymentCauseImageTrigger, c *conversion.Cloner) error {
if err := api_v1.DeepCopy_v1_ObjectReference(in.From, &out.From, c); err != nil {
return err
}
return nil
}
func DeepCopy_v1_DeploymentConfig(in DeploymentConfig, out *DeploymentConfig, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api_v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_v1_DeploymentConfigSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1_DeploymentConfigStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_v1_DeploymentConfigList(in DeploymentConfigList, out *DeploymentConfigList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]DeploymentConfig, len(in))
for i := range in {
if err := DeepCopy_v1_DeploymentConfig(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_v1_DeploymentConfigRollback(in DeploymentConfigRollback, out *DeploymentConfigRollback, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Name = in.Name
if in.UpdatedAnnotations != nil {
in, out := in.UpdatedAnnotations, &out.UpdatedAnnotations
*out = make(map[string]string)
for key, val := range in {
(*out)[key] = val
}
} else {
out.UpdatedAnnotations = nil
}
if err := DeepCopy_v1_DeploymentConfigRollbackSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
return nil
}
func DeepCopy_v1_DeploymentConfigRollbackSpec(in DeploymentConfigRollbackSpec, out *DeploymentConfigRollbackSpec, c *conversion.Cloner) error {
if err := api_v1.DeepCopy_v1_ObjectReference(in.From, &out.From, c); err != nil {
return err
}
out.Revision = in.Revision
out.IncludeTriggers = in.IncludeTriggers
out.IncludeTemplate = in.IncludeTemplate
out.IncludeReplicationMeta = in.IncludeReplicationMeta
out.IncludeStrategy = in.IncludeStrategy
return nil
}
func DeepCopy_v1_DeploymentConfigSpec(in DeploymentConfigSpec, out *DeploymentConfigSpec, c *conversion.Cloner) error {
if err := DeepCopy_v1_DeploymentStrategy(in.Strategy, &out.Strategy, c); err != nil {
return err
}
out.MinReadySeconds = in.MinReadySeconds
if in.Triggers != nil {
in, out := in.Triggers, &out.Triggers
*out = make([]DeploymentTriggerPolicy, len(in))
for i := range in {
if err := DeepCopy_v1_DeploymentTriggerPolicy(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Triggers = nil
}
out.Replicas = in.Replicas
if in.RevisionHistoryLimit != nil {
in, out := in.RevisionHistoryLimit, &out.RevisionHistoryLimit
*out = new(int32)
**out = *in
} else {
out.RevisionHistoryLimit = nil
}
out.Test = in.Test
out.Paused = in.Paused
if in.Selector != nil {
in, out := in.Selector, &out.Selector
*out = make(map[string]string)
for key, val := range in {
(*out)[key] = val
}
} else {
out.Selector = nil
}
if in.Template != nil {
in, out := in.Template, &out.Template
*out = new(api_v1.PodTemplateSpec)
if err := api_v1.DeepCopy_v1_PodTemplateSpec(*in, *out, c); err != nil {
return err
}
} else {
out.Template = nil
}
return nil
}
func DeepCopy_v1_DeploymentConfigStatus(in DeploymentConfigStatus, out *DeploymentConfigStatus, c *conversion.Cloner) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := in.Details, &out.Details
*out = new(DeploymentDetails)
if err := DeepCopy_v1_DeploymentDetails(*in, *out, c); err != nil {
return err
}
} else {
out.Details = nil
}
return nil
}
func DeepCopy_v1_DeploymentDetails(in DeploymentDetails, out *DeploymentDetails, c *conversion.Cloner) error {
out.Message = in.Message
if in.Causes != nil {
in, out := in.Causes, &out.Causes
*out = make([]DeploymentCause, len(in))
for i := range in {
if err := DeepCopy_v1_DeploymentCause(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Causes = nil
}
return nil
}
func DeepCopy_v1_DeploymentLog(in DeploymentLog, out *DeploymentLog, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
return nil
}
func DeepCopy_v1_DeploymentLogOptions(in DeploymentLogOptions, out *DeploymentLogOptions, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Container = in.Container
out.Follow = in.Follow
out.Previous = in.Previous
if in.SinceSeconds != nil {
in, out := in.SinceSeconds, &out.SinceSeconds
*out = new(int64)
**out = *in
} else {
out.SinceSeconds = nil
}
if in.SinceTime != nil {
in, out := in.SinceTime, &out.SinceTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.SinceTime = nil
}
out.Timestamps = in.Timestamps
if in.TailLines != nil {
in, out := in.TailLines, &out.TailLines
*out = new(int64)
**out = *in
} else {
out.TailLines = nil
}
if in.LimitBytes != nil {
in, out := in.LimitBytes, &out.LimitBytes
*out = new(int64)
**out = *in
} else {
out.LimitBytes = nil
}
out.NoWait = in.NoWait
if in.Version != nil {
in, out := in.Version, &out.Version
*out = new(int64)
**out = *in
} else {
out.Version = nil
}
return nil
}
func DeepCopy_v1_DeploymentStrategy(in DeploymentStrategy, out *DeploymentStrategy, c *conversion.Cloner) error {
out.Type = in.Type
if in.CustomParams != nil {
in, out := in.CustomParams, &out.CustomParams
*out = new(CustomDeploymentStrategyParams)
if err := DeepCopy_v1_CustomDeploymentStrategyParams(*in, *out, c); err != nil {
return err
}
} else {
out.CustomParams = nil
}
if in.RecreateParams != nil {
in, out := in.RecreateParams, &out.RecreateParams
*out = new(RecreateDeploymentStrategyParams)
if err := DeepCopy_v1_RecreateDeploymentStrategyParams(*in, *out, c); err != nil {
return err
}
} else {
out.RecreateParams = nil
}
if in.RollingParams != nil {
in, out := in.RollingParams, &out.RollingParams
*out = new(RollingDeploymentStrategyParams)
if err := DeepCopy_v1_RollingDeploymentStrategyParams(*in, *out, c); err != nil {
return err
}
} else {
out.RollingParams = nil
}
if err := api_v1.DeepCopy_v1_ResourceRequirements(in.Resources, &out.Resources, c); err != nil {
return err
}
if in.Labels != nil {
in, out := in.Labels, &out.Labels
*out = make(map[string]string)
for key, val := range in {
(*out)[key] = val
}
} else {
out.Labels = nil
}
if in.Annotations != nil {
in, out := in.Annotations, &out.Annotations
*out = make(map[string]string)
for key, val := range in {
(*out)[key] = val
}
} else {
out.Annotations = nil
}
return nil
}
func DeepCopy_v1_DeploymentTriggerImageChangeParams(in DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, c *conversion.Cloner) error {
out.Automatic = in.Automatic
if in.ContainerNames != nil {
in, out := in.ContainerNames, &out.ContainerNames
*out = make([]string, len(in))
copy(*out, in)
} else {
out.ContainerNames = nil
}
if err := api_v1.DeepCopy_v1_ObjectReference(in.From, &out.From, c); err != nil {
return err
}
out.LastTriggeredImage = in.LastTriggeredImage
return nil
}
func DeepCopy_v1_DeploymentTriggerPolicy(in DeploymentTriggerPolicy, out *DeploymentTriggerPolicy, c *conversion.Cloner) error {
out.Type = in.Type
if in.ImageChangeParams != nil {
in, out := in.ImageChangeParams, &out.ImageChangeParams
*out = new(DeploymentTriggerImageChangeParams)
if err := DeepCopy_v1_DeploymentTriggerImageChangeParams(*in, *out, c); err != nil {
return err
}
} else {
out.ImageChangeParams = nil
}
return nil
}
func DeepCopy_v1_ExecNewPodHook(in ExecNewPodHook, out *ExecNewPodHook, c *conversion.Cloner) error {
if in.Command != nil {
in, out := in.Command, &out.Command
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Command = nil
}
if in.Env != nil {
in, out := in.Env, &out.Env
*out = make([]api_v1.EnvVar, len(in))
for i := range in {
if err := api_v1.DeepCopy_v1_EnvVar(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Env = nil
}
out.ContainerName = in.ContainerName
if in.Volumes != nil {
in, out := in.Volumes, &out.Volumes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Volumes = nil
}
return nil
}
func DeepCopy_v1_LifecycleHook(in LifecycleHook, out *LifecycleHook, c *conversion.Cloner) error {
out.FailurePolicy = in.FailurePolicy
if in.ExecNewPod != nil {
in, out := in.ExecNewPod, &out.ExecNewPod
*out = new(ExecNewPodHook)
if err := DeepCopy_v1_ExecNewPodHook(*in, *out, c); err != nil {
return err
}
} else {
out.ExecNewPod = nil
}
if in.TagImages != nil {
in, out := in.TagImages, &out.TagImages
*out = make([]TagImageHook, len(in))
for i := range in {
if err := DeepCopy_v1_TagImageHook(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.TagImages = nil
}
return nil
}
func DeepCopy_v1_RecreateDeploymentStrategyParams(in RecreateDeploymentStrategyParams, out *RecreateDeploymentStrategyParams, c *conversion.Cloner) error {
if in.TimeoutSeconds != nil {
in, out := in.TimeoutSeconds, &out.TimeoutSeconds
*out = new(int64)
**out = *in
} else {
out.TimeoutSeconds = nil
}
if in.Pre != nil {
in, out := in.Pre, &out.Pre
*out = new(LifecycleHook)
if err := DeepCopy_v1_LifecycleHook(*in, *out, c); err != nil {
return err
}
} else {
out.Pre = nil
}
if in.Mid != nil {
in, out := in.Mid, &out.Mid
*out = new(LifecycleHook)
if err := DeepCopy_v1_LifecycleHook(*in, *out, c); err != nil {
return err
}
} else {
out.Mid = nil
}
if in.Post != nil {
in, out := in.Post, &out.Post
*out = new(LifecycleHook)
if err := DeepCopy_v1_LifecycleHook(*in, *out, c); err != nil {
return err
}
} else {
out.Post = nil
}
return nil
}
func DeepCopy_v1_RollingDeploymentStrategyParams(in RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, c *conversion.Cloner) error {
if in.UpdatePeriodSeconds != nil {
in, out := in.UpdatePeriodSeconds, &out.UpdatePeriodSeconds
*out = new(int64)
**out = *in
} else {
out.UpdatePeriodSeconds = nil
}
if in.IntervalSeconds != nil {
in, out := in.IntervalSeconds, &out.IntervalSeconds
*out = new(int64)
**out = *in
} else {
out.IntervalSeconds = nil
}
if in.TimeoutSeconds != nil {
in, out := in.TimeoutSeconds, &out.TimeoutSeconds
*out = new(int64)
**out = *in
} else {
out.TimeoutSeconds = nil
}
if in.MaxUnavailable != nil {
in, out := in.MaxUnavailable, &out.MaxUnavailable
*out = new(intstr.IntOrString)
if err := intstr.DeepCopy_intstr_IntOrString(*in, *out, c); err != nil {
return err
}
} else {
out.MaxUnavailable = nil
}
if in.MaxSurge != nil {
in, out := in.MaxSurge, &out.MaxSurge
*out = new(intstr.IntOrString)
if err := intstr.DeepCopy_intstr_IntOrString(*in, *out, c); err != nil {
return err
}
} else {
out.MaxSurge = nil
}
if in.UpdatePercent != nil {
in, out := in.UpdatePercent, &out.UpdatePercent
*out = new(int32)
**out = *in
} else {
out.UpdatePercent = nil
}
if in.Pre != nil {
in, out := in.Pre, &out.Pre
*out = new(LifecycleHook)
if err := DeepCopy_v1_LifecycleHook(*in, *out, c); err != nil {
return err
}
} else {
out.Pre = nil
}
if in.Post != nil {
in, out := in.Post, &out.Post
*out = new(LifecycleHook)
if err := DeepCopy_v1_LifecycleHook(*in, *out, c); err != nil {
return err
}
} else {
out.Post = nil
}
return nil
}
func DeepCopy_v1_TagImageHook(in TagImageHook, out *TagImageHook, c *conversion.Cloner) error {
out.ContainerName = in.ContainerName
if err := api_v1.DeepCopy_v1_ObjectReference(in.To, &out.To, c); err != nil {
return err
}
return nil
}
+127
View File
@@ -0,0 +1,127 @@
package v1
import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/intstr"
deployapi "github.com/openshift/origin/pkg/deploy/api"
)
// Keep this in sync with pkg/api/serialization_test.go#defaultHookContainerName
func defaultHookContainerName(hook *LifecycleHook, containerName string) {
if hook == nil {
return
}
for i := range hook.TagImages {
if len(hook.TagImages[i].ContainerName) == 0 {
hook.TagImages[i].ContainerName = containerName
}
}
if hook.ExecNewPod != nil {
if len(hook.ExecNewPod.ContainerName) == 0 {
hook.ExecNewPod.ContainerName = containerName
}
}
}
func SetDefaults_DeploymentConfigSpec(obj *DeploymentConfigSpec) {
if obj.Triggers == nil {
obj.Triggers = []DeploymentTriggerPolicy{
{Type: DeploymentTriggerOnConfigChange},
}
}
if len(obj.Selector) == 0 && obj.Template != nil {
obj.Selector = obj.Template.Labels
}
// if you only specify a single container, default the TagImages hook to the container name
if obj.Template != nil && len(obj.Template.Spec.Containers) == 1 {
containerName := obj.Template.Spec.Containers[0].Name
if p := obj.Strategy.RecreateParams; p != nil {
defaultHookContainerName(p.Pre, containerName)
defaultHookContainerName(p.Mid, containerName)
defaultHookContainerName(p.Post, containerName)
}
if p := obj.Strategy.RollingParams; p != nil {
defaultHookContainerName(p.Pre, containerName)
defaultHookContainerName(p.Post, containerName)
}
}
}
func SetDefaults_DeploymentStrategy(obj *DeploymentStrategy) {
if len(obj.Type) == 0 {
obj.Type = DeploymentStrategyTypeRolling
}
if obj.Type == DeploymentStrategyTypeRolling && obj.RollingParams == nil {
obj.RollingParams = &RollingDeploymentStrategyParams{
IntervalSeconds: mkintp(deployapi.DefaultRollingIntervalSeconds),
UpdatePeriodSeconds: mkintp(deployapi.DefaultRollingUpdatePeriodSeconds),
TimeoutSeconds: mkintp(deployapi.DefaultRollingTimeoutSeconds),
}
}
if obj.Type == DeploymentStrategyTypeRecreate && obj.RecreateParams == nil {
obj.RecreateParams = &RecreateDeploymentStrategyParams{}
}
}
func SetDefaults_RecreateDeploymentStrategyParams(obj *RecreateDeploymentStrategyParams) {
if obj.TimeoutSeconds == nil {
obj.TimeoutSeconds = mkintp(deployapi.DefaultRollingTimeoutSeconds)
}
}
func SetDefaults_RollingDeploymentStrategyParams(obj *RollingDeploymentStrategyParams) {
if obj.IntervalSeconds == nil {
obj.IntervalSeconds = mkintp(deployapi.DefaultRollingIntervalSeconds)
}
if obj.UpdatePeriodSeconds == nil {
obj.UpdatePeriodSeconds = mkintp(deployapi.DefaultRollingUpdatePeriodSeconds)
}
if obj.TimeoutSeconds == nil {
obj.TimeoutSeconds = mkintp(deployapi.DefaultRollingTimeoutSeconds)
}
if obj.UpdatePercent == nil {
// Apply defaults.
if obj.MaxUnavailable == nil {
maxUnavailable := intstr.FromString("25%")
obj.MaxUnavailable = &maxUnavailable
}
if obj.MaxSurge == nil {
maxSurge := intstr.FromString("25%")
obj.MaxSurge = &maxSurge
}
}
}
func SetDefaults_DeploymentConfig(obj *DeploymentConfig) {
for _, t := range obj.Spec.Triggers {
if t.ImageChangeParams != nil {
// Default unconditionally for transforming old data.
t.ImageChangeParams.From.Kind = "ImageStreamTag"
if len(t.ImageChangeParams.From.Namespace) == 0 {
t.ImageChangeParams.From.Namespace = obj.Namespace
}
}
}
}
func mkintp(i int64) *int64 {
return &i
}
func addDefaultingFuncs(scheme *runtime.Scheme) {
err := scheme.AddDefaultingFuncs(
SetDefaults_DeploymentConfigSpec,
SetDefaults_DeploymentStrategy,
SetDefaults_RecreateDeploymentStrategyParams,
SetDefaults_RollingDeploymentStrategyParams,
SetDefaults_DeploymentConfig,
)
if err != nil {
panic(err)
}
}
+3
View File
@@ -0,0 +1,3 @@
// Package v1 is the v1 version of the API.
// +genconversion=true
package v1
File diff suppressed because it is too large Load Diff
+401
View File
@@ -0,0 +1,401 @@
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package github.com.openshift.origin.pkg.deploy.api.v1;
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/apis/extensions/v1beta1/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1";
// CustomDeploymentStrategyParams are the input to the Custom deployment strategy.
message CustomDeploymentStrategyParams {
// Image specifies a Docker image which can carry out a deployment.
optional string image = 1;
// Environment holds the environment which will be given to the container for Image.
repeated k8s.io.kubernetes.pkg.api.v1.EnvVar environment = 2;
// Command is optional and overrides CMD in the container Image.
repeated string command = 3;
}
// DeploymentCause captures information about a particular cause of a deployment.
message DeploymentCause {
// Type of the trigger that resulted in the creation of a new deployment
optional string type = 1;
// ImageTrigger contains the image trigger details, if this trigger was fired based on an image change
optional DeploymentCauseImageTrigger imageTrigger = 2;
}
// DeploymentCauseImageTrigger represents details about the cause of a deployment originating
// from an image change trigger
message DeploymentCauseImageTrigger {
// From is a reference to the changed object which triggered a deployment. The field may have
// the kinds DockerImage, ImageStreamTag, or ImageStreamImage.
optional k8s.io.kubernetes.pkg.api.v1.ObjectReference from = 1;
}
// DeploymentConfig represents a configuration for a single deployment (represented as a
// ReplicationController). It also contains details about changes which resulted in the current
// state of the DeploymentConfig. Each change to the DeploymentConfig which should result in
// a new deployment results in an increment of LatestVersion.
message DeploymentConfig {
// Standard object's metadata.
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// Spec represents a desired deployment state and how to deploy to it.
optional DeploymentConfigSpec spec = 2;
// Status represents the current deployment state.
optional DeploymentConfigStatus status = 3;
}
// DeploymentConfigList is a collection of deployment configs.
message DeploymentConfigList {
// Standard object's metadata.
optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1;
// Items is a list of deployment configs
repeated DeploymentConfig items = 2;
}
// DeploymentConfigRollback provides the input to rollback generation.
message DeploymentConfigRollback {
// Name of the deployment config that will be rolled back.
optional string name = 1;
// UpdatedAnnotations is a set of new annotations that will be added in the deployment config.
map<string, string> updatedAnnotations = 2;
// Spec defines the options to rollback generation.
optional DeploymentConfigRollbackSpec spec = 3;
}
// DeploymentConfigRollbackSpec represents the options for rollback generation.
message DeploymentConfigRollbackSpec {
// From points to a ReplicationController which is a deployment.
optional k8s.io.kubernetes.pkg.api.v1.ObjectReference from = 1;
// Revision to rollback to. If set to 0, rollback to the last revision.
optional int64 revision = 2;
// IncludeTriggers specifies whether to include config Triggers.
optional bool includeTriggers = 3;
// IncludeTemplate specifies whether to include the PodTemplateSpec.
optional bool includeTemplate = 4;
// IncludeReplicationMeta specifies whether to include the replica count and selector.
optional bool includeReplicationMeta = 5;
// IncludeStrategy specifies whether to include the deployment Strategy.
optional bool includeStrategy = 6;
}
// DeploymentConfigSpec represents the desired state of the deployment.
message DeploymentConfigSpec {
// Strategy describes how a deployment is executed.
optional DeploymentStrategy strategy = 1;
// MinReadySeconds is the minimum number of seconds for which a newly created pod should
// be ready without any of its container crashing, for it to be considered available.
// Defaults to 0 (pod will be considered available as soon as it is ready)
optional int32 minReadySeconds = 9;
// Triggers determine how updates to a DeploymentConfig result in new deployments. If no triggers
// are defined, a new deployment can only occur as a result of an explicit client update to the
// DeploymentConfig with a new LatestVersion.
repeated DeploymentTriggerPolicy triggers = 2;
// Replicas is the number of desired replicas.
optional int32 replicas = 3;
// RevisionHistoryLimit is the number of old ReplicationControllers to retain to allow for rollbacks.
// This field is a pointer to allow for differentiation between an explicit zero and not specified.
optional int32 revisionHistoryLimit = 4;
// Test ensures that this deployment config will have zero replicas except while a deployment is running. This allows the
// deployment config to be used as a continuous deployment test - triggering on images, running the deployment, and then succeeding
// or failing. Post strategy hooks and After actions can be used to integrate successful deployment with an action.
optional bool test = 5;
// Paused indicates that the deployment config is paused resulting in no new deployments on template
// changes or changes in the template caused by other triggers.
optional bool paused = 6;
// Selector is a label query over pods that should match the Replicas count.
map<string, string> selector = 7;
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
optional k8s.io.kubernetes.pkg.api.v1.PodTemplateSpec template = 8;
}
// DeploymentConfigStatus represents the current deployment state.
message DeploymentConfigStatus {
// LatestVersion is used to determine whether the current deployment associated with a deployment
// config is out of sync.
optional int64 latestVersion = 1;
// ObservedGeneration is the most recent generation observed by the deployment config controller.
optional int64 observedGeneration = 2;
// Replicas is the total number of pods targeted by this deployment config.
optional int32 replicas = 3;
// UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config
// that have the desired template spec.
optional int32 updatedReplicas = 4;
// AvailableReplicas is the total number of available pods targeted by this deployment config.
optional int32 availableReplicas = 5;
// UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.
optional int32 unavailableReplicas = 6;
// Details are the reasons for the update to this deployment config.
// This could be based on a change made by the user or caused by an automatic trigger
optional DeploymentDetails details = 7;
}
// DeploymentDetails captures information about the causes of a deployment.
message DeploymentDetails {
// Message is the user specified change message, if this deployment was triggered manually by the user
optional string message = 1;
// Causes are extended data associated with all the causes for creating a new deployment
repeated DeploymentCause causes = 2;
}
// DeploymentLog represents the logs for a deployment
message DeploymentLog {
}
// DeploymentLogOptions is the REST options for a deployment log
message DeploymentLogOptions {
// The container for which to stream logs. Defaults to only container if there is one container in the pod.
optional string container = 1;
// Follow if true indicates that the build log should be streamed until
// the build terminates.
optional bool follow = 2;
// Return previous deployment logs. Defaults to false.
optional bool previous = 3;
// A relative time in seconds before the current time from which to show logs. If this value
// precedes the time a pod was started, only logs since the pod start will be returned.
// If this value is in the future, no logs will be returned.
// Only one of sinceSeconds or sinceTime may be specified.
optional int64 sinceSeconds = 4;
// An RFC3339 timestamp from which to show logs. If this value
// precedes the time a pod was started, only logs since the pod start will be returned.
// If this value is in the future, no logs will be returned.
// Only one of sinceSeconds or sinceTime may be specified.
optional k8s.io.kubernetes.pkg.api.unversioned.Time sinceTime = 5;
// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
// of log output. Defaults to false.
optional bool timestamps = 6;
// If set, the number of lines from the end of the logs to show. If not specified,
// logs are shown from the creation of the container or sinceSeconds or sinceTime
optional int64 tailLines = 7;
// If set, the number of bytes to read from the server before terminating the
// log output. This may not display a complete final line of logging, and may return
// slightly more or slightly less than the specified limit.
optional int64 limitBytes = 8;
// NoWait if true causes the call to return immediately even if the deployment
// is not available yet. Otherwise the server will wait until the deployment has started.
// TODO: Fix the tag to 'noWait' in v2
optional bool nowait = 9;
// Version of the deployment for which to view logs.
optional int64 version = 10;
}
// DeploymentStrategy describes how to perform a deployment.
message DeploymentStrategy {
// Type is the name of a deployment strategy.
optional string type = 1;
// CustomParams are the input to the Custom deployment strategy.
optional CustomDeploymentStrategyParams customParams = 2;
// RecreateParams are the input to the Recreate deployment strategy.
optional RecreateDeploymentStrategyParams recreateParams = 3;
// RollingParams are the input to the Rolling deployment strategy.
optional RollingDeploymentStrategyParams rollingParams = 4;
// Resources contains resource requirements to execute the deployment and any hooks
optional k8s.io.kubernetes.pkg.api.v1.ResourceRequirements resources = 5;
// Labels is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.
map<string, string> labels = 6;
// Annotations is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.
map<string, string> annotations = 7;
}
// DeploymentTriggerImageChangeParams represents the parameters to the ImageChange trigger.
message DeploymentTriggerImageChangeParams {
// Automatic means that the detection of a new tag value should result in an image update
// inside the pod template. Deployment configs that haven't been deployed yet will always
// have their images updated. Deployment configs that have been deployed at least once, will
// have their images updated only if this is set to true.
optional bool automatic = 1;
// ContainerNames is used to restrict tag updates to the specified set of container names in a pod.
repeated string containerNames = 2;
// From is a reference to an image stream tag to watch for changes. From.Name is the only
// required subfield - if From.Namespace is blank, the namespace of the current deployment
// trigger will be used.
optional k8s.io.kubernetes.pkg.api.v1.ObjectReference from = 3;
// LastTriggeredImage is the last image to be triggered.
optional string lastTriggeredImage = 4;
}
// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
message DeploymentTriggerPolicy {
// Type of the trigger
optional string type = 1;
// ImageChangeParams represents the parameters for the ImageChange trigger.
optional DeploymentTriggerImageChangeParams imageChangeParams = 2;
}
// ExecNewPodHook is a hook implementation which runs a command in a new pod
// based on the specified container which is assumed to be part of the
// deployment template.
message ExecNewPodHook {
// Command is the action command and its arguments.
repeated string command = 1;
// Env is a set of environment variables to supply to the hook pod's container.
repeated k8s.io.kubernetes.pkg.api.v1.EnvVar env = 2;
// ContainerName is the name of a container in the deployment pod template
// whose Docker image will be used for the hook pod's container.
optional string containerName = 3;
// Volumes is a list of named volumes from the pod template which should be
// copied to the hook pod. Volumes names not found in pod spec are ignored.
// An empty list means no volumes will be copied.
repeated string volumes = 4;
}
// LifecycleHook defines a specific deployment lifecycle action. Only one type of action may be specified at any time.
message LifecycleHook {
// FailurePolicy specifies what action to take if the hook fails.
optional string failurePolicy = 1;
// ExecNewPod specifies the options for a lifecycle hook backed by a pod.
optional ExecNewPodHook execNewPod = 2;
// TagImages instructs the deployer to tag the current image referenced under a container onto an image stream tag.
repeated TagImageHook tagImages = 3;
}
// RecreateDeploymentStrategyParams are the input to the Recreate deployment
// strategy.
message RecreateDeploymentStrategyParams {
// TimeoutSeconds is the time to wait for updates before giving up. If the
// value is nil, a default will be used.
optional int64 timeoutSeconds = 1;
// Pre is a lifecycle hook which is executed before the strategy manipulates
// the deployment. All LifecycleHookFailurePolicy values are supported.
optional LifecycleHook pre = 2;
// Mid is a lifecycle hook which is executed while the deployment is scaled down to zero before the first new
// pod is created. All LifecycleHookFailurePolicy values are supported.
optional LifecycleHook mid = 3;
// Post is a lifecycle hook which is executed after the strategy has
// finished all deployment logic. All LifecycleHookFailurePolicy values are supported.
optional LifecycleHook post = 4;
}
// RollingDeploymentStrategyParams are the input to the Rolling deployment
// strategy.
message RollingDeploymentStrategyParams {
// UpdatePeriodSeconds is the time to wait between individual pod updates.
// If the value is nil, a default will be used.
optional int64 updatePeriodSeconds = 1;
// IntervalSeconds is the time to wait between polling deployment status
// after update. If the value is nil, a default will be used.
optional int64 intervalSeconds = 2;
// TimeoutSeconds is the time to wait for updates before giving up. If the
// value is nil, a default will be used.
optional int64 timeoutSeconds = 3;
// MaxUnavailable is the maximum number of pods that can be unavailable
// during the update. Value can be an absolute number (ex: 5) or a
// percentage of total pods at the start of update (ex: 10%). Absolute
// number is calculated from percentage by rounding up.
//
// This cannot be 0 if MaxSurge is 0. By default, 25% is used.
//
// Example: when this is set to 30%, the old RC can be scaled down by 30%
// immediately when the rolling update starts. Once new pods are ready, old
// RC can be scaled down further, followed by scaling up the new RC,
// ensuring that at least 70% of original number of pods are available at
// all times during the update.
optional k8s.io.kubernetes.pkg.util.intstr.IntOrString maxUnavailable = 4;
// MaxSurge is the maximum number of pods that can be scheduled above the
// original number of pods. Value can be an absolute number (ex: 5) or a
// percentage of total pods at the start of the update (ex: 10%). Absolute
// number is calculated from percentage by rounding up.
//
// This cannot be 0 if MaxUnavailable is 0. By default, 25% is used.
//
// Example: when this is set to 30%, the new RC can be scaled up by 30%
// immediately when the rolling update starts. Once old pods have been
// killed, new RC can be scaled up further, ensuring that total number of
// pods running at any time during the update is atmost 130% of original
// pods.
optional k8s.io.kubernetes.pkg.util.intstr.IntOrString maxSurge = 5;
// UpdatePercent is the percentage of replicas to scale up or down each
// interval. If nil, one replica will be scaled up and down each interval.
// If negative, the scale order will be down/up instead of up/down.
// DEPRECATED: Use MaxUnavailable/MaxSurge instead.
optional int32 updatePercent = 6;
// Pre is a lifecycle hook which is executed before the deployment process
// begins. All LifecycleHookFailurePolicy values are supported.
optional LifecycleHook pre = 7;
// Post is a lifecycle hook which is executed after the strategy has
// finished all deployment logic. The LifecycleHookFailurePolicyAbort policy
// is NOT supported.
optional LifecycleHook post = 8;
}
// TagImageHook is a request to tag the image in a particular container onto an ImageStreamTag.
message TagImageHook {
// ContainerName is the name of a container in the deployment config whose image value will be used as the source of the tag. If there is only a single
// container this value will be defaulted to the name of that container.
optional string containerName = 1;
// To is the target ImageStreamTag to set the container's image onto.
optional k8s.io.kubernetes.pkg.api.v1.ObjectReference to = 2;
}
+34
View File
@@ -0,0 +1,34 @@
package v1
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1"}
func AddToScheme(scheme *runtime.Scheme) {
addKnownTypes(scheme)
addDefaultingFuncs(scheme)
addConversionFuncs(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&DeploymentConfig{},
&DeploymentConfigList{},
&DeploymentConfigRollback{},
&DeploymentLog{},
&DeploymentLogOptions{},
)
}
func (obj *DeploymentConfig) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *DeploymentConfigList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *DeploymentConfigRollback) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *DeploymentLog) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *DeploymentLogOptions) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+248
View File
@@ -0,0 +1,248 @@
package v1
// This file contains methods that can be used by the go-restful package to generate Swagger
// documentation for the object types found in 'types.go' This file is automatically generated
// by hack/update-generated-swagger-descriptions.sh and should be run after a full build of OpenShift.
// ==== DO NOT EDIT THIS FILE MANUALLY ====
var map_CustomDeploymentStrategyParams = map[string]string{
"": "CustomDeploymentStrategyParams are the input to the Custom deployment strategy.",
"image": "Image specifies a Docker image which can carry out a deployment.",
"environment": "Environment holds the environment which will be given to the container for Image.",
"command": "Command is optional and overrides CMD in the container Image.",
}
func (CustomDeploymentStrategyParams) SwaggerDoc() map[string]string {
return map_CustomDeploymentStrategyParams
}
var map_DeploymentCause = map[string]string{
"": "DeploymentCause captures information about a particular cause of a deployment.",
"type": "Type of the trigger that resulted in the creation of a new deployment",
"imageTrigger": "ImageTrigger contains the image trigger details, if this trigger was fired based on an image change",
}
func (DeploymentCause) SwaggerDoc() map[string]string {
return map_DeploymentCause
}
var map_DeploymentCauseImageTrigger = map[string]string{
"": "DeploymentCauseImageTrigger represents details about the cause of a deployment originating from an image change trigger",
"from": "From is a reference to the changed object which triggered a deployment. The field may have the kinds DockerImage, ImageStreamTag, or ImageStreamImage.",
}
func (DeploymentCauseImageTrigger) SwaggerDoc() map[string]string {
return map_DeploymentCauseImageTrigger
}
var map_DeploymentConfig = map[string]string{
"": "DeploymentConfig represents a configuration for a single deployment (represented as a ReplicationController). It also contains details about changes which resulted in the current state of the DeploymentConfig. Each change to the DeploymentConfig which should result in a new deployment results in an increment of LatestVersion.",
"metadata": "Standard object's metadata.",
"spec": "Spec represents a desired deployment state and how to deploy to it.",
"status": "Status represents the current deployment state.",
}
func (DeploymentConfig) SwaggerDoc() map[string]string {
return map_DeploymentConfig
}
var map_DeploymentConfigList = map[string]string{
"": "DeploymentConfigList is a collection of deployment configs.",
"metadata": "Standard object's metadata.",
"items": "Items is a list of deployment configs",
}
func (DeploymentConfigList) SwaggerDoc() map[string]string {
return map_DeploymentConfigList
}
var map_DeploymentConfigRollback = map[string]string{
"": "DeploymentConfigRollback provides the input to rollback generation.",
"name": "Name of the deployment config that will be rolled back.",
"updatedAnnotations": "UpdatedAnnotations is a set of new annotations that will be added in the deployment config.",
"spec": "Spec defines the options to rollback generation.",
}
func (DeploymentConfigRollback) SwaggerDoc() map[string]string {
return map_DeploymentConfigRollback
}
var map_DeploymentConfigRollbackSpec = map[string]string{
"": "DeploymentConfigRollbackSpec represents the options for rollback generation.",
"from": "From points to a ReplicationController which is a deployment.",
"revision": "Revision to rollback to. If set to 0, rollback to the last revision.",
"includeTriggers": "IncludeTriggers specifies whether to include config Triggers.",
"includeTemplate": "IncludeTemplate specifies whether to include the PodTemplateSpec.",
"includeReplicationMeta": "IncludeReplicationMeta specifies whether to include the replica count and selector.",
"includeStrategy": "IncludeStrategy specifies whether to include the deployment Strategy.",
}
func (DeploymentConfigRollbackSpec) SwaggerDoc() map[string]string {
return map_DeploymentConfigRollbackSpec
}
var map_DeploymentConfigSpec = map[string]string{
"": "DeploymentConfigSpec represents the desired state of the deployment.",
"strategy": "Strategy describes how a deployment is executed.",
"minReadySeconds": "MinReadySeconds is the minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)",
"triggers": "Triggers determine how updates to a DeploymentConfig result in new deployments. If no triggers are defined, a new deployment can only occur as a result of an explicit client update to the DeploymentConfig with a new LatestVersion.",
"replicas": "Replicas is the number of desired replicas.",
"revisionHistoryLimit": "RevisionHistoryLimit is the number of old ReplicationControllers to retain to allow for rollbacks. This field is a pointer to allow for differentiation between an explicit zero and not specified.",
"test": "Test ensures that this deployment config will have zero replicas except while a deployment is running. This allows the deployment config to be used as a continuous deployment test - triggering on images, running the deployment, and then succeeding or failing. Post strategy hooks and After actions can be used to integrate successful deployment with an action.",
"paused": "Paused indicates that the deployment config is paused resulting in no new deployments on template changes or changes in the template caused by other triggers.",
"selector": "Selector is a label query over pods that should match the Replicas count.",
"template": "Template is the object that describes the pod that will be created if insufficient replicas are detected.",
}
func (DeploymentConfigSpec) SwaggerDoc() map[string]string {
return map_DeploymentConfigSpec
}
var map_DeploymentConfigStatus = map[string]string{
"": "DeploymentConfigStatus represents the current deployment state.",
"latestVersion": "LatestVersion is used to determine whether the current deployment associated with a deployment config is out of sync.",
"observedGeneration": "ObservedGeneration is the most recent generation observed by the deployment config controller.",
"replicas": "Replicas is the total number of pods targeted by this deployment config.",
"updatedReplicas": "UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config that have the desired template spec.",
"availableReplicas": "AvailableReplicas is the total number of available pods targeted by this deployment config.",
"unavailableReplicas": "UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.",
"details": "Details are the reasons for the update to this deployment config. This could be based on a change made by the user or caused by an automatic trigger",
}
func (DeploymentConfigStatus) SwaggerDoc() map[string]string {
return map_DeploymentConfigStatus
}
var map_DeploymentDetails = map[string]string{
"": "DeploymentDetails captures information about the causes of a deployment.",
"message": "Message is the user specified change message, if this deployment was triggered manually by the user",
"causes": "Causes are extended data associated with all the causes for creating a new deployment",
}
func (DeploymentDetails) SwaggerDoc() map[string]string {
return map_DeploymentDetails
}
var map_DeploymentLog = map[string]string{
"": "DeploymentLog represents the logs for a deployment",
}
func (DeploymentLog) SwaggerDoc() map[string]string {
return map_DeploymentLog
}
var map_DeploymentLogOptions = map[string]string{
"": "DeploymentLogOptions is the REST options for a deployment log",
"container": "The container for which to stream logs. Defaults to only container if there is one container in the pod.",
"follow": "Follow if true indicates that the build log should be streamed until the build terminates.",
"previous": "Return previous deployment logs. Defaults to false.",
"sinceSeconds": "A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.",
"sinceTime": "An RFC3339 timestamp from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.",
"timestamps": "If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false.",
"tailLines": "If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime",
"limitBytes": "If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit.",
"nowait": "NoWait if true causes the call to return immediately even if the deployment is not available yet. Otherwise the server will wait until the deployment has started.",
"version": "Version of the deployment for which to view logs.",
}
func (DeploymentLogOptions) SwaggerDoc() map[string]string {
return map_DeploymentLogOptions
}
var map_DeploymentStrategy = map[string]string{
"": "DeploymentStrategy describes how to perform a deployment.",
"type": "Type is the name of a deployment strategy.",
"customParams": "CustomParams are the input to the Custom deployment strategy.",
"recreateParams": "RecreateParams are the input to the Recreate deployment strategy.",
"rollingParams": "RollingParams are the input to the Rolling deployment strategy.",
"resources": "Resources contains resource requirements to execute the deployment and any hooks",
"labels": "Labels is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.",
"annotations": "Annotations is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.",
}
func (DeploymentStrategy) SwaggerDoc() map[string]string {
return map_DeploymentStrategy
}
var map_DeploymentTriggerImageChangeParams = map[string]string{
"": "DeploymentTriggerImageChangeParams represents the parameters to the ImageChange trigger.",
"automatic": "Automatic means that the detection of a new tag value should result in an image update inside the pod template. Deployment configs that haven't been deployed yet will always have their images updated. Deployment configs that have been deployed at least once, will have their images updated only if this is set to true.",
"containerNames": "ContainerNames is used to restrict tag updates to the specified set of container names in a pod.",
"from": "From is a reference to an image stream tag to watch for changes. From.Name is the only required subfield - if From.Namespace is blank, the namespace of the current deployment trigger will be used.",
"lastTriggeredImage": "LastTriggeredImage is the last image to be triggered.",
}
func (DeploymentTriggerImageChangeParams) SwaggerDoc() map[string]string {
return map_DeploymentTriggerImageChangeParams
}
var map_DeploymentTriggerPolicy = map[string]string{
"": "DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.",
"type": "Type of the trigger",
"imageChangeParams": "ImageChangeParams represents the parameters for the ImageChange trigger.",
}
func (DeploymentTriggerPolicy) SwaggerDoc() map[string]string {
return map_DeploymentTriggerPolicy
}
var map_ExecNewPodHook = map[string]string{
"": "ExecNewPodHook is a hook implementation which runs a command in a new pod based on the specified container which is assumed to be part of the deployment template.",
"command": "Command is the action command and its arguments.",
"env": "Env is a set of environment variables to supply to the hook pod's container.",
"containerName": "ContainerName is the name of a container in the deployment pod template whose Docker image will be used for the hook pod's container.",
"volumes": "Volumes is a list of named volumes from the pod template which should be copied to the hook pod. Volumes names not found in pod spec are ignored. An empty list means no volumes will be copied.",
}
func (ExecNewPodHook) SwaggerDoc() map[string]string {
return map_ExecNewPodHook
}
var map_LifecycleHook = map[string]string{
"": "LifecycleHook defines a specific deployment lifecycle action. Only one type of action may be specified at any time.",
"failurePolicy": "FailurePolicy specifies what action to take if the hook fails.",
"execNewPod": "ExecNewPod specifies the options for a lifecycle hook backed by a pod.",
"tagImages": "TagImages instructs the deployer to tag the current image referenced under a container onto an image stream tag.",
}
func (LifecycleHook) SwaggerDoc() map[string]string {
return map_LifecycleHook
}
var map_RecreateDeploymentStrategyParams = map[string]string{
"": "RecreateDeploymentStrategyParams are the input to the Recreate deployment strategy.",
"timeoutSeconds": "TimeoutSeconds is the time to wait for updates before giving up. If the value is nil, a default will be used.",
"pre": "Pre is a lifecycle hook which is executed before the strategy manipulates the deployment. All LifecycleHookFailurePolicy values are supported.",
"mid": "Mid is a lifecycle hook which is executed while the deployment is scaled down to zero before the first new pod is created. All LifecycleHookFailurePolicy values are supported.",
"post": "Post is a lifecycle hook which is executed after the strategy has finished all deployment logic. All LifecycleHookFailurePolicy values are supported.",
}
func (RecreateDeploymentStrategyParams) SwaggerDoc() map[string]string {
return map_RecreateDeploymentStrategyParams
}
var map_RollingDeploymentStrategyParams = map[string]string{
"": "RollingDeploymentStrategyParams are the input to the Rolling deployment strategy.",
"updatePeriodSeconds": "UpdatePeriodSeconds is the time to wait between individual pod updates. If the value is nil, a default will be used.",
"intervalSeconds": "IntervalSeconds is the time to wait between polling deployment status after update. If the value is nil, a default will be used.",
"timeoutSeconds": "TimeoutSeconds is the time to wait for updates before giving up. If the value is nil, a default will be used.",
"maxUnavailable": "MaxUnavailable is the maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total pods at the start of update (ex: 10%). Absolute number is calculated from percentage by rounding up.\n\nThis cannot be 0 if MaxSurge is 0. By default, 25% is used.\n\nExample: when this is set to 30%, the old RC can be scaled down by 30% immediately when the rolling update starts. Once new pods are ready, old RC can be scaled down further, followed by scaling up the new RC, ensuring that at least 70% of original number of pods are available at all times during the update.",
"maxSurge": "MaxSurge is the maximum number of pods that can be scheduled above the original number of pods. Value can be an absolute number (ex: 5) or a percentage of total pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up.\n\nThis cannot be 0 if MaxUnavailable is 0. By default, 25% is used.\n\nExample: when this is set to 30%, the new RC can be scaled up by 30% immediately when the rolling update starts. Once old pods have been killed, new RC can be scaled up further, ensuring that total number of pods running at any time during the update is atmost 130% of original pods.",
"updatePercent": "UpdatePercent is the percentage of replicas to scale up or down each interval. If nil, one replica will be scaled up and down each interval. If negative, the scale order will be down/up instead of up/down. DEPRECATED: Use MaxUnavailable/MaxSurge instead.",
"pre": "Pre is a lifecycle hook which is executed before the deployment process begins. All LifecycleHookFailurePolicy values are supported.",
"post": "Post is a lifecycle hook which is executed after the strategy has finished all deployment logic. The LifecycleHookFailurePolicyAbort policy is NOT supported.",
}
func (RollingDeploymentStrategyParams) SwaggerDoc() map[string]string {
return map_RollingDeploymentStrategyParams
}
var map_TagImageHook = map[string]string{
"": "TagImageHook is a request to tag the image in a particular container onto an ImageStreamTag.",
"containerName": "ContainerName is the name of a container in the deployment config whose image value will be used as the source of the tag. If there is only a single container this value will be defaulted to the name of that container.",
"to": "To is the target ImageStreamTag to set the container's image onto.",
}
func (TagImageHook) SwaggerDoc() map[string]string {
return map_TagImageHook
}
+457
View File
@@ -0,0 +1,457 @@
package v1
import (
"k8s.io/kubernetes/pkg/api/unversioned"
kapi "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/intstr"
)
// DeploymentPhase describes the possible states a deployment can be in.
type DeploymentPhase string
const (
// DeploymentPhaseNew means the deployment has been accepted but not yet acted upon.
DeploymentPhaseNew DeploymentPhase = "New"
// DeploymentPhasePending means the deployment been handed over to a deployment strategy,
// but the strategy has not yet declared the deployment to be running.
DeploymentPhasePending DeploymentPhase = "Pending"
// DeploymentPhaseRunning means the deployment strategy has reported the deployment as
// being in-progress.
DeploymentPhaseRunning DeploymentPhase = "Running"
// DeploymentPhaseComplete means the deployment finished without an error.
DeploymentPhaseComplete DeploymentPhase = "Complete"
// DeploymentPhaseFailed means the deployment finished with an error.
DeploymentPhaseFailed DeploymentPhase = "Failed"
)
// DeploymentStrategy describes how to perform a deployment.
type DeploymentStrategy struct {
// Type is the name of a deployment strategy.
Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
// CustomParams are the input to the Custom deployment strategy.
CustomParams *CustomDeploymentStrategyParams `json:"customParams,omitempty" protobuf:"bytes,2,opt,name=customParams"`
// RecreateParams are the input to the Recreate deployment strategy.
RecreateParams *RecreateDeploymentStrategyParams `json:"recreateParams,omitempty" protobuf:"bytes,3,opt,name=recreateParams"`
// RollingParams are the input to the Rolling deployment strategy.
RollingParams *RollingDeploymentStrategyParams `json:"rollingParams,omitempty" protobuf:"bytes,4,opt,name=rollingParams"`
// Resources contains resource requirements to execute the deployment and any hooks
Resources kapi.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,5,opt,name=resources"`
// Labels is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.
Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,6,rep,name=labels"`
// Annotations is a set of key, value pairs added to custom deployer and lifecycle pre/post hook pods.
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,7,rep,name=annotations"`
}
// DeploymentStrategyType refers to a specific DeploymentStrategy implementation.
type DeploymentStrategyType string
const (
// DeploymentStrategyTypeRecreate is a simple strategy suitable as a default.
DeploymentStrategyTypeRecreate DeploymentStrategyType = "Recreate"
// DeploymentStrategyTypeCustom is a user defined strategy.
DeploymentStrategyTypeCustom DeploymentStrategyType = "Custom"
// DeploymentStrategyTypeRolling uses the Kubernetes RollingUpdater.
DeploymentStrategyTypeRolling DeploymentStrategyType = "Rolling"
)
// CustomDeploymentStrategyParams are the input to the Custom deployment strategy.
type CustomDeploymentStrategyParams struct {
// Image specifies a Docker image which can carry out a deployment.
Image string `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"`
// Environment holds the environment which will be given to the container for Image.
Environment []kapi.EnvVar `json:"environment,omitempty" protobuf:"bytes,2,rep,name=environment"`
// Command is optional and overrides CMD in the container Image.
Command []string `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"`
}
// RecreateDeploymentStrategyParams are the input to the Recreate deployment
// strategy.
type RecreateDeploymentStrategyParams struct {
// TimeoutSeconds is the time to wait for updates before giving up. If the
// value is nil, a default will be used.
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,1,opt,name=timeoutSeconds"`
// Pre is a lifecycle hook which is executed before the strategy manipulates
// the deployment. All LifecycleHookFailurePolicy values are supported.
Pre *LifecycleHook `json:"pre,omitempty" protobuf:"bytes,2,opt,name=pre"`
// Mid is a lifecycle hook which is executed while the deployment is scaled down to zero before the first new
// pod is created. All LifecycleHookFailurePolicy values are supported.
Mid *LifecycleHook `json:"mid,omitempty" protobuf:"bytes,3,opt,name=mid"`
// Post is a lifecycle hook which is executed after the strategy has
// finished all deployment logic. All LifecycleHookFailurePolicy values are supported.
Post *LifecycleHook `json:"post,omitempty" protobuf:"bytes,4,opt,name=post"`
}
// LifecycleHook defines a specific deployment lifecycle action. Only one type of action may be specified at any time.
type LifecycleHook struct {
// FailurePolicy specifies what action to take if the hook fails.
FailurePolicy LifecycleHookFailurePolicy `json:"failurePolicy" protobuf:"bytes,1,opt,name=failurePolicy,casttype=LifecycleHookFailurePolicy"`
// ExecNewPod specifies the options for a lifecycle hook backed by a pod.
ExecNewPod *ExecNewPodHook `json:"execNewPod,omitempty" protobuf:"bytes,2,opt,name=execNewPod"`
// TagImages instructs the deployer to tag the current image referenced under a container onto an image stream tag.
TagImages []TagImageHook `json:"tagImages,omitempty" protobuf:"bytes,3,rep,name=tagImages"`
}
// LifecycleHookFailurePolicy describes possibles actions to take if a hook fails.
type LifecycleHookFailurePolicy string
const (
// LifecycleHookFailurePolicyRetry means retry the hook until it succeeds.
LifecycleHookFailurePolicyRetry LifecycleHookFailurePolicy = "Retry"
// LifecycleHookFailurePolicyAbort means abort the deployment (if possible).
LifecycleHookFailurePolicyAbort LifecycleHookFailurePolicy = "Abort"
// LifecycleHookFailurePolicyIgnore means ignore failure and continue the deployment.
LifecycleHookFailurePolicyIgnore LifecycleHookFailurePolicy = "Ignore"
)
// ExecNewPodHook is a hook implementation which runs a command in a new pod
// based on the specified container which is assumed to be part of the
// deployment template.
type ExecNewPodHook struct {
// Command is the action command and its arguments.
Command []string `json:"command" protobuf:"bytes,1,rep,name=command"`
// Env is a set of environment variables to supply to the hook pod's container.
Env []kapi.EnvVar `json:"env,omitempty" protobuf:"bytes,2,rep,name=env"`
// ContainerName is the name of a container in the deployment pod template
// whose Docker image will be used for the hook pod's container.
ContainerName string `json:"containerName" protobuf:"bytes,3,opt,name=containerName"`
// Volumes is a list of named volumes from the pod template which should be
// copied to the hook pod. Volumes names not found in pod spec are ignored.
// An empty list means no volumes will be copied.
Volumes []string `json:"volumes,omitempty" protobuf:"bytes,4,rep,name=volumes"`
}
// TagImageHook is a request to tag the image in a particular container onto an ImageStreamTag.
type TagImageHook struct {
// ContainerName is the name of a container in the deployment config whose image value will be used as the source of the tag. If there is only a single
// container this value will be defaulted to the name of that container.
ContainerName string `json:"containerName" protobuf:"bytes,1,opt,name=containerName"`
// To is the target ImageStreamTag to set the container's image onto.
To kapi.ObjectReference `json:"to" protobuf:"bytes,2,opt,name=to"`
}
// RollingDeploymentStrategyParams are the input to the Rolling deployment
// strategy.
type RollingDeploymentStrategyParams struct {
// UpdatePeriodSeconds is the time to wait between individual pod updates.
// If the value is nil, a default will be used.
UpdatePeriodSeconds *int64 `json:"updatePeriodSeconds,omitempty" protobuf:"varint,1,opt,name=updatePeriodSeconds"`
// IntervalSeconds is the time to wait between polling deployment status
// after update. If the value is nil, a default will be used.
IntervalSeconds *int64 `json:"intervalSeconds,omitempty" protobuf:"varint,2,opt,name=intervalSeconds"`
// TimeoutSeconds is the time to wait for updates before giving up. If the
// value is nil, a default will be used.
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"`
// MaxUnavailable is the maximum number of pods that can be unavailable
// during the update. Value can be an absolute number (ex: 5) or a
// percentage of total pods at the start of update (ex: 10%). Absolute
// number is calculated from percentage by rounding up.
//
// This cannot be 0 if MaxSurge is 0. By default, 25% is used.
//
// Example: when this is set to 30%, the old RC can be scaled down by 30%
// immediately when the rolling update starts. Once new pods are ready, old
// RC can be scaled down further, followed by scaling up the new RC,
// ensuring that at least 70% of original number of pods are available at
// all times during the update.
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,4,opt,name=maxUnavailable"`
// MaxSurge is the maximum number of pods that can be scheduled above the
// original number of pods. Value can be an absolute number (ex: 5) or a
// percentage of total pods at the start of the update (ex: 10%). Absolute
// number is calculated from percentage by rounding up.
//
// This cannot be 0 if MaxUnavailable is 0. By default, 25% is used.
//
// Example: when this is set to 30%, the new RC can be scaled up by 30%
// immediately when the rolling update starts. Once old pods have been
// killed, new RC can be scaled up further, ensuring that total number of
// pods running at any time during the update is atmost 130% of original
// pods.
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,5,opt,name=maxSurge"`
// UpdatePercent is the percentage of replicas to scale up or down each
// interval. If nil, one replica will be scaled up and down each interval.
// If negative, the scale order will be down/up instead of up/down.
// DEPRECATED: Use MaxUnavailable/MaxSurge instead.
UpdatePercent *int32 `json:"updatePercent,omitempty" protobuf:"varint,6,opt,name=updatePercent"`
// Pre is a lifecycle hook which is executed before the deployment process
// begins. All LifecycleHookFailurePolicy values are supported.
Pre *LifecycleHook `json:"pre,omitempty" protobuf:"bytes,7,opt,name=pre"`
// Post is a lifecycle hook which is executed after the strategy has
// finished all deployment logic. The LifecycleHookFailurePolicyAbort policy
// is NOT supported.
Post *LifecycleHook `json:"post,omitempty" protobuf:"bytes,8,opt,name=post"`
}
// These constants represent keys used for correlating objects related to deployments.
const (
// DeploymentConfigAnnotation is an annotation name used to correlate a deployment with the
// DeploymentConfig on which the deployment is based.
DeploymentConfigAnnotation = "openshift.io/deployment-config.name"
// DeploymentAnnotation is an annotation on a deployer Pod. The annotation value is the name
// of the deployment (a ReplicationController) on which the deployer Pod acts.
DeploymentAnnotation = "openshift.io/deployment.name"
// DeploymentPodAnnotation is an annotation on a deployment (a ReplicationController). The
// annotation value is the name of the deployer Pod which will act upon the ReplicationController
// to implement the deployment behavior.
DeploymentPodAnnotation = "openshift.io/deployer-pod.name"
// DeploymentPodTypeLabel is a label with which contains a type of deployment pod.
DeploymentPodTypeLabel = "openshift.io/deployer-pod.type"
// DeployerPodForDeploymentLabel is a label which groups pods related to a
// deployment. The value is a deployment name. The deployer pod and hook pods
// created by the internal strategies will have this label. Custom
// strategies can apply this label to any pods they create, enabling
// platform-provided cancellation and garbage collection support.
DeployerPodForDeploymentLabel = "openshift.io/deployer-pod-for.name"
// DeploymentPhaseAnnotation is an annotation name used to retrieve the DeploymentPhase of
// a deployment.
DeploymentPhaseAnnotation = "openshift.io/deployment.phase"
// DeploymentEncodedConfigAnnotation is an annotation name used to retrieve specific encoded
// DeploymentConfig on which a given deployment is based.
DeploymentEncodedConfigAnnotation = "openshift.io/encoded-deployment-config"
// DeploymentVersionAnnotation is an annotation on a deployment (a ReplicationController). The
// annotation value is the LatestVersion value of the DeploymentConfig which was the basis for
// the deployment.
DeploymentVersionAnnotation = "openshift.io/deployment-config.latest-version"
// DeploymentLabel is the name of a label used to correlate a deployment with the Pod created
// to execute the deployment logic.
// TODO: This is a workaround for upstream's lack of annotation support on PodTemplate. Once
// annotations are available on PodTemplate, audit this constant with the goal of removing it.
DeploymentLabel = "deployment"
// DeploymentConfigLabel is the name of a label used to correlate a deployment with the
// DeploymentConfigs on which the deployment is based.
DeploymentConfigLabel = "deploymentconfig"
// DeploymentStatusReasonAnnotation represents the reason for deployment being in a given state
// Used for specifying the reason for cancellation or failure of a deployment
DeploymentStatusReasonAnnotation = "openshift.io/deployment.status-reason"
// DeploymentCancelledAnnotation indicates that the deployment has been cancelled
// The annotation value does not matter and its mere presence indicates cancellation
DeploymentCancelledAnnotation = "openshift.io/deployment.cancelled"
// DeploymentInstantiatedAnnotation indicates that the deployment has been instantiated.
// The annotation value does not matter and its mere presence indicates instantiation.
DeploymentInstantiatedAnnotation = "openshift.io/deployment.instantiated"
)
// +genclient=true
// DeploymentConfig represents a configuration for a single deployment (represented as a
// ReplicationController). It also contains details about changes which resulted in the current
// state of the DeploymentConfig. Each change to the DeploymentConfig which should result in
// a new deployment results in an increment of LatestVersion.
type DeploymentConfig struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec represents a desired deployment state and how to deploy to it.
Spec DeploymentConfigSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
// Status represents the current deployment state.
Status DeploymentConfigStatus `json:"status" protobuf:"bytes,3,opt,name=status"`
}
// DeploymentConfigSpec represents the desired state of the deployment.
type DeploymentConfigSpec struct {
// Strategy describes how a deployment is executed.
Strategy DeploymentStrategy `json:"strategy" protobuf:"bytes,1,opt,name=strategy"`
// MinReadySeconds is the minimum number of seconds for which a newly created pod should
// be ready without any of its container crashing, for it to be considered available.
// Defaults to 0 (pod will be considered available as soon as it is ready)
MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,9,opt,name=minReadySeconds"`
// Triggers determine how updates to a DeploymentConfig result in new deployments. If no triggers
// are defined, a new deployment can only occur as a result of an explicit client update to the
// DeploymentConfig with a new LatestVersion.
Triggers []DeploymentTriggerPolicy `json:"triggers" protobuf:"bytes,2,rep,name=triggers"`
// Replicas is the number of desired replicas.
Replicas int32 `json:"replicas" protobuf:"varint,3,opt,name=replicas"`
// RevisionHistoryLimit is the number of old ReplicationControllers to retain to allow for rollbacks.
// This field is a pointer to allow for differentiation between an explicit zero and not specified.
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,4,opt,name=revisionHistoryLimit"`
// Test ensures that this deployment config will have zero replicas except while a deployment is running. This allows the
// deployment config to be used as a continuous deployment test - triggering on images, running the deployment, and then succeeding
// or failing. Post strategy hooks and After actions can be used to integrate successful deployment with an action.
Test bool `json:"test" protobuf:"varint,5,opt,name=test"`
// Paused indicates that the deployment config is paused resulting in no new deployments on template
// changes or changes in the template caused by other triggers.
Paused bool `json:"paused,omitempty" protobuf:"varint,6,opt,name=paused"`
// Selector is a label query over pods that should match the Replicas count.
Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,7,rep,name=selector"`
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
Template *kapi.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,8,opt,name=template"`
}
// DeploymentConfigStatus represents the current deployment state.
type DeploymentConfigStatus struct {
// LatestVersion is used to determine whether the current deployment associated with a deployment
// config is out of sync.
LatestVersion int64 `json:"latestVersion,omitempty" protobuf:"varint,1,opt,name=latestVersion"`
// ObservedGeneration is the most recent generation observed by the deployment config controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,2,opt,name=observedGeneration"`
// Replicas is the total number of pods targeted by this deployment config.
Replicas int32 `json:"replicas,omitempty" protobuf:"varint,3,opt,name=replicas"`
// UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config
// that have the desired template spec.
UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,4,opt,name=updatedReplicas"`
// AvailableReplicas is the total number of available pods targeted by this deployment config.
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
// UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,6,opt,name=unavailableReplicas"`
// Details are the reasons for the update to this deployment config.
// This could be based on a change made by the user or caused by an automatic trigger
Details *DeploymentDetails `json:"details,omitempty" protobuf:"bytes,7,opt,name=details"`
}
// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
type DeploymentTriggerPolicy struct {
// Type of the trigger
Type DeploymentTriggerType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentTriggerType"`
// ImageChangeParams represents the parameters for the ImageChange trigger.
ImageChangeParams *DeploymentTriggerImageChangeParams `json:"imageChangeParams,omitempty" protobuf:"bytes,2,opt,name=imageChangeParams"`
}
// DeploymentTriggerType refers to a specific DeploymentTriggerPolicy implementation.
type DeploymentTriggerType string
const (
// DeploymentTriggerOnImageChange will create new deployments in response to updated tags from
// a Docker image repository.
DeploymentTriggerOnImageChange DeploymentTriggerType = "ImageChange"
// DeploymentTriggerOnConfigChange will create new deployments in response to changes to
// the ControllerTemplate of a DeploymentConfig.
DeploymentTriggerOnConfigChange DeploymentTriggerType = "ConfigChange"
)
// DeploymentTriggerImageChangeParams represents the parameters to the ImageChange trigger.
type DeploymentTriggerImageChangeParams struct {
// Automatic means that the detection of a new tag value should result in an image update
// inside the pod template. Deployment configs that haven't been deployed yet will always
// have their images updated. Deployment configs that have been deployed at least once, will
// have their images updated only if this is set to true.
Automatic bool `json:"automatic,omitempty" protobuf:"varint,1,opt,name=automatic"`
// ContainerNames is used to restrict tag updates to the specified set of container names in a pod.
ContainerNames []string `json:"containerNames,omitempty" protobuf:"bytes,2,rep,name=containerNames"`
// From is a reference to an image stream tag to watch for changes. From.Name is the only
// required subfield - if From.Namespace is blank, the namespace of the current deployment
// trigger will be used.
From kapi.ObjectReference `json:"from" protobuf:"bytes,3,opt,name=from"`
// LastTriggeredImage is the last image to be triggered.
LastTriggeredImage string `json:"lastTriggeredImage,omitempty" protobuf:"bytes,4,opt,name=lastTriggeredImage"`
}
// DeploymentDetails captures information about the causes of a deployment.
type DeploymentDetails struct {
// Message is the user specified change message, if this deployment was triggered manually by the user
Message string `json:"message,omitempty" protobuf:"bytes,1,opt,name=message"`
// Causes are extended data associated with all the causes for creating a new deployment
Causes []DeploymentCause `json:"causes" protobuf:"bytes,2,rep,name=causes"`
}
// DeploymentCause captures information about a particular cause of a deployment.
type DeploymentCause struct {
// Type of the trigger that resulted in the creation of a new deployment
Type DeploymentTriggerType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentTriggerType"`
// ImageTrigger contains the image trigger details, if this trigger was fired based on an image change
ImageTrigger *DeploymentCauseImageTrigger `json:"imageTrigger,omitempty" protobuf:"bytes,2,opt,name=imageTrigger"`
}
// DeploymentCauseImageTrigger represents details about the cause of a deployment originating
// from an image change trigger
type DeploymentCauseImageTrigger struct {
// From is a reference to the changed object which triggered a deployment. The field may have
// the kinds DockerImage, ImageStreamTag, or ImageStreamImage.
From kapi.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"`
}
// DeploymentConfigList is a collection of deployment configs.
type DeploymentConfigList struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items is a list of deployment configs
Items []DeploymentConfig `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// DeploymentConfigRollback provides the input to rollback generation.
type DeploymentConfigRollback struct {
unversioned.TypeMeta `json:",inline"`
// Name of the deployment config that will be rolled back.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// UpdatedAnnotations is a set of new annotations that will be added in the deployment config.
UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty" protobuf:"bytes,2,rep,name=updatedAnnotations"`
// Spec defines the options to rollback generation.
Spec DeploymentConfigRollbackSpec `json:"spec" protobuf:"bytes,3,opt,name=spec"`
}
// DeploymentConfigRollbackSpec represents the options for rollback generation.
type DeploymentConfigRollbackSpec struct {
// From points to a ReplicationController which is a deployment.
From kapi.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"`
// Revision to rollback to. If set to 0, rollback to the last revision.
Revision int64 `json:"revision,omitempty" protobuf:"varint,2,opt,name=revision"`
// IncludeTriggers specifies whether to include config Triggers.
IncludeTriggers bool `json:"includeTriggers" protobuf:"varint,3,opt,name=includeTriggers"`
// IncludeTemplate specifies whether to include the PodTemplateSpec.
IncludeTemplate bool `json:"includeTemplate" protobuf:"varint,4,opt,name=includeTemplate"`
// IncludeReplicationMeta specifies whether to include the replica count and selector.
IncludeReplicationMeta bool `json:"includeReplicationMeta" protobuf:"varint,5,opt,name=includeReplicationMeta"`
// IncludeStrategy specifies whether to include the deployment Strategy.
IncludeStrategy bool `json:"includeStrategy" protobuf:"varint,6,opt,name=includeStrategy"`
}
// DeploymentLog represents the logs for a deployment
type DeploymentLog struct {
unversioned.TypeMeta `json:",inline"`
}
// DeploymentLogOptions is the REST options for a deployment log
type DeploymentLogOptions struct {
unversioned.TypeMeta `json:",inline"`
// The container for which to stream logs. Defaults to only container if there is one container in the pod.
Container string `json:"container,omitempty" protobuf:"bytes,1,opt,name=container"`
// Follow if true indicates that the build log should be streamed until
// the build terminates.
Follow bool `json:"follow,omitempty" protobuf:"varint,2,opt,name=follow"`
// Return previous deployment logs. Defaults to false.
Previous bool `json:"previous,omitempty" protobuf:"varint,3,opt,name=previous"`
// A relative time in seconds before the current time from which to show logs. If this value
// precedes the time a pod was started, only logs since the pod start will be returned.
// If this value is in the future, no logs will be returned.
// Only one of sinceSeconds or sinceTime may be specified.
SinceSeconds *int64 `json:"sinceSeconds,omitempty" protobuf:"varint,4,opt,name=sinceSeconds"`
// An RFC3339 timestamp from which to show logs. If this value
// precedes the time a pod was started, only logs since the pod start will be returned.
// If this value is in the future, no logs will be returned.
// Only one of sinceSeconds or sinceTime may be specified.
SinceTime *unversioned.Time `json:"sinceTime,omitempty" protobuf:"bytes,5,opt,name=sinceTime"`
// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
// of log output. Defaults to false.
Timestamps bool `json:"timestamps,omitempty" protobuf:"varint,6,opt,name=timestamps"`
// If set, the number of lines from the end of the logs to show. If not specified,
// logs are shown from the creation of the container or sinceSeconds or sinceTime
TailLines *int64 `json:"tailLines,omitempty" protobuf:"varint,7,opt,name=tailLines"`
// If set, the number of bytes to read from the server before terminating the
// log output. This may not display a complete final line of logging, and may return
// slightly more or slightly less than the specified limit.
LimitBytes *int64 `json:"limitBytes,omitempty" protobuf:"varint,8,opt,name=limitBytes"`
// NoWait if true causes the call to return immediately even if the deployment
// is not available yet. Otherwise the server will wait until the deployment has started.
// TODO: Fix the tag to 'noWait' in v2
NoWait bool `json:"nowait,omitempty" protobuf:"varint,9,opt,name=nowait"`
// Version of the deployment for which to view logs.
Version *int64 `json:"version,omitempty" protobuf:"varint,10,opt,name=version"`
}
+257
View File
@@ -0,0 +1,257 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_ClusterRoleScopeRestriction,
DeepCopy_api_OAuthAccessToken,
DeepCopy_api_OAuthAccessTokenList,
DeepCopy_api_OAuthAuthorizeToken,
DeepCopy_api_OAuthAuthorizeTokenList,
DeepCopy_api_OAuthClient,
DeepCopy_api_OAuthClientAuthorization,
DeepCopy_api_OAuthClientAuthorizationList,
DeepCopy_api_OAuthClientList,
DeepCopy_api_ScopeRestriction,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_ClusterRoleScopeRestriction(in ClusterRoleScopeRestriction, out *ClusterRoleScopeRestriction, c *conversion.Cloner) error {
if in.RoleNames != nil {
in, out := in.RoleNames, &out.RoleNames
*out = make([]string, len(in))
copy(*out, in)
} else {
out.RoleNames = nil
}
if in.Namespaces != nil {
in, out := in.Namespaces, &out.Namespaces
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Namespaces = nil
}
out.AllowEscalation = in.AllowEscalation
return nil
}
func DeepCopy_api_OAuthAccessToken(in OAuthAccessToken, out *OAuthAccessToken, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.ClientName = in.ClientName
out.ExpiresIn = in.ExpiresIn
if in.Scopes != nil {
in, out := in.Scopes, &out.Scopes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Scopes = nil
}
out.RedirectURI = in.RedirectURI
out.UserName = in.UserName
out.UserUID = in.UserUID
out.AuthorizeToken = in.AuthorizeToken
out.RefreshToken = in.RefreshToken
return nil
}
func DeepCopy_api_OAuthAccessTokenList(in OAuthAccessTokenList, out *OAuthAccessTokenList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]OAuthAccessToken, len(in))
for i := range in {
if err := DeepCopy_api_OAuthAccessToken(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_OAuthAuthorizeToken(in OAuthAuthorizeToken, out *OAuthAuthorizeToken, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.ClientName = in.ClientName
out.ExpiresIn = in.ExpiresIn
if in.Scopes != nil {
in, out := in.Scopes, &out.Scopes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Scopes = nil
}
out.RedirectURI = in.RedirectURI
out.State = in.State
out.UserName = in.UserName
out.UserUID = in.UserUID
return nil
}
func DeepCopy_api_OAuthAuthorizeTokenList(in OAuthAuthorizeTokenList, out *OAuthAuthorizeTokenList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]OAuthAuthorizeToken, len(in))
for i := range in {
if err := DeepCopy_api_OAuthAuthorizeToken(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_OAuthClient(in OAuthClient, out *OAuthClient, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Secret = in.Secret
if in.AdditionalSecrets != nil {
in, out := in.AdditionalSecrets, &out.AdditionalSecrets
*out = make([]string, len(in))
copy(*out, in)
} else {
out.AdditionalSecrets = nil
}
out.RespondWithChallenges = in.RespondWithChallenges
if in.RedirectURIs != nil {
in, out := in.RedirectURIs, &out.RedirectURIs
*out = make([]string, len(in))
copy(*out, in)
} else {
out.RedirectURIs = nil
}
out.GrantMethod = in.GrantMethod
if in.ScopeRestrictions != nil {
in, out := in.ScopeRestrictions, &out.ScopeRestrictions
*out = make([]ScopeRestriction, len(in))
for i := range in {
if err := DeepCopy_api_ScopeRestriction(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.ScopeRestrictions = nil
}
return nil
}
func DeepCopy_api_OAuthClientAuthorization(in OAuthClientAuthorization, out *OAuthClientAuthorization, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.ClientName = in.ClientName
out.UserName = in.UserName
out.UserUID = in.UserUID
if in.Scopes != nil {
in, out := in.Scopes, &out.Scopes
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Scopes = nil
}
return nil
}
func DeepCopy_api_OAuthClientAuthorizationList(in OAuthClientAuthorizationList, out *OAuthClientAuthorizationList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]OAuthClientAuthorization, len(in))
for i := range in {
if err := DeepCopy_api_OAuthClientAuthorization(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_OAuthClientList(in OAuthClientList, out *OAuthClientList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]OAuthClient, len(in))
for i := range in {
if err := DeepCopy_api_OAuthClient(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_ScopeRestriction(in ScopeRestriction, out *ScopeRestriction, c *conversion.Cloner) error {
if in.ExactValues != nil {
in, out := in.ExactValues, &out.ExactValues
*out = make([]string, len(in))
copy(*out, in)
} else {
out.ExactValues = nil
}
if in.ClusterRole != nil {
in, out := in.ClusterRole, &out.ClusterRole
*out = new(ClusterRoleScopeRestriction)
if err := DeepCopy_api_ClusterRoleScopeRestriction(*in, *out, c); err != nil {
return err
}
} else {
out.ClusterRole = nil
}
return nil
}
+41
View File
@@ -0,0 +1,41 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// OAuthAccessTokenToSelectableFields returns a label set that represents the object
func OAuthAccessTokenToSelectableFields(obj *OAuthAccessToken) fields.Set {
return fields.Set{
"metadata.name": obj.Name,
"clientName": obj.ClientName,
"userName": obj.UserName,
"userUID": obj.UserUID,
"authorizeToken": obj.AuthorizeToken,
}
}
// OAuthAuthorizeTokenToSelectableFields returns a label set that represents the object
func OAuthAuthorizeTokenToSelectableFields(obj *OAuthAuthorizeToken) fields.Set {
return fields.Set{
"metadata.name": obj.Name,
"clientName": obj.ClientName,
"userName": obj.UserName,
"userUID": obj.UserUID,
}
}
// OAuthClientToSelectableFields returns a label set that represents the object
func OAuthClientToSelectableFields(obj *OAuthClient) fields.Set {
return fields.Set{
"metadata.name": obj.Name,
}
}
// OAuthClientAuthorizationToSelectableFields returns a label set that represents the object
func OAuthClientAuthorizationToSelectableFields(obj *OAuthClientAuthorization) fields.Set {
return fields.Set{
"metadata.name": obj.Name,
"clientName": obj.ClientName,
"userName": obj.UserName,
"userUID": obj.UserUID,
}
}
+49
View File
@@ -0,0 +1,49 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&OAuthAccessToken{},
&OAuthAccessTokenList{},
&OAuthAuthorizeToken{},
&OAuthAuthorizeTokenList{},
&OAuthClient{},
&OAuthClientList{},
&OAuthClientAuthorization{},
&OAuthClientAuthorizationList{},
)
}
func (obj *OAuthClientAuthorizationList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthClientAuthorization) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthClientList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthClient) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthAuthorizeTokenList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthAuthorizeToken) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthAccessTokenList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *OAuthAccessToken) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+163
View File
@@ -0,0 +1,163 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
type OAuthAccessToken struct {
unversioned.TypeMeta
kapi.ObjectMeta
// ClientName references the client that created this token.
ClientName string
// ExpiresIn is the seconds from CreationTime before this token expires.
ExpiresIn int64
// Scopes is an array of the requested scopes.
Scopes []string
// RedirectURI is the redirection associated with the token.
RedirectURI string
// UserName is the user name associated with this token
UserName string
// UserUID is the unique UID associated with this token
UserUID string
// AuthorizeToken contains the token that authorized this token
AuthorizeToken string
// RefreshToken is the value by which this token can be renewed. Can be blank.
RefreshToken string
}
type OAuthAuthorizeToken struct {
unversioned.TypeMeta
kapi.ObjectMeta
// ClientName references the client that created this token.
ClientName string
// ExpiresIn is the seconds from CreationTime before this token expires.
ExpiresIn int64
// Scopes is an array of the requested scopes.
Scopes []string
// RedirectURI is the redirection associated with the token.
RedirectURI string
// State data from request
State string
// UserName is the user name associated with this token
UserName string
// UserUID is the unique UID associated with this token. UserUID and UserName must both match
// for this token to be valid.
UserUID string
}
// +genclient=true
type OAuthClient struct {
unversioned.TypeMeta
kapi.ObjectMeta
// Secret is the unique secret associated with a client
Secret string
// AdditionalSecrets holds other secrets that may be used to identify the client. This is useful for rotation
// and for service account token validation
AdditionalSecrets []string
// RespondWithChallenges indicates whether the client wants authentication needed responses made in the form of challenges instead of redirects
RespondWithChallenges bool
// RedirectURIs is the valid redirection URIs associated with a client
RedirectURIs []string
// GrantMethod determines how to handle grants for this client. If no method is provided, the
// cluster default grant handling method will be used
GrantMethod GrantHandlerType
// ScopeRestrictions describes which scopes this client can request. Each requested scope
// is checked against each restriction. If any restriction matches, then the scope is allowed.
// If no restriction matches, then the scope is denied.
ScopeRestrictions []ScopeRestriction
}
type GrantHandlerType string
const (
// GrantHandlerAuto auto-approves client authorization grant requests
GrantHandlerAuto GrantHandlerType = "auto"
// GrantHandlerPrompt prompts the user to approve new client authorization grant requests
GrantHandlerPrompt GrantHandlerType = "prompt"
// GrantHandlerDeny auto-denies client authorization grant requests
GrantHandlerDeny GrantHandlerType = "deny"
)
// ScopeRestriction describe one restriction on scopes. Exactly one option must be non-nil.
type ScopeRestriction struct {
// ExactValues means the scope has to match a particular set of strings exactly
ExactValues []string
// ClusterRole describes a set of restrictions for cluster role scoping.
ClusterRole *ClusterRoleScopeRestriction
}
// ClusterRoleScopeRestriction describes restrictions on cluster role scopes
type ClusterRoleScopeRestriction struct {
// RoleNames is the list of cluster roles that can referenced. * means anything
RoleNames []string
// Namespaces is the list of namespaces that can be referenced. * means any of them (including *)
Namespaces []string
// AllowEscalation indicates whether you can request roles and their escalating resources
AllowEscalation bool
}
type OAuthClientAuthorization struct {
unversioned.TypeMeta
kapi.ObjectMeta
// ClientName references the client that created this authorization
ClientName string
// UserName is the user name that authorized this client
UserName string
// UserUID is the unique UID associated with this authorization. UserUID and UserName
// must both match for this authorization to be valid.
UserUID string
// Scopes is an array of the granted scopes.
Scopes []string
}
type OAuthAccessTokenList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []OAuthAccessToken
}
type OAuthAuthorizeTokenList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []OAuthAuthorizeToken
}
type OAuthClientList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []OAuthClient
}
type OAuthClientAuthorizationList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []OAuthClientAuthorization
}
@@ -0,0 +1,91 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_Project,
DeepCopy_api_ProjectList,
DeepCopy_api_ProjectRequest,
DeepCopy_api_ProjectSpec,
DeepCopy_api_ProjectStatus,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_Project(in Project, out *Project, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_api_ProjectSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_ProjectStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_ProjectList(in ProjectList, out *ProjectList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Project, len(in))
for i := range in {
if err := DeepCopy_api_Project(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_ProjectRequest(in ProjectRequest, out *ProjectRequest, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.DisplayName = in.DisplayName
out.Description = in.Description
return nil
}
func DeepCopy_api_ProjectSpec(in ProjectSpec, out *ProjectSpec, c *conversion.Cloner) error {
if in.Finalizers != nil {
in, out := in.Finalizers, &out.Finalizers
*out = make([]api.FinalizerName, len(in))
for i := range in {
(*out)[i] = in[i]
}
} else {
out.Finalizers = nil
}
return nil
}
func DeepCopy_api_ProjectStatus(in ProjectStatus, out *ProjectStatus, c *conversion.Cloner) error {
out.Phase = in.Phase
return nil
}
+23
View File
@@ -0,0 +1,23 @@
package api
import (
"fmt"
)
const (
displayNameOldAnnotation = "displayName"
displayNameAnnotation = "openshift.io/display-name"
)
// DisplayNameAndNameForProject returns a formatted string containing the name
// of the project and includes the display name if it differs.
func DisplayNameAndNameForProject(project *Project) string {
displayName := project.Annotations[displayNameAnnotation]
if len(displayName) == 0 {
displayName = project.Annotations[displayNameOldAnnotation]
}
if len(displayName) > 0 && displayName != project.Name {
return fmt.Sprintf("%s (%s)", displayName, project.Name)
}
return project.Name
}
+39
View File
@@ -0,0 +1,39 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&Project{},
&ProjectList{},
&ProjectRequest{},
)
}
func (obj *ProjectRequest) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *Project) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *ProjectList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+61
View File
@@ -0,0 +1,61 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
// ProjectList is a list of Project objects.
type ProjectList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []Project
}
const (
// These are internal finalizer values to Origin
FinalizerOrigin kapi.FinalizerName = "openshift.io/origin"
)
// ProjectSpec describes the attributes on a Project
type ProjectSpec struct {
// Finalizers is an opaque list of values that must be empty to permanently remove object from storage
Finalizers []kapi.FinalizerName
}
// ProjectStatus is information about the current status of a Project
type ProjectStatus struct {
Phase kapi.NamespacePhase
}
// +genclient=true
// Project is a logical top-level container for a set of origin resources
type Project struct {
unversioned.TypeMeta
kapi.ObjectMeta
Spec ProjectSpec
Status ProjectStatus
}
type ProjectRequest struct {
unversioned.TypeMeta
kapi.ObjectMeta
DisplayName string
Description string
}
// These constants represent annotations keys affixed to projects
const (
// ProjectDisplayName is an annotation that stores the name displayed when querying for projects
ProjectDisplayName = "openshift.io/display-name"
// ProjectDescription is an annotatoion that holds the description of the project
ProjectDescription = "openshift.io/description"
// ProjectNodeSelector is an annotation that holds the node selector;
// the node selector annotation determines which nodes will have pods from this project scheduled to them
ProjectNodeSelector = "openshift.io/node-selector"
// ProjectRequester is the username that requested a given project. Its not guaranteed to be present,
// but it is set by the default project template.
ProjectRequester = "openshift.io/requester"
)
+190
View File
@@ -0,0 +1,190 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
intstr "k8s.io/kubernetes/pkg/util/intstr"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_Route,
DeepCopy_api_RouteIngress,
DeepCopy_api_RouteIngressCondition,
DeepCopy_api_RouteList,
DeepCopy_api_RoutePort,
DeepCopy_api_RouteSpec,
DeepCopy_api_RouteStatus,
DeepCopy_api_RouteTargetReference,
DeepCopy_api_RouterShard,
DeepCopy_api_TLSConfig,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_Route(in Route, out *Route, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_api_RouteSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_RouteStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_RouteIngress(in RouteIngress, out *RouteIngress, c *conversion.Cloner) error {
out.Host = in.Host
out.RouterName = in.RouterName
if in.Conditions != nil {
in, out := in.Conditions, &out.Conditions
*out = make([]RouteIngressCondition, len(in))
for i := range in {
if err := DeepCopy_api_RouteIngressCondition(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Conditions = nil
}
return nil
}
func DeepCopy_api_RouteIngressCondition(in RouteIngressCondition, out *RouteIngressCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
out.Reason = in.Reason
out.Message = in.Message
if in.LastTransitionTime != nil {
in, out := in.LastTransitionTime, &out.LastTransitionTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.LastTransitionTime = nil
}
return nil
}
func DeepCopy_api_RouteList(in RouteList, out *RouteList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Route, len(in))
for i := range in {
if err := DeepCopy_api_Route(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_RoutePort(in RoutePort, out *RoutePort, c *conversion.Cloner) error {
if err := intstr.DeepCopy_intstr_IntOrString(in.TargetPort, &out.TargetPort, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_RouteSpec(in RouteSpec, out *RouteSpec, c *conversion.Cloner) error {
out.Host = in.Host
out.Path = in.Path
if err := DeepCopy_api_RouteTargetReference(in.To, &out.To, c); err != nil {
return err
}
if in.AlternateBackends != nil {
in, out := in.AlternateBackends, &out.AlternateBackends
*out = make([]RouteTargetReference, len(in))
for i := range in {
if err := DeepCopy_api_RouteTargetReference(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.AlternateBackends = nil
}
if in.Port != nil {
in, out := in.Port, &out.Port
*out = new(RoutePort)
if err := DeepCopy_api_RoutePort(*in, *out, c); err != nil {
return err
}
} else {
out.Port = nil
}
if in.TLS != nil {
in, out := in.TLS, &out.TLS
*out = new(TLSConfig)
if err := DeepCopy_api_TLSConfig(*in, *out, c); err != nil {
return err
}
} else {
out.TLS = nil
}
return nil
}
func DeepCopy_api_RouteStatus(in RouteStatus, out *RouteStatus, c *conversion.Cloner) error {
if in.Ingress != nil {
in, out := in.Ingress, &out.Ingress
*out = make([]RouteIngress, len(in))
for i := range in {
if err := DeepCopy_api_RouteIngress(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Ingress = nil
}
return nil
}
func DeepCopy_api_RouteTargetReference(in RouteTargetReference, out *RouteTargetReference, c *conversion.Cloner) error {
out.Kind = in.Kind
out.Name = in.Name
if in.Weight != nil {
in, out := in.Weight, &out.Weight
*out = new(int32)
**out = *in
} else {
out.Weight = nil
}
return nil
}
func DeepCopy_api_RouterShard(in RouterShard, out *RouterShard, c *conversion.Cloner) error {
out.ShardName = in.ShardName
out.DNSSuffix = in.DNSSuffix
return nil
}
func DeepCopy_api_TLSConfig(in TLSConfig, out *TLSConfig, c *conversion.Cloner) error {
out.Termination = in.Termination
out.Certificate = in.Certificate
out.Key = in.Key
out.CACertificate = in.CACertificate
out.DestinationCACertificate = in.DestinationCACertificate
out.InsecureEdgeTerminationPolicy = in.InsecureEdgeTerminationPolicy
return nil
}
+14
View File
@@ -0,0 +1,14 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// RouteToSelectableFields returns a label set that represents the object
func RouteToSelectableFields(route *Route) fields.Set {
return fields.Set{
"metadata.name": route.Name,
"metadata.namespace": route.Namespace,
"spec.path": route.Spec.Path,
"spec.host": route.Spec.Host,
"spec.to.name": route.Spec.To.Name,
}
}
+30
View File
@@ -0,0 +1,30 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
)
// IngressConditionStatus returns the first status and condition matching the provided ingress condition type. Conditions
// prefer the first matching entry and clients are allowed to ignore later conditions of the same type.
func IngressConditionStatus(ingress *RouteIngress, t RouteIngressConditionType) (kapi.ConditionStatus, RouteIngressCondition) {
for _, condition := range ingress.Conditions {
if t != condition.Type {
continue
}
return condition.Status, condition
}
return kapi.ConditionUnknown, RouteIngressCondition{}
}
func RouteLessThan(route1, route2 *Route) bool {
if route1.CreationTimestamp.Before(route2.CreationTimestamp) {
return true
}
if route1.CreationTimestamp == route2.CreationTimestamp && route1.UID < route2.UID {
return true
}
if route1.Namespace < route2.Namespace {
return true
}
return route1.Name < route2.Name
}
+37
View File
@@ -0,0 +1,37 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&Route{},
&RouteList{},
)
}
func (obj *Route) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *RouteList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+182
View File
@@ -0,0 +1,182 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util/intstr"
)
// +genclient=true
// Route encapsulates the inputs needed to connect an alias to endpoints.
type Route struct {
unversioned.TypeMeta
kapi.ObjectMeta
// Spec is the desired behavior of the route
Spec RouteSpec
// Status describes the current observed state of the route
Status RouteStatus
}
// RouteSpec describes the desired behavior of a route.
type RouteSpec struct {
// Host is an alias/DNS that points to the service. Optional
// Must follow DNS952 subdomain conventions.
Host string
// Path that the router watches for, to route traffic for to the service. Optional
Path string
// Objects that the route points to. Only the Service kind is allowed, and it will
// be defaulted to Service.
To RouteTargetReference
// Alternate objects that the route may want to point to. Use the 'weight' field to
// determine which ones of the several get more emphasis
AlternateBackends []RouteTargetReference
// If specified, the port to be used by the router. Most routers will use all
// endpoints exposed by the service by default - set this value to instruct routers
// which port to use.
Port *RoutePort
//TLS provides the ability to configure certificates and termination for the route
TLS *TLSConfig
}
// RouteTargetReference specifies the target that resolve into endpoints. Only the 'Service'
// kind is allowed. Use 'weight' field to emphasize one over others.
type RouteTargetReference struct {
Kind string
Name string
Weight *int32
}
// RoutePort defines a port mapping from a router to an endpoint in the service endpoints.
type RoutePort struct {
// The target port on pods selected by the service this route points to.
// If this is a string, it will be looked up as a named port in the target
// endpoints port list. Required
TargetPort intstr.IntOrString
}
// RouteStatus provides relevant info about the status of a route, including which routers
// acknowledge it.
type RouteStatus struct {
// Ingress describes the places where the route may be exposed. The list of
// ingress points may contain duplicate Host or RouterName values. Routes
// are considered live once they are `Ready`
Ingress []RouteIngress
}
// RouteIngress holds information about the places where a route is exposed
type RouteIngress struct {
// Host is the host string under which the route is exposed; this value is required
Host string
// Name is a name chosen by the router to identify itself; this value is required
RouterName string
// Conditions is the state of the route, may be empty.
Conditions []RouteIngressCondition
}
// RouteIngressConditionType is a valid value for RouteCondition
type RouteIngressConditionType string
// These are valid conditions of pod.
const (
// RouteAdmitted means the route is able to service requests for the provided Host
RouteAdmitted RouteIngressConditionType = "Admitted"
// RouteExtendedValidationFailed means the route configuration failed an extended validation check.
RouteExtendedValidationFailed RouteIngressConditionType = "ExtendedValidationFailed"
// TODO: add other route condition types
)
// RouteIngressCondition contains details for the current condition of this pod.
// TODO: add LastTransitionTime, Reason, Message to match NodeCondition api.
type RouteIngressCondition struct {
// Type is the type of the condition.
// Currently only Ready.
Type RouteIngressConditionType
// Status is the status of the condition.
// Can be True, False, Unknown.
Status kapi.ConditionStatus
// (brief) reason for the condition's last transition, and is usually a machine and human
// readable constant
Reason string
// Human readable message indicating details about last transition.
Message string
// RFC 3339 date and time at which the object was acknowledged by the router.
// This may be before the router exposes the route
LastTransitionTime *unversioned.Time
}
// RouteList is a collection of Routes.
type RouteList struct {
unversioned.TypeMeta
unversioned.ListMeta
// Items is a list of routes
Items []Route
}
// RouterShard has information of a routing shard and is used to
// generate host names and routing table entries when a routing shard is
// allocated for a specific route.
type RouterShard struct {
// ShardName uniquely identifies a router shard in the "set" of
// routers used for routing traffic to the services.
ShardName string
// DNSSuffix for the shard ala: shard-1.v3.openshift.com
DNSSuffix string
}
// TLSConfig defines config used to secure a route and provide termination
type TLSConfig struct {
// Termination indicates termination type.
Termination TLSTerminationType
// Certificate provides certificate contents
Certificate string
// Key provides key file contents
Key string
// CACertificate provides the cert authority certificate contents
CACertificate string
// DestinationCACertificate provides the contents of the ca certificate of the final destination. When using reencrypt
// termination this file should be provided in order to have routers use it for health checks on the secure connection
DestinationCACertificate string
// InsecureEdgeTerminationPolicy indicates the desired behavior for
// insecure connections to an edge-terminated route:
// disable, allow or redirect
InsecureEdgeTerminationPolicy InsecureEdgeTerminationPolicyType
}
// TLSTerminationType dictates where the secure communication will stop
// TODO: Reconsider this type in v2
type TLSTerminationType string
// InsecureEdgeTerminationPolicyType dictates the behavior of insecure
// connections to an edge-terminated route.
type InsecureEdgeTerminationPolicyType string
const (
// TLSTerminationEdge terminate encryption at the edge router.
TLSTerminationEdge TLSTerminationType = "edge"
// TLSTerminationPassthrough terminate encryption at the destination, the destination is responsible for decrypting traffic
TLSTerminationPassthrough TLSTerminationType = "passthrough"
// TLSTerminationReencrypt terminate encryption at the edge router and re-encrypt it with a new certificate supplied by the destination
TLSTerminationReencrypt TLSTerminationType = "reencrypt"
// InsecureEdgeTerminationPolicyNone disables insecure connections for an edge-terminated route.
InsecureEdgeTerminationPolicyNone InsecureEdgeTerminationPolicyType = "None"
// InsecureEdgeTerminationPolicyAllow allows insecure connections for an edge-terminated route.
InsecureEdgeTerminationPolicyAllow InsecureEdgeTerminationPolicyType = "Allow"
// InsecureEdgeTerminationPolicyRedirect redirects insecure connections for an edge-terminated route.
// As an example, for routers that support HTTP and HTTPS, the
// insecure HTTP connections will be redirected to use HTTPS.
InsecureEdgeTerminationPolicyRedirect InsecureEdgeTerminationPolicyType = "Redirect"
)
+127
View File
@@ -0,0 +1,127 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_ClusterNetwork,
DeepCopy_api_ClusterNetworkList,
DeepCopy_api_HostSubnet,
DeepCopy_api_HostSubnetList,
DeepCopy_api_NetNamespace,
DeepCopy_api_NetNamespaceList,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_ClusterNetwork(in ClusterNetwork, out *ClusterNetwork, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Network = in.Network
out.HostSubnetLength = in.HostSubnetLength
out.ServiceNetwork = in.ServiceNetwork
out.PluginName = in.PluginName
return nil
}
func DeepCopy_api_ClusterNetworkList(in ClusterNetworkList, out *ClusterNetworkList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterNetwork, len(in))
for i := range in {
if err := DeepCopy_api_ClusterNetwork(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_HostSubnet(in HostSubnet, out *HostSubnet, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Host = in.Host
out.HostIP = in.HostIP
out.Subnet = in.Subnet
return nil
}
func DeepCopy_api_HostSubnetList(in HostSubnetList, out *HostSubnetList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]HostSubnet, len(in))
for i := range in {
if err := DeepCopy_api_HostSubnet(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_NetNamespace(in NetNamespace, out *NetNamespace, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.NetName = in.NetName
out.NetID = in.NetID
return nil
}
func DeepCopy_api_NetNamespaceList(in NetNamespaceList, out *NetNamespaceList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]NetNamespace, len(in))
for i := range in {
if err := DeepCopy_api_NetNamespace(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
+24
View File
@@ -0,0 +1,24 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// ClusterNetworkToSelectableFields returns a label set that represents the object
func ClusterNetworkToSelectableFields(network *ClusterNetwork) fields.Set {
return fields.Set{
"metadata.name": network.Name,
}
}
// HostSubnetToSelectableFields returns a label set that represents the object
func HostSubnetToSelectableFields(obj *HostSubnet) fields.Set {
return fields.Set{
"metadata.name": obj.Name,
}
}
// NetNamespaceToSelectableFields returns a label set that represents the object
func NetNamespaceToSelectableFields(obj *NetNamespace) fields.Set {
return fields.Set{
"metadata.name": obj.Name,
}
}
+45
View File
@@ -0,0 +1,45 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&ClusterNetwork{},
&ClusterNetworkList{},
&HostSubnet{},
&HostSubnetList{},
&NetNamespace{},
&NetNamespaceList{},
)
}
func (obj *ClusterNetwork) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *ClusterNetworkList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *HostSubnet) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *HostSubnetList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *NetNamespace) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *NetNamespaceList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+62
View File
@@ -0,0 +1,62 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
const (
ClusterNetworkDefault = "default"
)
// +genclient=true
type ClusterNetwork struct {
unversioned.TypeMeta
kapi.ObjectMeta
Network string
HostSubnetLength uint32
ServiceNetwork string
PluginName string
}
type ClusterNetworkList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []ClusterNetwork
}
// HostSubnet encapsulates the inputs needed to define the container subnet network on a node
type HostSubnet struct {
unversioned.TypeMeta
kapi.ObjectMeta
// host may just be an IP address, resolvable hostname or a complete DNS
Host string
HostIP string
Subnet string
}
// HostSubnetList is a collection of HostSubnets
type HostSubnetList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []HostSubnet
}
// NetNamespace holds the network id against its name
type NetNamespace struct {
unversioned.TypeMeta
kapi.ObjectMeta
NetName string
NetID uint32
}
// NetNamespaceList is a collection of NetNamespaces
type NetNamespaceList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []NetNamespace
}
@@ -0,0 +1,143 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_PodSecurityPolicyReview,
DeepCopy_api_PodSecurityPolicyReviewSpec,
DeepCopy_api_PodSecurityPolicyReviewStatus,
DeepCopy_api_PodSecurityPolicySelfSubjectReview,
DeepCopy_api_PodSecurityPolicySelfSubjectReviewSpec,
DeepCopy_api_PodSecurityPolicySubjectReview,
DeepCopy_api_PodSecurityPolicySubjectReviewSpec,
DeepCopy_api_PodSecurityPolicySubjectReviewStatus,
DeepCopy_api_ServiceAccountPodSecurityPolicyReviewStatus,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_PodSecurityPolicyReview(in PodSecurityPolicyReview, out *PodSecurityPolicyReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_PodSecurityPolicyReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_PodSecurityPolicyReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_PodSecurityPolicyReviewSpec(in PodSecurityPolicyReviewSpec, out *PodSecurityPolicyReviewSpec, c *conversion.Cloner) error {
if err := api.DeepCopy_api_PodSpec(in.PodSpec, &out.PodSpec, c); err != nil {
return err
}
if in.ServiceAccountNames != nil {
in, out := in.ServiceAccountNames, &out.ServiceAccountNames
*out = make([]string, len(in))
copy(*out, in)
} else {
out.ServiceAccountNames = nil
}
return nil
}
func DeepCopy_api_PodSecurityPolicyReviewStatus(in PodSecurityPolicyReviewStatus, out *PodSecurityPolicyReviewStatus, c *conversion.Cloner) error {
if in.AllowedServiceAccounts != nil {
in, out := in.AllowedServiceAccounts, &out.AllowedServiceAccounts
*out = make([]ServiceAccountPodSecurityPolicyReviewStatus, len(in))
for i := range in {
if err := DeepCopy_api_ServiceAccountPodSecurityPolicyReviewStatus(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.AllowedServiceAccounts = nil
}
return nil
}
func DeepCopy_api_PodSecurityPolicySelfSubjectReview(in PodSecurityPolicySelfSubjectReview, out *PodSecurityPolicySelfSubjectReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_PodSecurityPolicySelfSubjectReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_PodSecurityPolicySubjectReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_PodSecurityPolicySelfSubjectReviewSpec(in PodSecurityPolicySelfSubjectReviewSpec, out *PodSecurityPolicySelfSubjectReviewSpec, c *conversion.Cloner) error {
if err := api.DeepCopy_api_PodSpec(in.PodSpec, &out.PodSpec, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_PodSecurityPolicySubjectReview(in PodSecurityPolicySubjectReview, out *PodSecurityPolicySubjectReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_api_PodSecurityPolicySubjectReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_api_PodSecurityPolicySubjectReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_PodSecurityPolicySubjectReviewSpec(in PodSecurityPolicySubjectReviewSpec, out *PodSecurityPolicySubjectReviewSpec, c *conversion.Cloner) error {
if err := api.DeepCopy_api_PodSpec(in.PodSpec, &out.PodSpec, c); err != nil {
return err
}
out.User = in.User
if in.Groups != nil {
in, out := in.Groups, &out.Groups
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Groups = nil
}
return nil
}
func DeepCopy_api_PodSecurityPolicySubjectReviewStatus(in PodSecurityPolicySubjectReviewStatus, out *PodSecurityPolicySubjectReviewStatus, c *conversion.Cloner) error {
if in.AllowedBy != nil {
in, out := in.AllowedBy, &out.AllowedBy
*out = new(api.ObjectReference)
if err := api.DeepCopy_api_ObjectReference(*in, *out, c); err != nil {
return err
}
} else {
out.AllowedBy = nil
}
out.Reason = in.Reason
if err := api.DeepCopy_api_PodSpec(in.PodSpec, &out.PodSpec, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_ServiceAccountPodSecurityPolicyReviewStatus(in ServiceAccountPodSecurityPolicyReviewStatus, out *ServiceAccountPodSecurityPolicyReviewStatus, c *conversion.Cloner) error {
if err := DeepCopy_api_PodSecurityPolicySubjectReviewStatus(in.PodSecurityPolicySubjectReviewStatus, &out.PodSecurityPolicySubjectReviewStatus, c); err != nil {
return err
}
out.Name = in.Name
return nil
}
+43
View File
@@ -0,0 +1,43 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&PodSecurityPolicySubjectReview{},
&PodSecurityPolicySelfSubjectReview{},
&PodSecurityPolicyReview{},
)
}
func (obj *PodSecurityPolicySubjectReview) GetObjectKind() unversioned.ObjectKind {
return &obj.TypeMeta
}
func (obj *PodSecurityPolicySelfSubjectReview) GetObjectKind() unversioned.ObjectKind {
return &obj.TypeMeta
}
func (obj *PodSecurityPolicyReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+107
View File
@@ -0,0 +1,107 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
// +genclient=true
// PodSecurityPolicySubjectReview checks whether a particular user/SA tuple can create the PodSpec.
type PodSecurityPolicySubjectReview struct {
unversioned.TypeMeta
// Spec defines specification for the PodSecurityPolicySubjectReview.
Spec PodSecurityPolicySubjectReviewSpec
// Status represents the current information/status for the PodSecurityPolicySubjectReview.
Status PodSecurityPolicySubjectReviewStatus
}
// PodSecurityPolicySubjectReviewSpec defines specification for PodSecurityPolicySubjectReview
type PodSecurityPolicySubjectReviewSpec struct {
// PodSpec is the PodSpec to check. If PodSpec.ServiceAccountName is empty it will not be defaulted.
// If its non-empty, it will be checked.
PodSpec kapi.PodSpec
// User is the user you're testing for.
// If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups.
// If User and Groups are empty, then the check is performed using *only* the ServiceAccountName in the PodSpec.
User string
// Groups is the groups you're testing for.
Groups []string
}
// PodSecurityPolicySubjectReviewStatus contains information/status for PodSecurityPolicySubjectReview.
type PodSecurityPolicySubjectReviewStatus struct {
// AllowedBy is a reference to the rule that allows the PodSpec.
// A rule can be a SecurityContextConstraint or a PodSecurityPolicy
// A `nil`, indicates that it was denied.
AllowedBy *kapi.ObjectReference
// A machine-readable description of why this operation is in the
// "Failure" status. If this value is empty there
// is no information available.
Reason string
// PodSpec is the PodSpec after the defaulting is applied.
PodSpec kapi.PodSpec
}
// PodSecurityPolicySelfSubjectReview checks whether this user/SA tuple can create the PodSpec.
type PodSecurityPolicySelfSubjectReview struct {
unversioned.TypeMeta
// Spec defines specification the PodSecurityPolicySelfSubjectReview.
Spec PodSecurityPolicySelfSubjectReviewSpec
// Status represents the current information/status for the PodSecurityPolicySelfSubjectReview.
Status PodSecurityPolicySubjectReviewStatus
}
// PodSecurityPolicySelfSubjectReviewSpec contains specification for PodSecurityPolicySelfSubjectReview.
type PodSecurityPolicySelfSubjectReviewSpec struct {
// PodSpec is the PodSpec to check.
PodSpec kapi.PodSpec
}
// PodSecurityPolicyReview checks which service accounts (not users, since that would be cluster-wide) can create the `PodSpec` in question.
type PodSecurityPolicyReview struct {
unversioned.TypeMeta
// Spec is the PodSecurityPolicy to check.
Spec PodSecurityPolicyReviewSpec
// Status represents the current information/status for the PodSecurityPolicyReview.
Status PodSecurityPolicyReviewStatus
}
// PodSecurityPolicyReviewSpec defines specification for PodSecurityPolicyReview
type PodSecurityPolicyReviewSpec struct {
// PodSpec is the PodSpec to check. The PodSpec.ServiceAccountName field is used
// if ServiceAccountNames is empty, unless the PodSpec.ServiceAccountName is empty,
// in which case "default" is used.
// If ServiceAccountNames is specified, PodSpec.ServiceAccountName is ignored.
PodSpec kapi.PodSpec
// ServiceAccountNames is an optional set of ServiceAccounts to run the check with.
// If ServiceAccountNames is empty, the PodSpec ServiceAccountName is used,
// unless it's empty, in which case "default" is used instead.
// If ServiceAccountNames is specified, PodSpec ServiceAccountName is ignored.
ServiceAccountNames []string // TODO: find a way to express 'all service accounts'
}
// PodSecurityPolicyReviewStatus represents the status of PodSecurityPolicyReview.
type PodSecurityPolicyReviewStatus struct {
// AllowedServiceAccounts returns the list of service accounts in *this* namespace that have the power to create the PodSpec.
AllowedServiceAccounts []ServiceAccountPodSecurityPolicyReviewStatus
}
// ServiceAccountPodSecurityPolicyReviewStatus represents ServiceAccount name and related review status
type ServiceAccountPodSecurityPolicyReviewStatus struct {
PodSecurityPolicySubjectReviewStatus
// Name contains the allowed and the denied ServiceAccount name
Name string
}
@@ -0,0 +1,99 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_Parameter,
DeepCopy_api_Template,
DeepCopy_api_TemplateList,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_Parameter(in Parameter, out *Parameter, c *conversion.Cloner) error {
out.Name = in.Name
out.DisplayName = in.DisplayName
out.Description = in.Description
out.Value = in.Value
out.Generate = in.Generate
out.From = in.From
out.Required = in.Required
return nil
}
func DeepCopy_api_Template(in Template, out *Template, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Message = in.Message
if in.Parameters != nil {
in, out := in.Parameters, &out.Parameters
*out = make([]Parameter, len(in))
for i := range in {
if err := DeepCopy_api_Parameter(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Parameters = nil
}
if in.Objects != nil {
in, out := in.Objects, &out.Objects
*out = make([]runtime.Object, len(in))
for i := range in {
if newVal, err := c.DeepCopy(in[i]); err != nil {
return err
} else {
(*out)[i] = newVal.(runtime.Object)
}
}
} else {
out.Objects = nil
}
if in.ObjectLabels != nil {
in, out := in.ObjectLabels, &out.ObjectLabels
*out = make(map[string]string)
for key, val := range in {
(*out)[key] = val
}
} else {
out.ObjectLabels = nil
}
return nil
}
func DeepCopy_api_TemplateList(in TemplateList, out *TemplateList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Template, len(in))
for i := range in {
if err := DeepCopy_api_Template(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
+11
View File
@@ -0,0 +1,11 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// TemplateToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func TemplateToSelectableFields(template *Template) fields.Set {
return fields.Set{
"metadata.name": template.Name,
}
}
+43
View File
@@ -0,0 +1,43 @@
package api
import (
"errors"
"fmt"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
// AddObjectsToTemplate adds the objects to the template using the target versions to choose the conversion destination
func AddObjectsToTemplate(template *Template, objects []runtime.Object, targetVersions ...unversioned.GroupVersion) error {
for i := range objects {
obj := objects[i]
if obj == nil {
return errors.New("cannot add a nil object to a template")
}
kind, _, err := kapi.Scheme.ObjectKind(obj)
if err != nil {
return err
}
var targetVersion *unversioned.GroupVersion
for j := range targetVersions {
possibleVersion := targetVersions[j]
if kind.Group == possibleVersion.Group {
targetVersion = &possibleVersion
break
}
}
if targetVersion == nil {
return fmt.Errorf("no target version found for object[%d], kind %v in %v", i, kind, targetVersions)
}
wrappedObject := runtime.NewEncodable(kapi.Codecs.LegacyCodec(*targetVersion), obj)
template.Objects = append(template.Objects, wrappedObject)
}
return nil
}
+37
View File
@@ -0,0 +1,37 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&Template{},
&TemplateList{},
)
}
func (obj *Template) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *TemplateList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+72
View File
@@ -0,0 +1,72 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
// +genclient=true
// Template contains the inputs needed to produce a Config.
type Template struct {
unversioned.TypeMeta
kapi.ObjectMeta
// message is an optional instructional message that will
// be displayed when this template is instantiated.
// This field should inform the user how to utilize the newly created resources.
// Parameter substitution will be performed on the message before being
// displayed so that generated credentials and other parameters can be
// included in the output.
Message string
// parameters is an optional array of Parameters used during the
// Template to Config transformation.
Parameters []Parameter
// objects is an array of resources to include in this template.
Objects []runtime.Object
// objectLabels is an optional set of labels that are applied to every
// object during the Template to Config transformation.
ObjectLabels map[string]string
}
// TemplateList is a list of Template objects.
type TemplateList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []Template
}
// Parameter defines a name/value variable that is to be processed during
// the Template to Config transformation.
type Parameter struct {
// Required: Parameter name must be set and it can be referenced in Template
// Items using ${PARAMETER_NAME}
Name string
// Optional: The name that will show in UI instead of parameter 'Name'
DisplayName string
// Optional: Parameter can have description
Description string
// Optional: Value holds the Parameter data. If specified, the generator
// will be ignored. The value replaces all occurrences of the Parameter
// ${Name} expression during the Template to Config transformation.
Value string
// Optional: Generate specifies the generator to be used to generate
// random string from an input value specified by From field. The result
// string is stored into Value field. If empty, no generator is being
// used, leaving the result Value untouched.
Generate string
// Optional: From is an input value for the generator.
From string
// Optional: Indicates the parameter must have a value. Defaults to false.
Required bool
}
+171
View File
@@ -0,0 +1,171 @@
// +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_api_Group,
DeepCopy_api_GroupList,
DeepCopy_api_Identity,
DeepCopy_api_IdentityList,
DeepCopy_api_User,
DeepCopy_api_UserIdentityMapping,
DeepCopy_api_UserList,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_api_Group(in Group, out *Group, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if in.Users != nil {
in, out := in.Users, &out.Users
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Users = nil
}
return nil
}
func DeepCopy_api_GroupList(in GroupList, out *GroupList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Group, len(in))
for i := range in {
if err := DeepCopy_api_Group(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_Identity(in Identity, out *Identity, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.ProviderName = in.ProviderName
out.ProviderUserName = in.ProviderUserName
if err := api.DeepCopy_api_ObjectReference(in.User, &out.User, c); err != nil {
return err
}
if in.Extra != nil {
in, out := in.Extra, &out.Extra
*out = make(map[string]string)
for key, val := range in {
(*out)[key] = val
}
} else {
out.Extra = nil
}
return nil
}
func DeepCopy_api_IdentityList(in IdentityList, out *IdentityList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Identity, len(in))
for i := range in {
if err := DeepCopy_api_Identity(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_api_User(in User, out *User, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.FullName = in.FullName
if in.Identities != nil {
in, out := in.Identities, &out.Identities
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Identities = nil
}
if in.Groups != nil {
in, out := in.Groups, &out.Groups
*out = make([]string, len(in))
copy(*out, in)
} else {
out.Groups = nil
}
return nil
}
func DeepCopy_api_UserIdentityMapping(in UserIdentityMapping, out *UserIdentityMapping, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectReference(in.Identity, &out.Identity, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectReference(in.User, &out.User, c); err != nil {
return err
}
return nil
}
func DeepCopy_api_UserList(in UserList, out *UserList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]User, len(in))
for i := range in {
if err := DeepCopy_api_User(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
+31
View File
@@ -0,0 +1,31 @@
package api
import "k8s.io/kubernetes/pkg/fields"
// GroupToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func GroupToSelectableFields(group *Group) fields.Set {
return fields.Set{
"metadata.name": group.Name,
}
}
// IdentityToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func IdentityToSelectableFields(identity *Identity) fields.Set {
return fields.Set{
"metadata.name": identity.Name,
"providerName": identity.ProviderName,
"providerUserName": identity.ProviderName,
"user.name": identity.User.Name,
"user.uid": string(identity.User.UID),
}
}
// UserToSelectableFields returns a label set that represents the object
// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc
func UserToSelectableFields(user *User) fields.Set {
return fields.Set{
"metadata.name": user.Name,
}
}
+47
View File
@@ -0,0 +1,47 @@
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const GroupName = ""
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
func AddToScheme(scheme *runtime.Scheme) {
// Add the API to Scheme.
addKnownTypes(scheme)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&User{},
&UserList{},
&Identity{},
&IdentityList{},
&UserIdentityMapping{},
&Group{},
&GroupList{},
)
}
func (obj *GroupList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *Group) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *User) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *UserList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *Identity) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *IdentityList) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
func (obj *UserIdentityMapping) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }
+73
View File
@@ -0,0 +1,73 @@
package api
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
// Auth system gets identity name and provider
// POST to UserIdentityMapping, get back error or a filled out UserIdentityMapping object
// +genclient=true
type User struct {
unversioned.TypeMeta
kapi.ObjectMeta
FullName string
Identities []string
Groups []string
}
type UserList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []User
}
type Identity struct {
unversioned.TypeMeta
kapi.ObjectMeta
// ProviderName is the source of identity information
ProviderName string
// ProviderUserName uniquely represents this identity in the scope of the provider
ProviderUserName string
// User is a reference to the user this identity is associated with
// Both Name and UID must be set
User kapi.ObjectReference
Extra map[string]string
}
type IdentityList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []Identity
}
type UserIdentityMapping struct {
unversioned.TypeMeta
kapi.ObjectMeta
Identity kapi.ObjectReference
User kapi.ObjectReference
}
// Group represents a referenceable set of Users
type Group struct {
unversioned.TypeMeta
kapi.ObjectMeta
Users []string
}
type GroupList struct {
unversioned.TypeMeta
unversioned.ListMeta
Items []Group
}
+2
View File
@@ -0,0 +1,2 @@
// Package namer contains a name generator for unique names
package namer
+68
View File
@@ -0,0 +1,68 @@
package namer
import (
"fmt"
"hash/fnv"
kvalidation "k8s.io/kubernetes/pkg/util/validation"
)
// GetName returns a name given a base ("deployment-5") and a suffix ("deploy")
// It will first attempt to join them with a dash. If the resulting name is longer
// than maxLength: if the suffix is too long, it will truncate the base name and add
// an 8-character hash of the [base]-[suffix] string. If the suffix is not too long,
// it will truncate the base, add the hash of the base and return [base]-[hash]-[suffix]
func GetName(base, suffix string, maxLength int) string {
if maxLength <= 0 {
return ""
}
name := fmt.Sprintf("%s-%s", base, suffix)
if len(name) <= maxLength {
return name
}
baseLength := maxLength - 10 /*length of -hash-*/ - len(suffix)
// if the suffix is too long, ignore it
if baseLength < 0 {
prefix := base[0:min(len(base), max(0, maxLength-9))]
// Calculate hash on initial base-suffix string
shortName := fmt.Sprintf("%s-%s", prefix, hash(name))
return shortName[:min(maxLength, len(shortName))]
}
prefix := base[0:baseLength]
// Calculate hash on initial base-suffix string
return fmt.Sprintf("%s-%s-%s", prefix, hash(base), suffix)
}
// GetPodName calls GetName with the length restriction for pods
func GetPodName(base, suffix string) string {
return GetName(base, suffix, kvalidation.DNS1123SubdomainMaxLength)
}
// max returns the greater of its 2 inputs
func max(a, b int) int {
if b > a {
return b
}
return a
}
// min returns the lesser of its 2 inputs
func min(a, b int) int {
if b < a {
return b
}
return a
}
// hash calculates the hexadecimal representation (8-chars)
// of the hash of the passed in string using the FNV-a algorithm
func hash(s string) string {
hash := fnv.New32a()
hash.Write([]byte(s))
intHash := hash.Sum32()
result := fmt.Sprintf("%08x", intHash)
return result
}