diff --git a/api/protobuf-spec/github_com_openshift_origin_pkg_template_api_v1.proto b/api/protobuf-spec/github_com_openshift_origin_pkg_template_api_v1.proto index 86691f856fb4..ff61d5235258 100644 --- a/api/protobuf-spec/github_com_openshift_origin_pkg_template_api_v1.proto +++ b/api/protobuf-spec/github_com_openshift_origin_pkg_template_api_v1.proto @@ -13,6 +13,40 @@ import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; // Package-wide variables from generator "generated". option go_package = "v1"; +// BrokerTemplateInstance holds the service broker-related state associated with +// a TemplateInstance. BrokerTemplateInstance is part of an experimental API. +message BrokerTemplateInstance { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1; + + // spec describes the state of this BrokerTemplateInstance. + optional BrokerTemplateInstanceSpec spec = 2; +} + +// BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects. +message BrokerTemplateInstanceList { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1; + + // items is a list of BrokerTemplateInstances + repeated BrokerTemplateInstance items = 2; +} + +// BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance. +message BrokerTemplateInstanceSpec { + // templateinstance is a reference to a TemplateInstance object residing + // in a namespace. + optional k8s.io.kubernetes.pkg.api.v1.ObjectReference templateInstance = 1; + + // secret is a reference to a Secret object residing in a namespace, + // containing the necessary template parameters. + optional k8s.io.kubernetes.pkg.api.v1.ObjectReference secret = 2; + + // bindingids is a list of 'binding_id's provided during successive bind + // calls to the template service broker. + repeated string bindingIDs = 3; +} + // Parameter defines a name/value variable that is to be processed during // the Template to Config transformation. message Parameter { @@ -87,6 +121,78 @@ message Template { map labels = 5; } +// TemplateInstance requests and records the instantiation of a Template. +// TemplateInstance is part of an experimental API. +message TemplateInstance { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1; + + // spec describes the desired state of this TemplateInstance. + optional TemplateInstanceSpec spec = 2; + + // status describes the current state of this TemplateInstance. + optional TemplateInstanceStatus status = 3; +} + +// TemplateInstanceCondition contains condition information for a +// TemplateInstance. +message TemplateInstanceCondition { + // Type of the condition, currently Ready or InstantiateFailure. + optional string type = 1; + + // Status of the condition, one of True, False or Unknown. + optional string status = 2; + + // LastTransitionTime is the last time a condition status transitioned from + // one state to another. + optional k8s.io.kubernetes.pkg.api.unversioned.Time lastTransitionTime = 3; + + // Reason is a brief machine readable explanation for the condition's last + // transition. + optional string reason = 4; + + // Message is a human readable description of the details of the last + // transition, complementing reason. + optional string message = 5; +} + +// TemplateInstanceList is a list of TemplateInstance objects. +message TemplateInstanceList { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1; + + // items is a list of Templateinstances + repeated TemplateInstance items = 2; +} + +// TemplateInstanceRequestor holds the identity of an agent requesting a +// template instantiation. +message TemplateInstanceRequestor { + // username is the username of the agent requesting a template instantiation. + optional string username = 1; +} + +// TemplateInstanceSpec describes the desired state of a TemplateInstance. +message TemplateInstanceSpec { + // template is a full copy of the template for instantiation. + optional Template template = 1; + + // secret is a reference to a Secret object containing the necessary + // template parameters. + optional k8s.io.kubernetes.pkg.api.v1.LocalObjectReference secret = 2; + + // requestor holds the identity of the agent requesting the template + // instantiation. + optional TemplateInstanceRequestor requestor = 3; +} + +// TemplateInstanceStatus describes the current state of a TemplateInstance. +message TemplateInstanceStatus { + // conditions represent the latest available observations of a + // TemplateInstance's current state. + repeated TemplateInstanceCondition conditions = 1; +} + // TemplateList is a list of Template objects. message TemplateList { // Standard object's metadata. diff --git a/contrib/completions/bash/oc b/contrib/completions/bash/oc index 636f79eeca01..a11c5a9db079 100644 --- a/contrib/completions/bash/oc +++ b/contrib/completions/bash/oc @@ -5382,6 +5382,7 @@ _oc_annotate() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -5449,6 +5450,7 @@ _oc_annotate() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -5456,6 +5458,7 @@ _oc_annotate() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -5546,6 +5549,7 @@ _oc_annotate() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -9146,6 +9150,7 @@ _oc_delete() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -9213,6 +9218,7 @@ _oc_delete() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -9220,6 +9226,7 @@ _oc_delete() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -9310,6 +9317,7 @@ _oc_delete() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -9608,6 +9616,7 @@ _oc_edit() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -9675,6 +9684,7 @@ _oc_edit() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -9682,6 +9692,7 @@ _oc_edit() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -9772,6 +9783,7 @@ _oc_edit() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -10477,6 +10489,7 @@ _oc_get() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -10544,6 +10557,7 @@ _oc_get() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -10551,6 +10565,7 @@ _oc_get() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -10641,6 +10656,7 @@ _oc_get() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -11040,6 +11056,7 @@ _oc_label() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -11107,6 +11124,7 @@ _oc_label() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -11114,6 +11132,7 @@ _oc_label() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -11204,6 +11223,7 @@ _oc_label() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -11867,6 +11887,7 @@ _oc_patch() must_have_one_flag+=("-p") must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -11934,6 +11955,7 @@ _oc_patch() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -11941,6 +11963,7 @@ _oc_patch() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -12031,6 +12054,7 @@ _oc_patch() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") diff --git a/contrib/completions/bash/openshift b/contrib/completions/bash/openshift index 5edd141a3098..4018cba3a4b5 100644 --- a/contrib/completions/bash/openshift +++ b/contrib/completions/bash/openshift @@ -10482,6 +10482,7 @@ _openshift_cli_annotate() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -10549,6 +10550,7 @@ _openshift_cli_annotate() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -10556,6 +10558,7 @@ _openshift_cli_annotate() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -10646,6 +10649,7 @@ _openshift_cli_annotate() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -14350,6 +14354,7 @@ _openshift_cli_delete() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -14417,6 +14422,7 @@ _openshift_cli_delete() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -14424,6 +14430,7 @@ _openshift_cli_delete() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -14514,6 +14521,7 @@ _openshift_cli_delete() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -14818,6 +14826,7 @@ _openshift_cli_edit() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -14885,6 +14894,7 @@ _openshift_cli_edit() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -14892,6 +14902,7 @@ _openshift_cli_edit() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -14982,6 +14993,7 @@ _openshift_cli_edit() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -15705,6 +15717,7 @@ _openshift_cli_get() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -15772,6 +15785,7 @@ _openshift_cli_get() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -15779,6 +15793,7 @@ _openshift_cli_get() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -15869,6 +15884,7 @@ _openshift_cli_get() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -16280,6 +16296,7 @@ _openshift_cli_label() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -16347,6 +16364,7 @@ _openshift_cli_label() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -16354,6 +16372,7 @@ _openshift_cli_label() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -16444,6 +16463,7 @@ _openshift_cli_label() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -17125,6 +17145,7 @@ _openshift_cli_patch() must_have_one_flag+=("-p") must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -17192,6 +17213,7 @@ _openshift_cli_patch() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -17199,6 +17221,7 @@ _openshift_cli_patch() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -17289,6 +17312,7 @@ _openshift_cli_patch() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -22778,6 +22802,7 @@ _openshift_kube_annotate() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -22845,6 +22870,7 @@ _openshift_kube_annotate() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -22852,6 +22878,7 @@ _openshift_kube_annotate() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -22942,6 +22969,7 @@ _openshift_kube_annotate() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -27354,6 +27382,7 @@ _openshift_kube_delete() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -27421,6 +27450,7 @@ _openshift_kube_delete() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -27428,6 +27458,7 @@ _openshift_kube_delete() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -27518,6 +27549,7 @@ _openshift_kube_delete() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -27918,6 +27950,7 @@ _openshift_kube_edit() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -27985,6 +28018,7 @@ _openshift_kube_edit() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -27992,6 +28026,7 @@ _openshift_kube_edit() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -28082,6 +28117,7 @@ _openshift_kube_edit() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -28584,6 +28620,7 @@ _openshift_kube_get() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -28651,6 +28688,7 @@ _openshift_kube_get() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -28658,6 +28696,7 @@ _openshift_kube_get() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -28748,6 +28787,7 @@ _openshift_kube_get() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -28887,6 +28927,7 @@ _openshift_kube_label() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -28954,6 +28995,7 @@ _openshift_kube_label() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -28961,6 +29003,7 @@ _openshift_kube_label() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -29051,6 +29094,7 @@ _openshift_kube_label() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -29472,6 +29516,7 @@ _openshift_kube_patch() must_have_one_flag+=("-p") must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -29539,6 +29584,7 @@ _openshift_kube_patch() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -29546,6 +29592,7 @@ _openshift_kube_patch() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -29636,6 +29683,7 @@ _openshift_kube_patch() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") diff --git a/contrib/completions/zsh/oc b/contrib/completions/zsh/oc index d48a33d11615..7beabcfc6a1d 100644 --- a/contrib/completions/zsh/oc +++ b/contrib/completions/zsh/oc @@ -5530,6 +5530,7 @@ _oc_annotate() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -5597,6 +5598,7 @@ _oc_annotate() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -5604,6 +5606,7 @@ _oc_annotate() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -5694,6 +5697,7 @@ _oc_annotate() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -9294,6 +9298,7 @@ _oc_delete() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -9361,6 +9366,7 @@ _oc_delete() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -9368,6 +9374,7 @@ _oc_delete() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -9458,6 +9465,7 @@ _oc_delete() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -9756,6 +9764,7 @@ _oc_edit() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -9823,6 +9832,7 @@ _oc_edit() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -9830,6 +9840,7 @@ _oc_edit() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -9920,6 +9931,7 @@ _oc_edit() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -10625,6 +10637,7 @@ _oc_get() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -10692,6 +10705,7 @@ _oc_get() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -10699,6 +10713,7 @@ _oc_get() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -10789,6 +10804,7 @@ _oc_get() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -11188,6 +11204,7 @@ _oc_label() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -11255,6 +11272,7 @@ _oc_label() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -11262,6 +11280,7 @@ _oc_label() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -11352,6 +11371,7 @@ _oc_label() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -12015,6 +12035,7 @@ _oc_patch() must_have_one_flag+=("-p") must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -12082,6 +12103,7 @@ _oc_patch() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -12089,6 +12111,7 @@ _oc_patch() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -12179,6 +12202,7 @@ _oc_patch() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") diff --git a/contrib/completions/zsh/openshift b/contrib/completions/zsh/openshift index 379a9beec6e1..803574510241 100644 --- a/contrib/completions/zsh/openshift +++ b/contrib/completions/zsh/openshift @@ -10630,6 +10630,7 @@ _openshift_cli_annotate() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -10697,6 +10698,7 @@ _openshift_cli_annotate() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -10704,6 +10706,7 @@ _openshift_cli_annotate() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -10794,6 +10797,7 @@ _openshift_cli_annotate() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -14498,6 +14502,7 @@ _openshift_cli_delete() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -14565,6 +14570,7 @@ _openshift_cli_delete() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -14572,6 +14578,7 @@ _openshift_cli_delete() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -14662,6 +14669,7 @@ _openshift_cli_delete() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -14966,6 +14974,7 @@ _openshift_cli_edit() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -15033,6 +15042,7 @@ _openshift_cli_edit() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -15040,6 +15050,7 @@ _openshift_cli_edit() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -15130,6 +15141,7 @@ _openshift_cli_edit() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -15853,6 +15865,7 @@ _openshift_cli_get() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -15920,6 +15933,7 @@ _openshift_cli_get() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -15927,6 +15941,7 @@ _openshift_cli_get() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -16017,6 +16032,7 @@ _openshift_cli_get() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -16428,6 +16444,7 @@ _openshift_cli_label() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -16495,6 +16512,7 @@ _openshift_cli_label() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -16502,6 +16520,7 @@ _openshift_cli_label() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -16592,6 +16611,7 @@ _openshift_cli_label() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -17273,6 +17293,7 @@ _openshift_cli_patch() must_have_one_flag+=("-p") must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -17340,6 +17361,7 @@ _openshift_cli_patch() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -17347,6 +17369,7 @@ _openshift_cli_patch() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -17437,6 +17460,7 @@ _openshift_cli_patch() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -22926,6 +22950,7 @@ _openshift_kube_annotate() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -22993,6 +23018,7 @@ _openshift_kube_annotate() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -23000,6 +23026,7 @@ _openshift_kube_annotate() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -23090,6 +23117,7 @@ _openshift_kube_annotate() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -27502,6 +27530,7 @@ _openshift_kube_delete() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -27569,6 +27598,7 @@ _openshift_kube_delete() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -27576,6 +27606,7 @@ _openshift_kube_delete() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -27666,6 +27697,7 @@ _openshift_kube_delete() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -28066,6 +28098,7 @@ _openshift_kube_edit() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -28133,6 +28166,7 @@ _openshift_kube_edit() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -28140,6 +28174,7 @@ _openshift_kube_edit() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -28230,6 +28265,7 @@ _openshift_kube_edit() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -28732,6 +28768,7 @@ _openshift_kube_get() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -28799,6 +28836,7 @@ _openshift_kube_get() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -28806,6 +28844,7 @@ _openshift_kube_get() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -28896,6 +28935,7 @@ _openshift_kube_get() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -29035,6 +29075,7 @@ _openshift_kube_label() must_have_one_flag=() must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -29102,6 +29143,7 @@ _openshift_kube_label() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -29109,6 +29151,7 @@ _openshift_kube_label() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -29199,6 +29242,7 @@ _openshift_kube_label() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") @@ -29620,6 +29664,7 @@ _openshift_kube_patch() must_have_one_flag+=("-p") must_have_one_noun=() must_have_one_noun+=("appliedclusterresourcequota") + must_have_one_noun+=("brokertemplateinstance") must_have_one_noun+=("build") must_have_one_noun+=("buildconfig") must_have_one_noun+=("certificatesigningrequest") @@ -29687,6 +29732,7 @@ _openshift_kube_patch() must_have_one_noun+=("status") must_have_one_noun+=("storageclass") must_have_one_noun+=("template") + must_have_one_noun+=("templateinstance") must_have_one_noun+=("thirdpartyresource") must_have_one_noun+=("thirdpartyresourcedata") must_have_one_noun+=("user") @@ -29694,6 +29740,7 @@ _openshift_kube_patch() noun_aliases=() noun_aliases+=("appliedclusterresourcequotas") noun_aliases+=("bc") + noun_aliases+=("brokertemplateinstances") noun_aliases+=("buildconfigs") noun_aliases+=("builds") noun_aliases+=("certificatesigningrequests") @@ -29784,6 +29831,7 @@ _openshift_kube_patch() noun_aliases+=("statuses") noun_aliases+=("storageclasses") noun_aliases+=("svc") + noun_aliases+=("templateinstances") noun_aliases+=("templates") noun_aliases+=("thirdpartyresourcedatas") noun_aliases+=("thirdpartyresources") diff --git a/hack/update-generated-clientsets.sh b/hack/update-generated-clientsets.sh index a90bacf60cbd..d14e68503f61 100755 --- a/hack/update-generated-clientsets.sh +++ b/hack/update-generated-clientsets.sh @@ -13,6 +13,7 @@ packages=( github.com/openshift/origin/pkg/image github.com/openshift/origin/pkg/oauth github.com/openshift/origin/pkg/project + github.com/openshift/origin/pkg/quota github.com/openshift/origin/pkg/route github.com/openshift/origin/pkg/sdn github.com/openshift/origin/pkg/template @@ -23,9 +24,8 @@ function generate_clientset_for() { local package="$1";shift local name="$1";shift echo "-- Generating ${name} client set for ${package} ..." - client-gen --clientset-path="${package}/client/clientset_generated" \ - --clientset-api-path="/oapi" \ - --input-base="${package}/api" \ + client-gen --clientset-path="${package}/clientset" \ + --input-base="${package}" \ --output-base="../../.." \ --clientset-name="${name}" \ --go-header-file=hack/boilerplate.txt \ @@ -37,7 +37,7 @@ verify="${VERIFY:-}" # remove the old client sets for pkg in "${packages[@]}"; do if [[ -z "${verify}" ]]; then - go list -f '{{.Dir}}' "${pkg}/client/clientset_generated/..." | xargs rm -rf + go list -f '{{.Dir}}' "${pkg}/clientset/..." | xargs rm -rf fi done @@ -46,7 +46,7 @@ os::build::get_version_vars origin_version="v${OS_GIT_MAJOR}_${OS_GIT_MINOR%+}" for pkg in "${packages[@]}"; do - generate_clientset_for "${pkg}" "internalclientset" --input=api/ "$@" - generate_clientset_for "${pkg}" "release_${origin_version}" --input=api/v1 "$@" + shortGroup=$(basename "${pkg}") + generate_clientset_for "${pkg}" "internalclientset" --group=${shortGroup} --input=api/ "$@" + generate_clientset_for "${pkg}" "release_${origin_version}" --group=${shortGroup} --version=v1 --input=api/v1 "$@" done - diff --git a/pkg/api/install/install.go b/pkg/api/install/install.go index 7d8aaa6e1a67..43fe4421e530 100644 --- a/pkg/api/install/install.go +++ b/pkg/api/install/install.go @@ -251,6 +251,50 @@ func init() { return true, templatev1.Convert_api_TemplateList_To_v1_TemplateList(a, b, s) } + case *templatev1.TemplateInstance: + switch b := objB.(type) { + case *templateapi.TemplateInstance: + return true, templatev1.Convert_v1_TemplateInstance_To_api_TemplateInstance(a, b, s) + } + case *templateapi.TemplateInstance: + switch b := objB.(type) { + case *templatev1.TemplateInstance: + return true, templatev1.Convert_api_TemplateInstance_To_v1_TemplateInstance(a, b, s) + } + + case *templatev1.TemplateInstanceList: + switch b := objB.(type) { + case *templateapi.TemplateInstanceList: + return true, templatev1.Convert_v1_TemplateInstanceList_To_api_TemplateInstanceList(a, b, s) + } + case *templateapi.TemplateInstanceList: + switch b := objB.(type) { + case *templatev1.TemplateInstanceList: + return true, templatev1.Convert_api_TemplateInstanceList_To_v1_TemplateInstanceList(a, b, s) + } + + case *templatev1.BrokerTemplateInstance: + switch b := objB.(type) { + case *templateapi.BrokerTemplateInstance: + return true, templatev1.Convert_v1_BrokerTemplateInstance_To_api_BrokerTemplateInstance(a, b, s) + } + case *templateapi.BrokerTemplateInstance: + switch b := objB.(type) { + case *templatev1.BrokerTemplateInstance: + return true, templatev1.Convert_api_BrokerTemplateInstance_To_v1_BrokerTemplateInstance(a, b, s) + } + + case *templatev1.BrokerTemplateInstanceList: + switch b := objB.(type) { + case *templateapi.BrokerTemplateInstanceList: + return true, templatev1.Convert_v1_BrokerTemplateInstanceList_To_api_BrokerTemplateInstanceList(a, b, s) + } + case *templateapi.BrokerTemplateInstanceList: + switch b := objB.(type) { + case *templatev1.BrokerTemplateInstanceList: + return true, templatev1.Convert_api_BrokerTemplateInstanceList_To_v1_BrokerTemplateInstanceList(a, b, s) + } + case *deployv1.DeploymentConfig: switch b := objB.(type) { case *deployapi.DeploymentConfig: diff --git a/pkg/api/validation/register.go b/pkg/api/validation/register.go index a896fcb80067..55acd78afee9 100644 --- a/pkg/api/validation/register.go +++ b/pkg/api/validation/register.go @@ -92,6 +92,8 @@ func registerAll() { Validator.MustRegister(&sdnapi.EgressNetworkPolicy{}, sdnvalidation.ValidateEgressNetworkPolicy, sdnvalidation.ValidateEgressNetworkPolicyUpdate) Validator.MustRegister(&templateapi.Template{}, templatevalidation.ValidateTemplate, templatevalidation.ValidateTemplateUpdate) + Validator.MustRegister(&templateapi.TemplateInstance{}, templatevalidation.ValidateTemplateInstance, templatevalidation.ValidateTemplateInstanceUpdate) + Validator.MustRegister(&templateapi.BrokerTemplateInstance{}, templatevalidation.ValidateBrokerTemplateInstance, templatevalidation.ValidateBrokerTemplateInstanceUpdate) Validator.MustRegister(&userapi.User{}, uservalidation.ValidateUser, uservalidation.ValidateUserUpdate) Validator.MustRegister(&userapi.Identity{}, uservalidation.ValidateIdentity, uservalidation.ValidateIdentityUpdate) diff --git a/pkg/authorization/api/doc.go b/pkg/authorization/api/doc.go index 9f6c967cfa9e..b9cb48f0c3ff 100644 --- a/pkg/authorization/api/doc.go +++ b/pkg/authorization/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=authorization.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/authorization/api/v1/doc.go b/pkg/authorization/api/v1/doc.go index 787aeeaef9ca..b0b1e15ce582 100644 --- a/pkg/authorization/api/v1/doc.go +++ b/pkg/authorization/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=authorization.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/authorization/clientset/internalclientset/clientset.go b/pkg/authorization/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..2292096e9635 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionauthorization "github.com/openshift/origin/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Authorization() internalversionauthorization.AuthorizationInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionauthorization.AuthorizationClient +} + +// Authorization retrieves the AuthorizationClient +func (c *Clientset) Authorization() internalversionauthorization.AuthorizationInterface { + if c == nil { + return nil + } + return c.AuthorizationClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.AuthorizationClient, err = internalversionauthorization.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.AuthorizationClient = internalversionauthorization.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.AuthorizationClient = internalversionauthorization.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/authorization/clientset/internalclientset/doc.go b/pkg/authorization/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..fbe83447e88c --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/authorization/clientset/internalclientset/fake/clientset_generated.go b/pkg/authorization/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..f192f18e8f09 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/authorization/clientset/internalclientset" + internalversionauthorization "github.com/openshift/origin/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion" + fakeinternalversionauthorization "github.com/openshift/origin/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Authorization retrieves the AuthorizationClient +func (c *Clientset) Authorization() internalversionauthorization.AuthorizationInterface { + return &fakeinternalversionauthorization.FakeAuthorization{Fake: &c.Fake} +} diff --git a/pkg/authorization/clientset/internalclientset/fake/doc.go b/pkg/authorization/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..ef293262d641 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/authorization_client.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/authorization_client.go new file mode 100644 index 000000000000..218a45ccf107 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/authorization_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type AuthorizationInterface interface { + RESTClient() restclient.Interface + PoliciesGetter +} + +// AuthorizationClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type AuthorizationClient struct { + restClient restclient.Interface +} + +func (c *AuthorizationClient) Policies(namespace string) PolicyInterface { + return newPolicies(c, namespace) +} + +// NewForConfig creates a new AuthorizationClient for the given config. +func NewForConfig(c *restclient.Config) (*AuthorizationClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &AuthorizationClient{client}, nil +} + +// NewForConfigOrDie creates a new AuthorizationClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *AuthorizationClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AuthorizationClient for the given RESTClient. +func New(c restclient.Interface) *AuthorizationClient { + return &AuthorizationClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if authorization group is not registered, return an error + g, err := registered.Group("authorization.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AuthorizationClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/doc.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/doc.go new file mode 100644 index 000000000000..f20c33defa2b --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/doc.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/doc.go new file mode 100644 index 000000000000..c7ee1a6d0291 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/fake_authorization_client.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/fake_authorization_client.go new file mode 100644 index 000000000000..709141de4cee --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/fake_authorization_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeAuthorization struct { + *core.Fake +} + +func (c *FakeAuthorization) Policies(namespace string) internalversion.PolicyInterface { + return &FakePolicies{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAuthorization) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/fake_policy.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/fake_policy.go new file mode 100644 index 000000000000..6284e9cb4905 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/fake/fake_policy.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/authorization/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakePolicies implements PolicyInterface +type FakePolicies struct { + Fake *FakeAuthorization + ns string +} + +var policiesResource = unversioned.GroupVersionResource{Group: "authorization.openshift.io", Version: "", Resource: "policies"} + +func (c *FakePolicies) Create(policy *api.Policy) (result *api.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(policiesResource, c.ns, policy), &api.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Policy), err +} + +func (c *FakePolicies) Update(policy *api.Policy) (result *api.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(policiesResource, c.ns, policy), &api.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Policy), err +} + +func (c *FakePolicies) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(policiesResource, c.ns, name), &api.Policy{}) + + return err +} + +func (c *FakePolicies) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(policiesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.PolicyList{}) + return err +} + +func (c *FakePolicies) Get(name string) (result *api.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(policiesResource, c.ns, name), &api.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Policy), err +} + +func (c *FakePolicies) List(opts pkg_api.ListOptions) (result *api.PolicyList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(policiesResource, c.ns, opts), &api.PolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.PolicyList{} + for _, item := range obj.(*api.PolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested policies. +func (c *FakePolicies) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(policiesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched policy. +func (c *FakePolicies) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(policiesResource, c.ns, name, data, subresources...), &api.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Policy), err +} diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/generated_expansion.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/generated_expansion.go new file mode 100644 index 000000000000..57123f59b254 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type PolicyExpansion interface{} diff --git a/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/policy.go b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/policy.go new file mode 100644 index 000000000000..63cc08116a17 --- /dev/null +++ b/pkg/authorization/clientset/internalclientset/typed/authorization/internalversion/policy.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/authorization/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// PoliciesGetter has a method to return a PolicyInterface. +// A group's client should implement this interface. +type PoliciesGetter interface { + Policies(namespace string) PolicyInterface +} + +// PolicyInterface has methods to work with Policy resources. +type PolicyInterface interface { + Create(*api.Policy) (*api.Policy, error) + Update(*api.Policy) (*api.Policy, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.Policy, error) + List(opts pkg_api.ListOptions) (*api.PolicyList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Policy, err error) + PolicyExpansion +} + +// policies implements PolicyInterface +type policies struct { + client restclient.Interface + ns string +} + +// newPolicies returns a Policies +func newPolicies(c *AuthorizationClient, namespace string) *policies { + return &policies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *policies) Create(policy *api.Policy) (result *api.Policy, err error) { + result = &api.Policy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("policies"). + Body(policy). + Do(). + Into(result) + return +} + +// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *policies) Update(policy *api.Policy) (result *api.Policy, err error) { + result = &api.Policy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("policies"). + Name(policy.Name). + Body(policy). + Do(). + Into(result) + return +} + +// Delete takes name of the policy and deletes it. Returns an error if one occurs. +func (c *policies) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policies"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *policies) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any. +func (c *policies) Get(name string) (result *api.Policy, err error) { + result = &api.Policy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policies"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Policies that match those selectors. +func (c *policies) List(opts pkg_api.ListOptions) (result *api.PolicyList, err error) { + result = &api.PolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested policies. +func (c *policies) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched policy. +func (c *policies) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Policy, err error) { + result = &api.Policy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("policies"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/authorization/clientset/release_v3_6/clientset.go b/pkg/authorization/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..0e7567f0cfed --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1authorization "github.com/openshift/origin/pkg/authorization/clientset/release_v3_6/typed/authorization/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + AuthorizationV1() v1authorization.AuthorizationV1Interface + // Deprecated: please explicitly pick a version if possible. + Authorization() v1authorization.AuthorizationV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1authorization.AuthorizationV1Client +} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (c *Clientset) AuthorizationV1() v1authorization.AuthorizationV1Interface { + if c == nil { + return nil + } + return c.AuthorizationV1Client +} + +// Deprecated: Authorization retrieves the default version of AuthorizationClient. +// Please explicitly pick a version. +func (c *Clientset) Authorization() v1authorization.AuthorizationV1Interface { + if c == nil { + return nil + } + return c.AuthorizationV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.AuthorizationV1Client, err = v1authorization.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.AuthorizationV1Client = v1authorization.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.AuthorizationV1Client = v1authorization.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/authorization/clientset/release_v3_6/doc.go b/pkg/authorization/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..d5add08e9375 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/authorization/clientset/release_v3_6/fake/clientset_generated.go b/pkg/authorization/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..3be28fc98159 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/authorization/clientset/release_v3_6" + v1authorization "github.com/openshift/origin/pkg/authorization/clientset/release_v3_6/typed/authorization/v1" + fakev1authorization "github.com/openshift/origin/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (c *Clientset) AuthorizationV1() v1authorization.AuthorizationV1Interface { + return &fakev1authorization.FakeAuthorizationV1{Fake: &c.Fake} +} + +// Authorization retrieves the AuthorizationV1Client +func (c *Clientset) Authorization() v1authorization.AuthorizationV1Interface { + return &fakev1authorization.FakeAuthorizationV1{Fake: &c.Fake} +} diff --git a/pkg/authorization/clientset/release_v3_6/fake/doc.go b/pkg/authorization/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..fb4848657c9d --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/authorization_client.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/authorization_client.go new file mode 100644 index 000000000000..97b6ebee37f4 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/authorization_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type AuthorizationV1Interface interface { + RESTClient() restclient.Interface + PoliciesGetter +} + +// AuthorizationV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type AuthorizationV1Client struct { + restClient restclient.Interface +} + +func (c *AuthorizationV1Client) Policies(namespace string) PolicyInterface { + return newPolicies(c, namespace) +} + +// NewForConfig creates a new AuthorizationV1Client for the given config. +func NewForConfig(c *restclient.Config) (*AuthorizationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &AuthorizationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AuthorizationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *AuthorizationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AuthorizationV1Client for the given RESTClient. +func New(c restclient.Interface) *AuthorizationV1Client { + return &AuthorizationV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("authorization.openshift.io/v1") + if err != nil { + return err + } + // if authorization.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("authorization.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AuthorizationV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/doc.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/doc.go new file mode 100644 index 000000000000..5361aee375e4 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/doc.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/doc.go new file mode 100644 index 000000000000..41799cf422c4 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/authorization/clientset --go-header-file=hack/boilerplate.txt --group=authorization --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/fake_authorization_client.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/fake_authorization_client.go new file mode 100644 index 000000000000..564017493410 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/fake_authorization_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/authorization/clientset/release_v3_6/typed/authorization/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeAuthorizationV1 struct { + *core.Fake +} + +func (c *FakeAuthorizationV1) Policies(namespace string) v1.PolicyInterface { + return &FakePolicies{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAuthorizationV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/fake_policy.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/fake_policy.go new file mode 100644 index 000000000000..c208fbba05b5 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/fake/fake_policy.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/authorization/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakePolicies implements PolicyInterface +type FakePolicies struct { + Fake *FakeAuthorizationV1 + ns string +} + +var policiesResource = unversioned.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "policies"} + +func (c *FakePolicies) Create(policy *v1.Policy) (result *v1.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(policiesResource, c.ns, policy), &v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Policy), err +} + +func (c *FakePolicies) Update(policy *v1.Policy) (result *v1.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(policiesResource, c.ns, policy), &v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Policy), err +} + +func (c *FakePolicies) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(policiesResource, c.ns, name), &v1.Policy{}) + + return err +} + +func (c *FakePolicies) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(policiesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.PolicyList{}) + return err +} + +func (c *FakePolicies) Get(name string) (result *v1.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(policiesResource, c.ns, name), &v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Policy), err +} + +func (c *FakePolicies) List(opts api_v1.ListOptions) (result *v1.PolicyList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(policiesResource, c.ns, opts), &v1.PolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.PolicyList{} + for _, item := range obj.(*v1.PolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested policies. +func (c *FakePolicies) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(policiesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched policy. +func (c *FakePolicies) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Policy, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(policiesResource, c.ns, name, data, subresources...), &v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Policy), err +} diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/generated_expansion.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/generated_expansion.go new file mode 100644 index 000000000000..07761d78ea47 --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type PolicyExpansion interface{} diff --git a/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/policy.go b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/policy.go new file mode 100644 index 000000000000..58846ab8ceef --- /dev/null +++ b/pkg/authorization/clientset/release_v3_6/typed/authorization/v1/policy.go @@ -0,0 +1,137 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/authorization/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// PoliciesGetter has a method to return a PolicyInterface. +// A group's client should implement this interface. +type PoliciesGetter interface { + Policies(namespace string) PolicyInterface +} + +// PolicyInterface has methods to work with Policy resources. +type PolicyInterface interface { + Create(*v1.Policy) (*v1.Policy, error) + Update(*v1.Policy) (*v1.Policy, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.Policy, error) + List(opts api_v1.ListOptions) (*v1.PolicyList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Policy, err error) + PolicyExpansion +} + +// policies implements PolicyInterface +type policies struct { + client restclient.Interface + ns string +} + +// newPolicies returns a Policies +func newPolicies(c *AuthorizationV1Client, namespace string) *policies { + return &policies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *policies) Create(policy *v1.Policy) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("policies"). + Body(policy). + Do(). + Into(result) + return +} + +// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *policies) Update(policy *v1.Policy) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("policies"). + Name(policy.Name). + Body(policy). + Do(). + Into(result) + return +} + +// Delete takes name of the policy and deletes it. Returns an error if one occurs. +func (c *policies) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policies"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *policies) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any. +func (c *policies) Get(name string) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policies"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Policies that match those selectors. +func (c *policies) List(opts api_v1.ListOptions) (result *v1.PolicyList, err error) { + result = &v1.PolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested policies. +func (c *policies) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched policy. +func (c *policies) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("policies"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/build/api/doc.go b/pkg/build/api/doc.go index 9f6c967cfa9e..a330124c455a 100644 --- a/pkg/build/api/doc.go +++ b/pkg/build/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=build.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/build/api/v1/doc.go b/pkg/build/api/v1/doc.go index fc43ef839c77..32dd0cea1125 100644 --- a/pkg/build/api/v1/doc.go +++ b/pkg/build/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=build.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/build/clientset/internalclientset/clientset.go b/pkg/build/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..2ba49302babe --- /dev/null +++ b/pkg/build/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionbuild "github.com/openshift/origin/pkg/build/clientset/internalclientset/typed/build/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Build() internalversionbuild.BuildInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionbuild.BuildClient +} + +// Build retrieves the BuildClient +func (c *Clientset) Build() internalversionbuild.BuildInterface { + if c == nil { + return nil + } + return c.BuildClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.BuildClient, err = internalversionbuild.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.BuildClient = internalversionbuild.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.BuildClient = internalversionbuild.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/build/clientset/internalclientset/doc.go b/pkg/build/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..e44bb8cce5e5 --- /dev/null +++ b/pkg/build/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/build/clientset/internalclientset/fake/clientset_generated.go b/pkg/build/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..a1abbf15f80a --- /dev/null +++ b/pkg/build/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/build/clientset/internalclientset" + internalversionbuild "github.com/openshift/origin/pkg/build/clientset/internalclientset/typed/build/internalversion" + fakeinternalversionbuild "github.com/openshift/origin/pkg/build/clientset/internalclientset/typed/build/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Build retrieves the BuildClient +func (c *Clientset) Build() internalversionbuild.BuildInterface { + return &fakeinternalversionbuild.FakeBuild{Fake: &c.Fake} +} diff --git a/pkg/build/clientset/internalclientset/fake/doc.go b/pkg/build/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..d41e781879f2 --- /dev/null +++ b/pkg/build/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/build.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/build.go new file mode 100644 index 000000000000..cfa5ae4145db --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/build.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/build/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// BuildsGetter has a method to return a BuildResourceInterface. +// A group's client should implement this interface. +type BuildsGetter interface { + Builds(namespace string) BuildResourceInterface +} + +// BuildResourceInterface has methods to work with BuildResource resources. +type BuildResourceInterface interface { + Create(*api.Build) (*api.Build, error) + Update(*api.Build) (*api.Build, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.Build, error) + List(opts pkg_api.ListOptions) (*api.BuildList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Build, err error) + BuildResourceExpansion +} + +// builds implements BuildResourceInterface +type builds struct { + client restclient.Interface + ns string +} + +// newBuilds returns a Builds +func newBuilds(c *BuildClient, namespace string) *builds { + return &builds{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a build and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Create(build *api.Build) (result *api.Build, err error) { + result = &api.Build{} + err = c.client.Post(). + Namespace(c.ns). + Resource("builds"). + Body(build). + Do(). + Into(result) + return +} + +// Update takes the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Update(build *api.Build) (result *api.Build, err error) { + result = &api.Build{} + err = c.client.Put(). + Namespace(c.ns). + Resource("builds"). + Name(build.Name). + Body(build). + Do(). + Into(result) + return +} + +// Delete takes name of the build and deletes it. Returns an error if one occurs. +func (c *builds) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("builds"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *builds) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the build, and returns the corresponding build object, and an error if there is any. +func (c *builds) Get(name string) (result *api.Build, err error) { + result = &api.Build{} + err = c.client.Get(). + Namespace(c.ns). + Resource("builds"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Builds that match those selectors. +func (c *builds) List(opts pkg_api.ListOptions) (result *api.BuildList, err error) { + result = &api.BuildList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested builds. +func (c *builds) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched build. +func (c *builds) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Build, err error) { + result = &api.Build{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("builds"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/build_client.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/build_client.go new file mode 100644 index 000000000000..b2a433a8d7fd --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/build_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type BuildInterface interface { + RESTClient() restclient.Interface + BuildsGetter +} + +// BuildClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type BuildClient struct { + restClient restclient.Interface +} + +func (c *BuildClient) Builds(namespace string) BuildResourceInterface { + return newBuilds(c, namespace) +} + +// NewForConfig creates a new BuildClient for the given config. +func NewForConfig(c *restclient.Config) (*BuildClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &BuildClient{client}, nil +} + +// NewForConfigOrDie creates a new BuildClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *BuildClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BuildClient for the given RESTClient. +func New(c restclient.Interface) *BuildClient { + return &BuildClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if build group is not registered, return an error + g, err := registered.Group("build.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BuildClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/doc.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/doc.go new file mode 100644 index 000000000000..f5e43cf3219c --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/doc.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/doc.go new file mode 100644 index 000000000000..5dcefa7bd251 --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/fake_build.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/fake_build.go new file mode 100644 index 000000000000..4d417deea090 --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/fake_build.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/build/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeBuilds implements BuildResourceInterface +type FakeBuilds struct { + Fake *FakeBuild + ns string +} + +var buildsResource = unversioned.GroupVersionResource{Group: "build.openshift.io", Version: "", Resource: "builds"} + +func (c *FakeBuilds) Create(build *api.Build) (result *api.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(buildsResource, c.ns, build), &api.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Build), err +} + +func (c *FakeBuilds) Update(build *api.Build) (result *api.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(buildsResource, c.ns, build), &api.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Build), err +} + +func (c *FakeBuilds) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(buildsResource, c.ns, name), &api.Build{}) + + return err +} + +func (c *FakeBuilds) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(buildsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.BuildList{}) + return err +} + +func (c *FakeBuilds) Get(name string) (result *api.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(buildsResource, c.ns, name), &api.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Build), err +} + +func (c *FakeBuilds) List(opts pkg_api.ListOptions) (result *api.BuildList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(buildsResource, c.ns, opts), &api.BuildList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.BuildList{} + for _, item := range obj.(*api.BuildList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested builds. +func (c *FakeBuilds) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(buildsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched build. +func (c *FakeBuilds) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(buildsResource, c.ns, name, data, subresources...), &api.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Build), err +} diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/fake_build_client.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/fake_build_client.go new file mode 100644 index 000000000000..0c6c84e058eb --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/fake/fake_build_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/build/clientset/internalclientset/typed/build/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeBuild struct { + *core.Fake +} + +func (c *FakeBuild) Builds(namespace string) internalversion.BuildResourceInterface { + return &FakeBuilds{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBuild) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/build/clientset/internalclientset/typed/build/internalversion/generated_expansion.go b/pkg/build/clientset/internalclientset/typed/build/internalversion/generated_expansion.go new file mode 100644 index 000000000000..202ecadc54ca --- /dev/null +++ b/pkg/build/clientset/internalclientset/typed/build/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type BuildResourceExpansion interface{} diff --git a/pkg/build/clientset/release_v3_6/clientset.go b/pkg/build/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..e655bbfad6cf --- /dev/null +++ b/pkg/build/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1build "github.com/openshift/origin/pkg/build/clientset/release_v3_6/typed/build/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + BuildV1() v1build.BuildV1Interface + // Deprecated: please explicitly pick a version if possible. + Build() v1build.BuildV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1build.BuildV1Client +} + +// BuildV1 retrieves the BuildV1Client +func (c *Clientset) BuildV1() v1build.BuildV1Interface { + if c == nil { + return nil + } + return c.BuildV1Client +} + +// Deprecated: Build retrieves the default version of BuildClient. +// Please explicitly pick a version. +func (c *Clientset) Build() v1build.BuildV1Interface { + if c == nil { + return nil + } + return c.BuildV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.BuildV1Client, err = v1build.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.BuildV1Client = v1build.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.BuildV1Client = v1build.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/build/clientset/release_v3_6/doc.go b/pkg/build/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..4d32d9092a87 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/v1] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/build/clientset/release_v3_6/fake/clientset_generated.go b/pkg/build/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..b781bb6a654a --- /dev/null +++ b/pkg/build/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/build/clientset/release_v3_6" + v1build "github.com/openshift/origin/pkg/build/clientset/release_v3_6/typed/build/v1" + fakev1build "github.com/openshift/origin/pkg/build/clientset/release_v3_6/typed/build/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// BuildV1 retrieves the BuildV1Client +func (c *Clientset) BuildV1() v1build.BuildV1Interface { + return &fakev1build.FakeBuildV1{Fake: &c.Fake} +} + +// Build retrieves the BuildV1Client +func (c *Clientset) Build() v1build.BuildV1Interface { + return &fakev1build.FakeBuildV1{Fake: &c.Fake} +} diff --git a/pkg/build/clientset/release_v3_6/fake/doc.go b/pkg/build/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..2112c96c5098 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/v1] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/build.go b/pkg/build/clientset/release_v3_6/typed/build/v1/build.go new file mode 100644 index 000000000000..fbf3ff8d96d9 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/build.go @@ -0,0 +1,151 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/build/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// BuildsGetter has a method to return a BuildResourceInterface. +// A group's client should implement this interface. +type BuildsGetter interface { + Builds(namespace string) BuildResourceInterface +} + +// BuildResourceInterface has methods to work with BuildResource resources. +type BuildResourceInterface interface { + Create(*v1.Build) (*v1.Build, error) + Update(*v1.Build) (*v1.Build, error) + UpdateStatus(*v1.Build) (*v1.Build, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.Build, error) + List(opts api_v1.ListOptions) (*v1.BuildList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Build, err error) + BuildResourceExpansion +} + +// builds implements BuildResourceInterface +type builds struct { + client restclient.Interface + ns string +} + +// newBuilds returns a Builds +func newBuilds(c *BuildV1Client, namespace string) *builds { + return &builds{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a build and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Create(build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Post(). + Namespace(c.ns). + Resource("builds"). + Body(build). + Do(). + Into(result) + return +} + +// Update takes the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Update(build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Put(). + Namespace(c.ns). + Resource("builds"). + Name(build.Name). + Body(build). + Do(). + Into(result) + return +} + +func (c *builds) UpdateStatus(build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Put(). + Namespace(c.ns). + Resource("builds"). + Name(build.Name). + SubResource("status"). + Body(build). + Do(). + Into(result) + return +} + +// Delete takes name of the build and deletes it. Returns an error if one occurs. +func (c *builds) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("builds"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *builds) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the build, and returns the corresponding build object, and an error if there is any. +func (c *builds) Get(name string) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Get(). + Namespace(c.ns). + Resource("builds"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Builds that match those selectors. +func (c *builds) List(opts api_v1.ListOptions) (result *v1.BuildList, err error) { + result = &v1.BuildList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested builds. +func (c *builds) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched build. +func (c *builds) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("builds"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/build_client.go b/pkg/build/clientset/release_v3_6/typed/build/v1/build_client.go new file mode 100644 index 000000000000..754813835625 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/build_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type BuildV1Interface interface { + RESTClient() restclient.Interface + BuildsGetter +} + +// BuildV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type BuildV1Client struct { + restClient restclient.Interface +} + +func (c *BuildV1Client) Builds(namespace string) BuildResourceInterface { + return newBuilds(c, namespace) +} + +// NewForConfig creates a new BuildV1Client for the given config. +func NewForConfig(c *restclient.Config) (*BuildV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &BuildV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BuildV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *BuildV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BuildV1Client for the given RESTClient. +func New(c restclient.Interface) *BuildV1Client { + return &BuildV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("build.openshift.io/v1") + if err != nil { + return err + } + // if build.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("build.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BuildV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/doc.go b/pkg/build/clientset/release_v3_6/typed/build/v1/doc.go new file mode 100644 index 000000000000..6b4094461b34 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/v1] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/fake/doc.go b/pkg/build/clientset/release_v3_6/typed/build/v1/fake/doc.go new file mode 100644 index 000000000000..b1e3a014b768 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/build/clientset --go-header-file=hack/boilerplate.txt --group=build --input=[api/v1] --input-base=github.com/openshift/origin/pkg/build --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/fake/fake_build.go b/pkg/build/clientset/release_v3_6/typed/build/v1/fake/fake_build.go new file mode 100644 index 000000000000..e559d8388153 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/fake/fake_build.go @@ -0,0 +1,112 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/build/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeBuilds implements BuildResourceInterface +type FakeBuilds struct { + Fake *FakeBuildV1 + ns string +} + +var buildsResource = unversioned.GroupVersionResource{Group: "build.openshift.io", Version: "v1", Resource: "builds"} + +func (c *FakeBuilds) Create(build *v1.Build) (result *v1.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(buildsResource, c.ns, build), &v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Build), err +} + +func (c *FakeBuilds) Update(build *v1.Build) (result *v1.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(buildsResource, c.ns, build), &v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Build), err +} + +func (c *FakeBuilds) UpdateStatus(build *v1.Build) (*v1.Build, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction(buildsResource, "status", c.ns, build), &v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Build), err +} + +func (c *FakeBuilds) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(buildsResource, c.ns, name), &v1.Build{}) + + return err +} + +func (c *FakeBuilds) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(buildsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.BuildList{}) + return err +} + +func (c *FakeBuilds) Get(name string) (result *v1.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(buildsResource, c.ns, name), &v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Build), err +} + +func (c *FakeBuilds) List(opts api_v1.ListOptions) (result *v1.BuildList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(buildsResource, c.ns, opts), &v1.BuildList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.BuildList{} + for _, item := range obj.(*v1.BuildList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested builds. +func (c *FakeBuilds) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(buildsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched build. +func (c *FakeBuilds) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Build, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(buildsResource, c.ns, name, data, subresources...), &v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Build), err +} diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/fake/fake_build_client.go b/pkg/build/clientset/release_v3_6/typed/build/v1/fake/fake_build_client.go new file mode 100644 index 000000000000..9a95daaac687 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/fake/fake_build_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/build/clientset/release_v3_6/typed/build/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeBuildV1 struct { + *core.Fake +} + +func (c *FakeBuildV1) Builds(namespace string) v1.BuildResourceInterface { + return &FakeBuilds{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBuildV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/build/clientset/release_v3_6/typed/build/v1/generated_expansion.go b/pkg/build/clientset/release_v3_6/typed/build/v1/generated_expansion.go new file mode 100644 index 000000000000..b9615f2f4287 --- /dev/null +++ b/pkg/build/clientset/release_v3_6/typed/build/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type BuildResourceExpansion interface{} diff --git a/pkg/client/cache/index.go b/pkg/client/cache/index.go index a4f7e9776257..00d8ed0afd76 100644 --- a/pkg/client/cache/index.go +++ b/pkg/client/cache/index.go @@ -7,10 +7,12 @@ import ( buildutil "github.com/openshift/origin/pkg/build/util" deployapi "github.com/openshift/origin/pkg/deploy/api" imageapi "github.com/openshift/origin/pkg/image/api" + templateapi "github.com/openshift/origin/pkg/template/api" ) const ( - ImageStreamReferenceIndex string = "imagestreamref" + ImageStreamReferenceIndex = "imagestreamref" + TemplateUIDIndex = "templateuid" ) // ImageStreamReferenceIndexFunc is a default index function that indexes based on image stream references. @@ -73,3 +75,7 @@ func ImageStreamReferenceIndexFunc(obj interface{}) ([]string, error) { } return nil, fmt.Errorf("image stream reference index not implemented for %#v", obj) } + +func TemplateUIDIndexFunc(obj interface{}) ([]string, error) { + return []string{string(obj.(*templateapi.Template).UID)}, nil +} diff --git a/pkg/client/cache/template.go b/pkg/client/cache/template.go new file mode 100644 index 000000000000..5aa1c19eb015 --- /dev/null +++ b/pkg/client/cache/template.go @@ -0,0 +1,33 @@ +package cache + +import ( + templateapi "github.com/openshift/origin/pkg/template/api" + "k8s.io/kubernetes/pkg/client/cache" +) + +type StoreToTemplateLister interface { + List() ([]*templateapi.Template, error) + GetTemplateByUID(uid string) (*templateapi.Template, error) +} + +type StoreToTemplateListerImpl struct { + cache.Indexer +} + +func (s *StoreToTemplateListerImpl) List() ([]*templateapi.Template, error) { + list := s.Indexer.List() + + templates := make([]*templateapi.Template, len(list)) + for i, template := range list { + templates[i] = template.(*templateapi.Template) + } + return templates, nil +} + +func (s *StoreToTemplateListerImpl) GetTemplateByUID(uid string) (*templateapi.Template, error) { + templates, err := s.Indexer.ByIndex(TemplateUIDIndex, uid) + if err != nil || len(templates) == 0 { + return nil, err + } + return templates[0].(*templateapi.Template), nil +} diff --git a/pkg/client/listers/core/internalversion/brokertemplateinstance.go b/pkg/client/listers/core/internalversion/brokertemplateinstance.go new file mode 100644 index 000000000000..8c934bc7d0ef --- /dev/null +++ b/pkg/client/listers/core/internalversion/brokertemplateinstance.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true + +package internalversion + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" +) + +// BrokerTemplateInstanceLister helps list BrokerTemplateInstances. +type BrokerTemplateInstanceLister interface { + // List lists all BrokerTemplateInstances in the indexer. + List(selector labels.Selector) (ret []*api.BrokerTemplateInstance, err error) + // Get retrieves the BrokerTemplateInstance from the index for a given name. + Get(name string) (*api.BrokerTemplateInstance, error) + BrokerTemplateInstanceListerExpansion +} + +// brokerTemplateInstanceLister implements the BrokerTemplateInstanceLister interface. +type brokerTemplateInstanceLister struct { + indexer cache.Indexer +} + +// NewBrokerTemplateInstanceLister returns a new BrokerTemplateInstanceLister. +func NewBrokerTemplateInstanceLister(indexer cache.Indexer) BrokerTemplateInstanceLister { + return &brokerTemplateInstanceLister{indexer: indexer} +} + +// List lists all BrokerTemplateInstances in the indexer. +func (s *brokerTemplateInstanceLister) List(selector labels.Selector) (ret []*api.BrokerTemplateInstance, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*api.BrokerTemplateInstance)) + }) + return ret, err +} + +// Get retrieves the BrokerTemplateInstance from the index for a given name. +func (s *brokerTemplateInstanceLister) Get(name string) (*api.BrokerTemplateInstance, error) { + key := &api.BrokerTemplateInstance{ObjectMeta: pkg_api.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(api.Resource("brokertemplateinstance"), name) + } + return obj.(*api.BrokerTemplateInstance), nil +} diff --git a/pkg/client/listers/core/internalversion/build.go b/pkg/client/listers/core/internalversion/build.go index 60e7360cb272..b4d61df1371e 100644 --- a/pkg/client/listers/core/internalversion/build.go +++ b/pkg/client/listers/core/internalversion/build.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/clusternetwork.go b/pkg/client/listers/core/internalversion/clusternetwork.go index 30bd2b05cb52..8b15fd3899ce 100644 --- a/pkg/client/listers/core/internalversion/clusternetwork.go +++ b/pkg/client/listers/core/internalversion/clusternetwork.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/clusterresourcequota.go b/pkg/client/listers/core/internalversion/clusterresourcequota.go new file mode 100644 index 000000000000..90598329358c --- /dev/null +++ b/pkg/client/listers/core/internalversion/clusterresourcequota.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true + +package internalversion + +import ( + api "github.com/openshift/origin/pkg/quota/api" + pkg_api "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" +) + +// ClusterResourceQuotaLister helps list ClusterResourceQuotas. +type ClusterResourceQuotaLister interface { + // List lists all ClusterResourceQuotas in the indexer. + List(selector labels.Selector) (ret []*api.ClusterResourceQuota, err error) + // Get retrieves the ClusterResourceQuota from the index for a given name. + Get(name string) (*api.ClusterResourceQuota, error) + ClusterResourceQuotaListerExpansion +} + +// clusterResourceQuotaLister implements the ClusterResourceQuotaLister interface. +type clusterResourceQuotaLister struct { + indexer cache.Indexer +} + +// NewClusterResourceQuotaLister returns a new ClusterResourceQuotaLister. +func NewClusterResourceQuotaLister(indexer cache.Indexer) ClusterResourceQuotaLister { + return &clusterResourceQuotaLister{indexer: indexer} +} + +// List lists all ClusterResourceQuotas in the indexer. +func (s *clusterResourceQuotaLister) List(selector labels.Selector) (ret []*api.ClusterResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*api.ClusterResourceQuota)) + }) + return ret, err +} + +// Get retrieves the ClusterResourceQuota from the index for a given name. +func (s *clusterResourceQuotaLister) Get(name string) (*api.ClusterResourceQuota, error) { + key := &api.ClusterResourceQuota{ObjectMeta: pkg_api.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(api.Resource("clusterresourcequota"), name) + } + return obj.(*api.ClusterResourceQuota), nil +} diff --git a/pkg/client/listers/core/internalversion/deploymentconfig.go b/pkg/client/listers/core/internalversion/deploymentconfig.go index f16f8dae0231..c45372764176 100644 --- a/pkg/client/listers/core/internalversion/deploymentconfig.go +++ b/pkg/client/listers/core/internalversion/deploymentconfig.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/expansion_generated.go b/pkg/client/listers/core/internalversion/expansion_generated.go index 495ad6e4ba72..29dc1eb8f426 100644 --- a/pkg/client/listers/core/internalversion/expansion_generated.go +++ b/pkg/client/listers/core/internalversion/expansion_generated.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/image.go b/pkg/client/listers/core/internalversion/image.go index 5d647e32312a..63cccf327238 100644 --- a/pkg/client/listers/core/internalversion/image.go +++ b/pkg/client/listers/core/internalversion/image.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/oauthclient.go b/pkg/client/listers/core/internalversion/oauthclient.go index 0bed3e5b29cb..e366b241f3f6 100644 --- a/pkg/client/listers/core/internalversion/oauthclient.go +++ b/pkg/client/listers/core/internalversion/oauthclient.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/policy.go b/pkg/client/listers/core/internalversion/policy.go index ea1f301be94f..925571e7c7cf 100644 --- a/pkg/client/listers/core/internalversion/policy.go +++ b/pkg/client/listers/core/internalversion/policy.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/project.go b/pkg/client/listers/core/internalversion/project.go index 416c05130ae1..8dac0a107b11 100644 --- a/pkg/client/listers/core/internalversion/project.go +++ b/pkg/client/listers/core/internalversion/project.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/route.go b/pkg/client/listers/core/internalversion/route.go index 64c9f1289707..8d0f872c5280 100644 --- a/pkg/client/listers/core/internalversion/route.go +++ b/pkg/client/listers/core/internalversion/route.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/template.go b/pkg/client/listers/core/internalversion/template.go index e46fb7c6d3fa..b640923f7dc3 100644 --- a/pkg/client/listers/core/internalversion/template.go +++ b/pkg/client/listers/core/internalversion/template.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/internalversion/templateinstance.go b/pkg/client/listers/core/internalversion/templateinstance.go new file mode 100644 index 000000000000..0e05a80eec92 --- /dev/null +++ b/pkg/client/listers/core/internalversion/templateinstance.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true + +package internalversion + +import ( + api "github.com/openshift/origin/pkg/template/api" + "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" +) + +// TemplateInstanceLister helps list TemplateInstances. +type TemplateInstanceLister interface { + // List lists all TemplateInstances in the indexer. + List(selector labels.Selector) (ret []*api.TemplateInstance, err error) + // TemplateInstances returns an object that can list and get TemplateInstances. + TemplateInstances(namespace string) TemplateInstanceNamespaceLister + TemplateInstanceListerExpansion +} + +// templateInstanceLister implements the TemplateInstanceLister interface. +type templateInstanceLister struct { + indexer cache.Indexer +} + +// NewTemplateInstanceLister returns a new TemplateInstanceLister. +func NewTemplateInstanceLister(indexer cache.Indexer) TemplateInstanceLister { + return &templateInstanceLister{indexer: indexer} +} + +// List lists all TemplateInstances in the indexer. +func (s *templateInstanceLister) List(selector labels.Selector) (ret []*api.TemplateInstance, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*api.TemplateInstance)) + }) + return ret, err +} + +// TemplateInstances returns an object that can list and get TemplateInstances. +func (s *templateInstanceLister) TemplateInstances(namespace string) TemplateInstanceNamespaceLister { + return templateInstanceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TemplateInstanceNamespaceLister helps list and get TemplateInstances. +type TemplateInstanceNamespaceLister interface { + // List lists all TemplateInstances in the indexer for a given namespace. + List(selector labels.Selector) (ret []*api.TemplateInstance, err error) + // Get retrieves the TemplateInstance from the indexer for a given namespace and name. + Get(name string) (*api.TemplateInstance, error) + TemplateInstanceNamespaceListerExpansion +} + +// templateInstanceNamespaceLister implements the TemplateInstanceNamespaceLister +// interface. +type templateInstanceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TemplateInstances in the indexer for a given namespace. +func (s templateInstanceNamespaceLister) List(selector labels.Selector) (ret []*api.TemplateInstance, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*api.TemplateInstance)) + }) + return ret, err +} + +// Get retrieves the TemplateInstance from the indexer for a given namespace and name. +func (s templateInstanceNamespaceLister) Get(name string) (*api.TemplateInstance, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(api.Resource("templateinstance"), name) + } + return obj.(*api.TemplateInstance), nil +} diff --git a/pkg/client/listers/core/internalversion/user.go b/pkg/client/listers/core/internalversion/user.go index 35b8f7bc1ecf..7842cc8408b4 100644 --- a/pkg/client/listers/core/internalversion/user.go +++ b/pkg/client/listers/core/internalversion/user.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package internalversion diff --git a/pkg/client/listers/core/v1/brokertemplateinstance.go b/pkg/client/listers/core/v1/brokertemplateinstance.go new file mode 100644 index 000000000000..6e609c10ef1d --- /dev/null +++ b/pkg/client/listers/core/v1/brokertemplateinstance.go @@ -0,0 +1,52 @@ +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true + +package v1 + +import ( + api "github.com/openshift/origin/pkg/template/api" + v1 "github.com/openshift/origin/pkg/template/api/v1" + "k8s.io/kubernetes/pkg/api/errors" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" +) + +// BrokerTemplateInstanceLister helps list BrokerTemplateInstances. +type BrokerTemplateInstanceLister interface { + // List lists all BrokerTemplateInstances in the indexer. + List(selector labels.Selector) (ret []*v1.BrokerTemplateInstance, err error) + // Get retrieves the BrokerTemplateInstance from the index for a given name. + Get(name string) (*v1.BrokerTemplateInstance, error) + BrokerTemplateInstanceListerExpansion +} + +// brokerTemplateInstanceLister implements the BrokerTemplateInstanceLister interface. +type brokerTemplateInstanceLister struct { + indexer cache.Indexer +} + +// NewBrokerTemplateInstanceLister returns a new BrokerTemplateInstanceLister. +func NewBrokerTemplateInstanceLister(indexer cache.Indexer) BrokerTemplateInstanceLister { + return &brokerTemplateInstanceLister{indexer: indexer} +} + +// List lists all BrokerTemplateInstances in the indexer. +func (s *brokerTemplateInstanceLister) List(selector labels.Selector) (ret []*v1.BrokerTemplateInstance, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BrokerTemplateInstance)) + }) + return ret, err +} + +// Get retrieves the BrokerTemplateInstance from the index for a given name. +func (s *brokerTemplateInstanceLister) Get(name string) (*v1.BrokerTemplateInstance, error) { + key := &v1.BrokerTemplateInstance{ObjectMeta: api_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(api.Resource("brokertemplateinstance"), name) + } + return obj.(*v1.BrokerTemplateInstance), nil +} diff --git a/pkg/client/listers/core/v1/build.go b/pkg/client/listers/core/v1/build.go index 4406a9a13176..9e48cc0f5dba 100644 --- a/pkg/client/listers/core/v1/build.go +++ b/pkg/client/listers/core/v1/build.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/clusternetwork.go b/pkg/client/listers/core/v1/clusternetwork.go index bfacfe3f4452..425653f06c7f 100644 --- a/pkg/client/listers/core/v1/clusternetwork.go +++ b/pkg/client/listers/core/v1/clusternetwork.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/clusterresourcequota.go b/pkg/client/listers/core/v1/clusterresourcequota.go new file mode 100644 index 000000000000..78c70c07af6b --- /dev/null +++ b/pkg/client/listers/core/v1/clusterresourcequota.go @@ -0,0 +1,52 @@ +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true + +package v1 + +import ( + api "github.com/openshift/origin/pkg/quota/api" + v1 "github.com/openshift/origin/pkg/quota/api/v1" + "k8s.io/kubernetes/pkg/api/errors" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" +) + +// ClusterResourceQuotaLister helps list ClusterResourceQuotas. +type ClusterResourceQuotaLister interface { + // List lists all ClusterResourceQuotas in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterResourceQuota, err error) + // Get retrieves the ClusterResourceQuota from the index for a given name. + Get(name string) (*v1.ClusterResourceQuota, error) + ClusterResourceQuotaListerExpansion +} + +// clusterResourceQuotaLister implements the ClusterResourceQuotaLister interface. +type clusterResourceQuotaLister struct { + indexer cache.Indexer +} + +// NewClusterResourceQuotaLister returns a new ClusterResourceQuotaLister. +func NewClusterResourceQuotaLister(indexer cache.Indexer) ClusterResourceQuotaLister { + return &clusterResourceQuotaLister{indexer: indexer} +} + +// List lists all ClusterResourceQuotas in the indexer. +func (s *clusterResourceQuotaLister) List(selector labels.Selector) (ret []*v1.ClusterResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterResourceQuota)) + }) + return ret, err +} + +// Get retrieves the ClusterResourceQuota from the index for a given name. +func (s *clusterResourceQuotaLister) Get(name string) (*v1.ClusterResourceQuota, error) { + key := &v1.ClusterResourceQuota{ObjectMeta: api_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(api.Resource("clusterresourcequota"), name) + } + return obj.(*v1.ClusterResourceQuota), nil +} diff --git a/pkg/client/listers/core/v1/deploymentconfig.go b/pkg/client/listers/core/v1/deploymentconfig.go index 4c5f525955f5..155932b8d7e3 100644 --- a/pkg/client/listers/core/v1/deploymentconfig.go +++ b/pkg/client/listers/core/v1/deploymentconfig.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/expansion_generated.go b/pkg/client/listers/core/v1/expansion_generated.go index c212fbbb4f66..d13e22d795a5 100644 --- a/pkg/client/listers/core/v1/expansion_generated.go +++ b/pkg/client/listers/core/v1/expansion_generated.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/image.go b/pkg/client/listers/core/v1/image.go index 37b071ad8c74..9c34231b4f63 100644 --- a/pkg/client/listers/core/v1/image.go +++ b/pkg/client/listers/core/v1/image.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/oauthclient.go b/pkg/client/listers/core/v1/oauthclient.go index 3a3acedf7890..39aa4507c276 100644 --- a/pkg/client/listers/core/v1/oauthclient.go +++ b/pkg/client/listers/core/v1/oauthclient.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/policy.go b/pkg/client/listers/core/v1/policy.go index f9a5f6c5d450..b4140ed3c1f3 100644 --- a/pkg/client/listers/core/v1/policy.go +++ b/pkg/client/listers/core/v1/policy.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/project.go b/pkg/client/listers/core/v1/project.go index 9470e9a0403d..f6dcee2b968e 100644 --- a/pkg/client/listers/core/v1/project.go +++ b/pkg/client/listers/core/v1/project.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/route.go b/pkg/client/listers/core/v1/route.go index 1e360487bc29..7251c07438e5 100644 --- a/pkg/client/listers/core/v1/route.go +++ b/pkg/client/listers/core/v1/route.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/template.go b/pkg/client/listers/core/v1/template.go index 3829f1a7a049..3b2f84f8afc2 100644 --- a/pkg/client/listers/core/v1/template.go +++ b/pkg/client/listers/core/v1/template.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/client/listers/core/v1/templateinstance.go b/pkg/client/listers/core/v1/templateinstance.go new file mode 100644 index 000000000000..bf9e224da19d --- /dev/null +++ b/pkg/client/listers/core/v1/templateinstance.go @@ -0,0 +1,79 @@ +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true + +package v1 + +import ( + api "github.com/openshift/origin/pkg/template/api" + v1 "github.com/openshift/origin/pkg/template/api/v1" + "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/labels" +) + +// TemplateInstanceLister helps list TemplateInstances. +type TemplateInstanceLister interface { + // List lists all TemplateInstances in the indexer. + List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) + // TemplateInstances returns an object that can list and get TemplateInstances. + TemplateInstances(namespace string) TemplateInstanceNamespaceLister + TemplateInstanceListerExpansion +} + +// templateInstanceLister implements the TemplateInstanceLister interface. +type templateInstanceLister struct { + indexer cache.Indexer +} + +// NewTemplateInstanceLister returns a new TemplateInstanceLister. +func NewTemplateInstanceLister(indexer cache.Indexer) TemplateInstanceLister { + return &templateInstanceLister{indexer: indexer} +} + +// List lists all TemplateInstances in the indexer. +func (s *templateInstanceLister) List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.TemplateInstance)) + }) + return ret, err +} + +// TemplateInstances returns an object that can list and get TemplateInstances. +func (s *templateInstanceLister) TemplateInstances(namespace string) TemplateInstanceNamespaceLister { + return templateInstanceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TemplateInstanceNamespaceLister helps list and get TemplateInstances. +type TemplateInstanceNamespaceLister interface { + // List lists all TemplateInstances in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) + // Get retrieves the TemplateInstance from the indexer for a given namespace and name. + Get(name string) (*v1.TemplateInstance, error) + TemplateInstanceNamespaceListerExpansion +} + +// templateInstanceNamespaceLister implements the TemplateInstanceNamespaceLister +// interface. +type templateInstanceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TemplateInstances in the indexer for a given namespace. +func (s templateInstanceNamespaceLister) List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.TemplateInstance)) + }) + return ret, err +} + +// Get retrieves the TemplateInstance from the indexer for a given namespace and name. +func (s templateInstanceNamespaceLister) Get(name string) (*v1.TemplateInstance, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(api.Resource("templateinstance"), name) + } + return obj.(*v1.TemplateInstance), nil +} diff --git a/pkg/client/listers/core/v1/user.go b/pkg/client/listers/core/v1/user.go index 176fce20b283..8e65c607fb17 100644 --- a/pkg/client/listers/core/v1/user.go +++ b/pkg/client/listers/core/v1/user.go @@ -1,4 +1,4 @@ -// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true +// This file was automatically generated by lister-gen with arguments: --input-dirs=[github.com/openshift/origin/pkg/authorization/api,github.com/openshift/origin/pkg/authorization/api/v1,github.com/openshift/origin/pkg/build/api,github.com/openshift/origin/pkg/build/api/v1,github.com/openshift/origin/pkg/deploy/api,github.com/openshift/origin/pkg/deploy/api/v1,github.com/openshift/origin/pkg/image/api,github.com/openshift/origin/pkg/image/api/v1,github.com/openshift/origin/pkg/oauth/api,github.com/openshift/origin/pkg/oauth/api/v1,github.com/openshift/origin/pkg/project/api,github.com/openshift/origin/pkg/project/api/v1,github.com/openshift/origin/pkg/quota/api,github.com/openshift/origin/pkg/quota/api/v1,github.com/openshift/origin/pkg/route/api,github.com/openshift/origin/pkg/route/api/v1,github.com/openshift/origin/pkg/sdn/api,github.com/openshift/origin/pkg/sdn/api/v1,github.com/openshift/origin/pkg/template/api,github.com/openshift/origin/pkg/template/api/v1,github.com/openshift/origin/pkg/user/api,github.com/openshift/origin/pkg/user/api/v1] --logtostderr=true package v1 diff --git a/pkg/cmd/cli/describe/describer_test.go b/pkg/cmd/cli/describe/describer_test.go index 55b4c5b14430..590d2557e446 100644 --- a/pkg/cmd/cli/describe/describer_test.go +++ b/pkg/cmd/cli/describe/describer_test.go @@ -23,6 +23,7 @@ import ( oauthapi "github.com/openshift/origin/pkg/oauth/api" projectapi "github.com/openshift/origin/pkg/project/api" securityapi "github.com/openshift/origin/pkg/security/api" + templateapi "github.com/openshift/origin/pkg/template/api" // install all APIs _ "github.com/openshift/origin/pkg/api/install" @@ -57,6 +58,8 @@ var DescriberCoverageExceptions = []reflect.Type{ reflect.TypeOf(&oauthapi.OAuthAuthorizeToken{}), // normal users don't ever look at these reflect.TypeOf(&oauthapi.OAuthClientAuthorization{}), // normal users don't ever look at these reflect.TypeOf(&projectapi.ProjectRequest{}), // normal users don't ever look at these + reflect.TypeOf(&templateapi.TemplateInstance{}), // normal users don't ever look at these + reflect.TypeOf(&templateapi.BrokerTemplateInstance{}), // normal users don't ever look at these reflect.TypeOf(&authorizationapi.IsPersonalSubjectAccessReview{}), // not a top level resource // ATM image signature doesn't provide any human readable information reflect.TypeOf(&imageapi.ImageSignature{}), diff --git a/pkg/cmd/cli/describe/printer.go b/pkg/cmd/cli/describe/printer.go index 3f64b4487ea7..4b498dc9d2ad 100644 --- a/pkg/cmd/cli/describe/printer.go +++ b/pkg/cmd/cli/describe/printer.go @@ -65,6 +65,9 @@ var ( clusterResourceQuotaColumns = []string{"NAME", "LABEL SELECTOR", "ANNOTATION SELECTOR"} roleBindingRestrictionColumns = []string{"NAME", "SUBJECT TYPE", "SUBJECTS"} + + templateInstanceColumns = []string{"NAME", "TEMPLATE"} + brokerTemplateInstanceColumns = []string{"NAME", "TEMPLATEINSTANCE"} ) // NewHumanReadablePrinter returns a new HumanReadablePrinter @@ -145,6 +148,11 @@ func NewHumanReadablePrinter(printOptions kctl.PrintOptions) *kctl.HumanReadable p.Handler(roleBindingRestrictionColumns, printRoleBindingRestriction) p.Handler(roleBindingRestrictionColumns, printRoleBindingRestrictionList) + p.Handler(templateInstanceColumns, printTemplateInstance) + p.Handler(templateInstanceColumns, printTemplateInstanceList) + p.Handler(brokerTemplateInstanceColumns, printBrokerTemplateInstance) + p.Handler(brokerTemplateInstanceColumns, printBrokerTemplateInstanceList) + return p } @@ -1137,3 +1145,50 @@ func printRoleBindingRestrictionList(list *authorizationapi.RoleBindingRestricti } return nil } + +func printTemplateInstance(templateInstance *templateapi.TemplateInstance, w io.Writer, opts kctl.PrintOptions) error { + name := formatResourceName(opts.Kind, templateInstance.Name, opts.WithKind) + + if opts.WithNamespace { + if _, err := fmt.Fprintf(w, "%s\t", templateInstance.Namespace); err != nil { + return err + } + } + if _, err := fmt.Fprintf(w, "%s\t%s", name, templateInstance.Spec.Template.Name); err != nil { + return err + } + if err := appendItemLabels(templateInstance.Labels, w, opts.ColumnLabels, opts.ShowLabels); err != nil { + return err + } + return nil +} + +func printTemplateInstanceList(list *templateapi.TemplateInstanceList, w io.Writer, opts kctl.PrintOptions) error { + for i := range list.Items { + if err := printTemplateInstance(&list.Items[i], w, opts); err != nil { + return err + } + } + return nil +} + +func printBrokerTemplateInstance(brokerTemplateInstance *templateapi.BrokerTemplateInstance, w io.Writer, opts kctl.PrintOptions) error { + name := formatResourceName(opts.Kind, brokerTemplateInstance.Name, opts.WithKind) + + if _, err := fmt.Fprintf(w, "%s\t%s/%s", name, brokerTemplateInstance.Spec.TemplateInstance.Namespace, brokerTemplateInstance.Spec.TemplateInstance.Name); err != nil { + return err + } + if err := appendItemLabels(brokerTemplateInstance.Labels, w, opts.ColumnLabels, opts.ShowLabels); err != nil { + return err + } + return nil +} + +func printBrokerTemplateInstanceList(list *templateapi.BrokerTemplateInstanceList, w io.Writer, opts kctl.PrintOptions) error { + for i := range list.Items { + if err := printBrokerTemplateInstance(&list.Items[i], w, opts); err != nil { + return err + } + } + return nil +} diff --git a/pkg/cmd/server/api/types.go b/pkg/cmd/server/api/types.go index a5b825c8e32d..973dcc93db62 100644 --- a/pkg/cmd/server/api/types.go +++ b/pkg/cmd/server/api/types.go @@ -381,6 +381,9 @@ type MasterConfig struct { // AuditConfig holds information related to auditing capabilities. AuditConfig AuditConfig + + // EnableTemplateServiceBroker is a temporary switch which enables TemplateServiceBroker. + EnableTemplateServiceBroker bool } // MasterAuthConfig configures authentication options in addition to the standard diff --git a/pkg/cmd/server/api/v1/swagger_doc.go b/pkg/cmd/server/api/v1/swagger_doc.go index 5924edae20c7..08f44943781d 100644 --- a/pkg/cmd/server/api/v1/swagger_doc.go +++ b/pkg/cmd/server/api/v1/swagger_doc.go @@ -453,37 +453,38 @@ func (MasterClients) SwaggerDoc() map[string]string { } var map_MasterConfig = map[string]string{ - "": "MasterConfig holds the necessary configuration options for the OpenShift master", - "servingInfo": "ServingInfo describes how to start serving", - "authConfig": "AuthConfig configures authentication options in addition to the standard oauth token and client certificate authenticators", - "corsAllowedOrigins": "CORSAllowedOrigins", - "apiLevels": "APILevels is a list of API levels that should be enabled on startup: v1 as examples", - "masterPublicURL": "MasterPublicURL is how clients can access the OpenShift API server", - "controllers": "Controllers is a list of the controllers that should be started. If set to \"none\", no controllers will start automatically. The default value is \"*\" which will start all controllers. When using \"*\", you may exclude controllers by prepending a \"-\" in front of their name. No other values are recognized at this time.", - "pauseControllers": "PauseControllers instructs the master to not automatically start controllers, but instead to wait until a notification to the server is received before launching them.", - "controllerLeaseTTL": "ControllerLeaseTTL enables controller election, instructing the master to attempt to acquire a lease before controllers start and renewing it within a number of seconds defined by this value. Setting this value non-negative forces pauseControllers=true. This value defaults off (0, or omitted) and controller election can be disabled with -1.", - "admissionConfig": "AdmissionConfig contains admission control plugin configuration.", - "controllerConfig": "ControllerConfig holds configuration values for controllers", - "disabledFeatures": "DisabledFeatures is a list of features that should not be started. We omitempty here because its very unlikely that anyone will want to manually disable features and we don't want to encourage it.", - "etcdStorageConfig": "EtcdStorageConfig contains information about how API resources are stored in Etcd. These values are only relevant when etcd is the backing store for the cluster.", - "etcdClientInfo": "EtcdClientInfo contains information about how to connect to etcd", - "kubeletClientInfo": "KubeletClientInfo contains information about how to connect to kubelets", - "kubernetesMasterConfig": "KubernetesMasterConfig, if present start the kubernetes master in this process", - "etcdConfig": "EtcdConfig, if present start etcd in this process", - "oauthConfig": "OAuthConfig, if present start the /oauth endpoint in this process", - "assetConfig": "AssetConfig, if present start the asset server in this process", - "dnsConfig": "DNSConfig, if present start the DNS server in this process", - "serviceAccountConfig": "ServiceAccountConfig holds options related to service accounts", - "masterClients": "MasterClients holds all the client connection information for controllers and other system components", - "imageConfig": "ImageConfig holds options that describe how to build image names for system components", - "imagePolicyConfig": "ImagePolicyConfig controls limits and behavior for importing images", - "policyConfig": "PolicyConfig holds information about where to locate critical pieces of bootstrapping policy", - "projectConfig": "ProjectConfig holds information about project creation and defaults", - "routingConfig": "RoutingConfig holds information about routing and route generation", - "networkConfig": "NetworkConfig to be passed to the compiled in network plugin", - "volumeConfig": "MasterVolumeConfig contains options for configuring volume plugins in the master node.", - "jenkinsPipelineConfig": "JenkinsPipelineConfig holds information about the default Jenkins template used for JenkinsPipeline build strategy.", - "auditConfig": "AuditConfig holds information related to auditing capabilities.", + "": "MasterConfig holds the necessary configuration options for the OpenShift master", + "servingInfo": "ServingInfo describes how to start serving", + "authConfig": "AuthConfig configures authentication options in addition to the standard oauth token and client certificate authenticators", + "corsAllowedOrigins": "CORSAllowedOrigins", + "apiLevels": "APILevels is a list of API levels that should be enabled on startup: v1 as examples", + "masterPublicURL": "MasterPublicURL is how clients can access the OpenShift API server", + "controllers": "Controllers is a list of the controllers that should be started. If set to \"none\", no controllers will start automatically. The default value is \"*\" which will start all controllers. When using \"*\", you may exclude controllers by prepending a \"-\" in front of their name. No other values are recognized at this time.", + "pauseControllers": "PauseControllers instructs the master to not automatically start controllers, but instead to wait until a notification to the server is received before launching them.", + "controllerLeaseTTL": "ControllerLeaseTTL enables controller election, instructing the master to attempt to acquire a lease before controllers start and renewing it within a number of seconds defined by this value. Setting this value non-negative forces pauseControllers=true. This value defaults off (0, or omitted) and controller election can be disabled with -1.", + "admissionConfig": "AdmissionConfig contains admission control plugin configuration.", + "controllerConfig": "ControllerConfig holds configuration values for controllers", + "disabledFeatures": "DisabledFeatures is a list of features that should not be started. We omitempty here because its very unlikely that anyone will want to manually disable features and we don't want to encourage it.", + "etcdStorageConfig": "EtcdStorageConfig contains information about how API resources are stored in Etcd. These values are only relevant when etcd is the backing store for the cluster.", + "etcdClientInfo": "EtcdClientInfo contains information about how to connect to etcd", + "kubeletClientInfo": "KubeletClientInfo contains information about how to connect to kubelets", + "kubernetesMasterConfig": "KubernetesMasterConfig, if present start the kubernetes master in this process", + "etcdConfig": "EtcdConfig, if present start etcd in this process", + "oauthConfig": "OAuthConfig, if present start the /oauth endpoint in this process", + "assetConfig": "AssetConfig, if present start the asset server in this process", + "dnsConfig": "DNSConfig, if present start the DNS server in this process", + "serviceAccountConfig": "ServiceAccountConfig holds options related to service accounts", + "masterClients": "MasterClients holds all the client connection information for controllers and other system components", + "imageConfig": "ImageConfig holds options that describe how to build image names for system components", + "imagePolicyConfig": "ImagePolicyConfig controls limits and behavior for importing images", + "policyConfig": "PolicyConfig holds information about where to locate critical pieces of bootstrapping policy", + "projectConfig": "ProjectConfig holds information about project creation and defaults", + "routingConfig": "RoutingConfig holds information about routing and route generation", + "networkConfig": "NetworkConfig to be passed to the compiled in network plugin", + "volumeConfig": "MasterVolumeConfig contains options for configuring volume plugins in the master node.", + "jenkinsPipelineConfig": "JenkinsPipelineConfig holds information about the default Jenkins template used for JenkinsPipeline build strategy.", + "auditConfig": "AuditConfig holds information related to auditing capabilities.", + "enableTemplateServiceBroker": "EnableTemplateServiceBroker is a temporary switch which enables TemplateServiceBroker.", } func (MasterConfig) SwaggerDoc() map[string]string { diff --git a/pkg/cmd/server/api/v1/types.go b/pkg/cmd/server/api/v1/types.go index 554628e7f812..0cd398429423 100644 --- a/pkg/cmd/server/api/v1/types.go +++ b/pkg/cmd/server/api/v1/types.go @@ -266,6 +266,9 @@ type MasterConfig struct { // AuditConfig holds information related to auditing capabilities. AuditConfig AuditConfig `json:"auditConfig"` + + // EnableTemplateServiceBroker is a temporary switch which enables TemplateServiceBroker. + EnableTemplateServiceBroker bool `json:"enableTemplateServiceBroker"` } // MasterAuthConfig configures authentication options in addition to the standard diff --git a/pkg/cmd/server/api/v1/types_test.go b/pkg/cmd/server/api/v1/types_test.go index bc2619d60d00..0f81577f4fa7 100644 --- a/pkg/cmd/server/api/v1/types_test.go +++ b/pkg/cmd/server/api/v1/types_test.go @@ -125,6 +125,7 @@ dnsConfig: allowRecursiveQueries: false bindAddress: "" bindNetwork: "" +enableTemplateServiceBroker: false etcdClientInfo: ca: "" certFile: "" diff --git a/pkg/cmd/server/bootstrappolicy/constants.go b/pkg/cmd/server/bootstrappolicy/constants.go index a927a2bca567..88a636cf430f 100644 --- a/pkg/cmd/server/bootstrappolicy/constants.go +++ b/pkg/cmd/server/bootstrappolicy/constants.go @@ -62,6 +62,8 @@ const ( RegistryViewerRoleName = "registry-viewer" RegistryEditorRoleName = "registry-editor" + TemplateServiceBrokerClientRoleName = "templateservicebroker-client" + BuildStrategyDockerRoleName = "system:build-strategy-docker" BuildStrategyCustomRoleName = "system:build-strategy-custom" BuildStrategySourceRoleName = "system:build-strategy-source" diff --git a/pkg/cmd/server/bootstrappolicy/policy.go b/pkg/cmd/server/bootstrappolicy/policy.go index f1837d44efb4..ccffa78706a3 100644 --- a/pkg/cmd/server/bootstrappolicy/policy.go +++ b/pkg/cmd/server/bootstrappolicy/policy.go @@ -195,7 +195,7 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { authorizationapi.NewRule(read...).Groups(networkGroup, legacyNetworkGroup).Resources("clusternetworks", "egressnetworkpolicies", "hostsubnets", "netnamespaces").RuleOrDie(), - authorizationapi.NewRule(read...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates").RuleOrDie(), + authorizationapi.NewRule(read...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(), authorizationapi.NewRule(read...).Groups(userGroup, legacyUserGroup).Resources("groups", "identities", "useridentitymappings", "users").RuleOrDie(), @@ -347,7 +347,7 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { // an admin can run routers that write back conditions to the route authorizationapi.NewRule("update").Groups(routeGroup, legacyRouteGroup).Resources("routes/status").RuleOrDie(), - authorizationapi.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates").RuleOrDie(), + authorizationapi.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(), // backwards compatibility authorizationapi.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(), @@ -403,7 +403,7 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { authorizationapi.NewRule(readWrite...).Groups(routeGroup, legacyRouteGroup).Resources("routes").RuleOrDie(), authorizationapi.NewRule(read...).Groups(routeGroup, legacyRouteGroup).Resources("routes/status").RuleOrDie(), - authorizationapi.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates").RuleOrDie(), + authorizationapi.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(), // backwards compatibility authorizationapi.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(), @@ -455,7 +455,7 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { authorizationapi.NewRule(read...).Groups(routeGroup, legacyRouteGroup).Resources("routes").RuleOrDie(), authorizationapi.NewRule(read...).Groups(routeGroup, legacyRouteGroup).Resources("routes/status").RuleOrDie(), - authorizationapi.NewRule(read...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates").RuleOrDie(), + authorizationapi.NewRule(read...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(), // backwards compatibility authorizationapi.NewRule(read...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(), @@ -899,6 +899,20 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { authorizationapi.NewRule("get").Groups(projectGroup, legacyProjectGroup).Resources("projects").RuleOrDie(), }, }, + { + ObjectMeta: kapi.ObjectMeta{ + Name: TemplateServiceBrokerClientRoleName, + Annotations: map[string]string{ + roleSystemOnly: roleIsSystemOnly, + }, + }, + Rules: []authorizationapi.PolicyRule{ + { + Verbs: sets.NewString("get", "put", "update", "delete"), + NonResourceURLs: sets.NewString(templateapi.ServiceBrokerRoot + "/*"), + }, + }, + }, } saRoles := InfraSAs.AllRoles() diff --git a/pkg/cmd/server/kubernetes/master_config.go b/pkg/cmd/server/kubernetes/master_config.go index 4ae57d866338..796523584f58 100644 --- a/pkg/cmd/server/kubernetes/master_config.go +++ b/pkg/cmd/server/kubernetes/master_config.go @@ -449,7 +449,7 @@ func BuildKubernetesMasterConfig( func DefaultOpenAPIConfig() *openapicommon.Config { return &openapicommon.Config{ Definitions: openapigenerated.OpenAPIDefinitions, - IgnorePrefixes: []string{"/swaggerapi", "/healthz", "/controllers", "/metrics", "/version/openshift"}, + IgnorePrefixes: []string{"/swaggerapi", "/healthz", "/controllers", "/metrics", "/version/openshift", "/brokers"}, GetOperationIDAndTags: func(servePath string, r *restful.Route) (string, []string, error) { op := r.Operation path := r.Path diff --git a/pkg/cmd/server/origin/master.go b/pkg/cmd/server/origin/master.go index 98944e34ce1c..d8e059ec3fb3 100644 --- a/pkg/cmd/server/origin/master.go +++ b/pkg/cmd/server/origin/master.go @@ -88,6 +88,7 @@ import ( clientregistry "github.com/openshift/origin/pkg/oauth/registry/oauthclient" clientetcd "github.com/openshift/origin/pkg/oauth/registry/oauthclient/etcd" clientauthetcd "github.com/openshift/origin/pkg/oauth/registry/oauthclientauthorization/etcd" + openservicebrokerserver "github.com/openshift/origin/pkg/openservicebroker/server" projectapiv1 "github.com/openshift/origin/pkg/project/api/v1" projectproxy "github.com/openshift/origin/pkg/project/registry/project/proxy" projectrequeststorage "github.com/openshift/origin/pkg/project/registry/projectrequest/delegated" @@ -100,9 +101,13 @@ import ( hostsubnetetcd "github.com/openshift/origin/pkg/sdn/registry/hostsubnet/etcd" netnamespaceetcd "github.com/openshift/origin/pkg/sdn/registry/netnamespace/etcd" saoauth "github.com/openshift/origin/pkg/serviceaccounts/oauthclient" + templateapi "github.com/openshift/origin/pkg/template/api" templateapiv1 "github.com/openshift/origin/pkg/template/api/v1" + brokertemplateinstanceetcd "github.com/openshift/origin/pkg/template/registry/brokertemplateinstance/etcd" templateregistry "github.com/openshift/origin/pkg/template/registry/template" templateetcd "github.com/openshift/origin/pkg/template/registry/template/etcd" + templateinstanceetcd "github.com/openshift/origin/pkg/template/registry/templateinstance/etcd" + templateservicebroker "github.com/openshift/origin/pkg/template/servicebroker" userapiv1 "github.com/openshift/origin/pkg/user/api/v1" groupetcd "github.com/openshift/origin/pkg/user/registry/group/etcd" identityregistry "github.com/openshift/origin/pkg/user/registry/identity" @@ -535,6 +540,10 @@ func (c *MasterConfig) InstallProtectedAPI(apiserver *genericapiserver.GenericAP // TODO(sttts): use upstream version route initVersionRoute(apiContainer.Container, "/version/openshift") + if c.Options.EnableTemplateServiceBroker { + openservicebrokerserver.Route(apiContainer.Container, templateapi.ServiceBrokerRoot, templateservicebroker.NewBroker(&c.PrivilegedLoopbackClientConfig, c.PrivilegedLoopbackKubernetesClientset, c.Informers, c.Options.PolicyConfig.OpenShiftSharedResourcesNamespace)) + } + // Set up OAuth metadata only if we are configured to use OAuth if c.Options.OAuthConfig != nil { initOAuthAuthorizationServerMetadataRoute(apiContainer, oauthMetadataEndpoint, c.Options.OAuthConfig.MasterPublicURL) @@ -903,6 +912,16 @@ func (c *MasterConfig) GetRestStorage() map[unversioned.GroupVersion]map[string] "routes/status": routeStatusStorage, } + if c.Options.EnableTemplateServiceBroker { + templateInstanceStorage, err := templateinstanceetcd.NewREST(c.RESTOptionsGetter, c.PrivilegedLoopbackOpenShiftClient) + checkStorageErr(err) + brokerTemplateInstanceStorage, err := brokertemplateinstanceetcd.NewREST(c.RESTOptionsGetter) + checkStorageErr(err) + + storage[templateapiv1.SchemeGroupVersion]["templateinstances"] = templateInstanceStorage + storage[templateapiv1.SchemeGroupVersion]["brokertemplateinstances"] = brokerTemplateInstanceStorage + } + if configapi.IsBuildEnabled(&c.Options) { storage[buildapiv1.SchemeGroupVersion] = map[string]rest.Storage{ "builds": buildStorage, diff --git a/pkg/cmd/server/origin/run_components.go b/pkg/cmd/server/origin/run_components.go index ebbb97da67b2..421ecec50028 100644 --- a/pkg/cmd/server/origin/run_components.go +++ b/pkg/cmd/server/origin/run_components.go @@ -58,6 +58,7 @@ import ( "github.com/openshift/origin/pkg/service/controller/ingressip" servingcertcontroller "github.com/openshift/origin/pkg/service/controller/servingcert" serviceaccountcontrollers "github.com/openshift/origin/pkg/serviceaccounts/controllers" + templatecontroller "github.com/openshift/origin/pkg/template/controller" unidlingcontroller "github.com/openshift/origin/pkg/unidling/controller" ) @@ -573,3 +574,7 @@ func (c *MasterConfig) RunUnidlingController() { cont.Run(utilwait.NeverStop) } + +func (c *MasterConfig) RunTemplateController() { + go templatecontroller.NewTemplateInstanceController(&c.PrivilegedLoopbackClientConfig).Run(utilwait.NeverStop) +} diff --git a/pkg/cmd/server/start/start_master.go b/pkg/cmd/server/start/start_master.go index befa48687f9b..8913fa983001 100644 --- a/pkg/cmd/server/start/start_master.go +++ b/pkg/cmd/server/start/start_master.go @@ -755,6 +755,10 @@ func startControllers(oc *origin.MasterConfig, kc *kubernetes.MasterConfig) erro } oc.RunIngressIPController(ingressIPClient) + if oc.Options.EnableTemplateServiceBroker { + oc.RunTemplateController() + } + glog.Infof("Started Origin Controllers") return nil diff --git a/pkg/controller/shared/shared_informer.go b/pkg/controller/shared/shared_informer.go index 490597ca32f5..7a1431efee59 100644 --- a/pkg/controller/shared/shared_informer.go +++ b/pkg/controller/shared/shared_informer.go @@ -26,6 +26,7 @@ type InformerFactory interface { DeploymentConfigs() DeploymentConfigInformer BuildConfigs() BuildConfigInformer + Templates() TemplateInformer ImageStreams() ImageStreamInformer SecurityContextConstraints() SecurityContextConstraintsInformer ClusterResourceQuotas() ClusterResourceQuotaInformer @@ -128,6 +129,10 @@ func (f *sharedInformerFactory) BuildConfigs() BuildConfigInformer { return &buildConfigInformer{sharedInformerFactory: f} } +func (f *sharedInformerFactory) Templates() TemplateInformer { + return &templateInformer{sharedInformerFactory: f} +} + func (f *sharedInformerFactory) ImageStreams() ImageStreamInformer { return &imageStreamInformer{sharedInformerFactory: f} } diff --git a/pkg/controller/shared/template_informers.go b/pkg/controller/shared/template_informers.go new file mode 100644 index 000000000000..91613bb1d6d9 --- /dev/null +++ b/pkg/controller/shared/template_informers.go @@ -0,0 +1,61 @@ +package shared + +import ( + "reflect" + + oscache "github.com/openshift/origin/pkg/client/cache" + templateapi "github.com/openshift/origin/pkg/template/api" + kapi "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/cache" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +type TemplateInformer interface { + Informer() cache.SharedIndexInformer + Indexer() cache.Indexer + Lister() oscache.StoreToTemplateLister +} + +type templateInformer struct { + *sharedInformerFactory +} + +func (f *templateInformer) Informer() cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerObj := &templateapi.Template{} + informerType := reflect.TypeOf(informerObj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + informer = cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options kapi.ListOptions) (runtime.Object, error) { + return f.originClient.Templates(kapi.NamespaceAll).List(options) + }, + WatchFunc: func(options kapi.ListOptions) (watch.Interface, error) { + return f.originClient.Templates(kapi.NamespaceAll).Watch(options) + }, + }, + informerObj, + f.defaultResync, + cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc, oscache.TemplateUIDIndex: oscache.TemplateUIDIndexFunc}, + ) + f.informers[informerType] = informer + + return informer +} + +func (f *templateInformer) Indexer() cache.Indexer { + informer := f.Informer() + return informer.GetIndexer() +} + +func (f *templateInformer) Lister() oscache.StoreToTemplateLister { + informer := f.Informer() + return &oscache.StoreToTemplateListerImpl{Indexer: informer.GetIndexer()} +} diff --git a/pkg/deploy/api/doc.go b/pkg/deploy/api/doc.go index 9f6c967cfa9e..30545a6d6e2e 100644 --- a/pkg/deploy/api/doc.go +++ b/pkg/deploy/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=apps.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/deploy/api/v1/doc.go b/pkg/deploy/api/v1/doc.go index 9cd01e8fbb51..25356e6a7a03 100644 --- a/pkg/deploy/api/v1/doc.go +++ b/pkg/deploy/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=apps.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/deploy/clientset/internalclientset/clientset.go b/pkg/deploy/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..b446a5e4315b --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversiondeploy "github.com/openshift/origin/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Deploy() internalversiondeploy.DeployInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversiondeploy.DeployClient +} + +// Deploy retrieves the DeployClient +func (c *Clientset) Deploy() internalversiondeploy.DeployInterface { + if c == nil { + return nil + } + return c.DeployClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.DeployClient, err = internalversiondeploy.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.DeployClient = internalversiondeploy.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.DeployClient = internalversiondeploy.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/deploy/clientset/internalclientset/doc.go b/pkg/deploy/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..3a10e0454585 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/deploy/clientset/internalclientset/fake/clientset_generated.go b/pkg/deploy/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..5e631bd5f787 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/deploy/clientset/internalclientset" + internalversiondeploy "github.com/openshift/origin/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion" + fakeinternalversiondeploy "github.com/openshift/origin/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Deploy retrieves the DeployClient +func (c *Clientset) Deploy() internalversiondeploy.DeployInterface { + return &fakeinternalversiondeploy.FakeDeploy{Fake: &c.Fake} +} diff --git a/pkg/deploy/clientset/internalclientset/fake/doc.go b/pkg/deploy/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..489bee5aed47 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/deploy_client.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/deploy_client.go new file mode 100644 index 000000000000..6b48eaeefbe1 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/deploy_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type DeployInterface interface { + RESTClient() restclient.Interface + DeploymentConfigsGetter +} + +// DeployClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type DeployClient struct { + restClient restclient.Interface +} + +func (c *DeployClient) DeploymentConfigs(namespace string) DeploymentConfigInterface { + return newDeploymentConfigs(c, namespace) +} + +// NewForConfig creates a new DeployClient for the given config. +func NewForConfig(c *restclient.Config) (*DeployClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &DeployClient{client}, nil +} + +// NewForConfigOrDie creates a new DeployClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *DeployClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new DeployClient for the given RESTClient. +func New(c restclient.Interface) *DeployClient { + return &DeployClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if deploy group is not registered, return an error + g, err := registered.Group("apps.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *DeployClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/deploymentconfig.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/deploymentconfig.go new file mode 100644 index 000000000000..b05f3e289764 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/deploymentconfig.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/deploy/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// DeploymentConfigsGetter has a method to return a DeploymentConfigInterface. +// A group's client should implement this interface. +type DeploymentConfigsGetter interface { + DeploymentConfigs(namespace string) DeploymentConfigInterface +} + +// DeploymentConfigInterface has methods to work with DeploymentConfig resources. +type DeploymentConfigInterface interface { + Create(*api.DeploymentConfig) (*api.DeploymentConfig, error) + Update(*api.DeploymentConfig) (*api.DeploymentConfig, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.DeploymentConfig, error) + List(opts pkg_api.ListOptions) (*api.DeploymentConfigList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.DeploymentConfig, err error) + DeploymentConfigExpansion +} + +// deploymentConfigs implements DeploymentConfigInterface +type deploymentConfigs struct { + client restclient.Interface + ns string +} + +// newDeploymentConfigs returns a DeploymentConfigs +func newDeploymentConfigs(c *DeployClient, namespace string) *deploymentConfigs { + return &deploymentConfigs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a deploymentConfig and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Create(deploymentConfig *api.DeploymentConfig) (result *api.DeploymentConfig, err error) { + result = &api.DeploymentConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// Update takes the representation of a deploymentConfig and updates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Update(deploymentConfig *api.DeploymentConfig) (result *api.DeploymentConfig, err error) { + result = &api.DeploymentConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfig.Name). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// Delete takes name of the deploymentConfig and deletes it. Returns an error if one occurs. +func (c *deploymentConfigs) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *deploymentConfigs) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the deploymentConfig, and returns the corresponding deploymentConfig object, and an error if there is any. +func (c *deploymentConfigs) Get(name string) (result *api.DeploymentConfig, err error) { + result = &api.DeploymentConfig{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DeploymentConfigs that match those selectors. +func (c *deploymentConfigs) List(opts pkg_api.ListOptions) (result *api.DeploymentConfigList, err error) { + result = &api.DeploymentConfigList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested deploymentConfigs. +func (c *deploymentConfigs) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched deploymentConfig. +func (c *deploymentConfigs) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.DeploymentConfig, err error) { + result = &api.DeploymentConfig{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("deploymentconfigs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/doc.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/doc.go new file mode 100644 index 000000000000..720a9a4f450a --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/doc.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/doc.go new file mode 100644 index 000000000000..05872ce797dd --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/fake_deploy_client.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/fake_deploy_client.go new file mode 100644 index 000000000000..ede76b810844 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/fake_deploy_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeDeploy struct { + *core.Fake +} + +func (c *FakeDeploy) DeploymentConfigs(namespace string) internalversion.DeploymentConfigInterface { + return &FakeDeploymentConfigs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeDeploy) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/fake_deploymentconfig.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/fake_deploymentconfig.go new file mode 100644 index 000000000000..f1356a9a4a4f --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/fake/fake_deploymentconfig.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/deploy/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeDeploymentConfigs implements DeploymentConfigInterface +type FakeDeploymentConfigs struct { + Fake *FakeDeploy + ns string +} + +var deploymentconfigsResource = unversioned.GroupVersionResource{Group: "apps.openshift.io", Version: "", Resource: "deploymentconfigs"} + +func (c *FakeDeploymentConfigs) Create(deploymentConfig *api.DeploymentConfig) (result *api.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(deploymentconfigsResource, c.ns, deploymentConfig), &api.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*api.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) Update(deploymentConfig *api.DeploymentConfig) (result *api.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(deploymentconfigsResource, c.ns, deploymentConfig), &api.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*api.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(deploymentconfigsResource, c.ns, name), &api.DeploymentConfig{}) + + return err +} + +func (c *FakeDeploymentConfigs) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(deploymentconfigsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.DeploymentConfigList{}) + return err +} + +func (c *FakeDeploymentConfigs) Get(name string) (result *api.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(deploymentconfigsResource, c.ns, name), &api.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*api.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) List(opts pkg_api.ListOptions) (result *api.DeploymentConfigList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(deploymentconfigsResource, c.ns, opts), &api.DeploymentConfigList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.DeploymentConfigList{} + for _, item := range obj.(*api.DeploymentConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested deploymentConfigs. +func (c *FakeDeploymentConfigs) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(deploymentconfigsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched deploymentConfig. +func (c *FakeDeploymentConfigs) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(deploymentconfigsResource, c.ns, name, data, subresources...), &api.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*api.DeploymentConfig), err +} diff --git a/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/generated_expansion.go b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/generated_expansion.go new file mode 100644 index 000000000000..a7c19d44db30 --- /dev/null +++ b/pkg/deploy/clientset/internalclientset/typed/deploy/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type DeploymentConfigExpansion interface{} diff --git a/pkg/deploy/clientset/release_v3_6/clientset.go b/pkg/deploy/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..aeb4075880f5 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1deploy "github.com/openshift/origin/pkg/deploy/clientset/release_v3_6/typed/deploy/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + DeployV1() v1deploy.DeployV1Interface + // Deprecated: please explicitly pick a version if possible. + Deploy() v1deploy.DeployV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1deploy.DeployV1Client +} + +// DeployV1 retrieves the DeployV1Client +func (c *Clientset) DeployV1() v1deploy.DeployV1Interface { + if c == nil { + return nil + } + return c.DeployV1Client +} + +// Deprecated: Deploy retrieves the default version of DeployClient. +// Please explicitly pick a version. +func (c *Clientset) Deploy() v1deploy.DeployV1Interface { + if c == nil { + return nil + } + return c.DeployV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.DeployV1Client, err = v1deploy.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.DeployV1Client = v1deploy.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.DeployV1Client = v1deploy.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/deploy/clientset/release_v3_6/doc.go b/pkg/deploy/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..44726247efae --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/v1] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/deploy/clientset/release_v3_6/fake/clientset_generated.go b/pkg/deploy/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..f933fcb92683 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/deploy/clientset/release_v3_6" + v1deploy "github.com/openshift/origin/pkg/deploy/clientset/release_v3_6/typed/deploy/v1" + fakev1deploy "github.com/openshift/origin/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// DeployV1 retrieves the DeployV1Client +func (c *Clientset) DeployV1() v1deploy.DeployV1Interface { + return &fakev1deploy.FakeDeployV1{Fake: &c.Fake} +} + +// Deploy retrieves the DeployV1Client +func (c *Clientset) Deploy() v1deploy.DeployV1Interface { + return &fakev1deploy.FakeDeployV1{Fake: &c.Fake} +} diff --git a/pkg/deploy/clientset/release_v3_6/fake/doc.go b/pkg/deploy/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..62f6bd6ed450 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/v1] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/deploy_client.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/deploy_client.go new file mode 100644 index 000000000000..7fdfea56168b --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/deploy_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type DeployV1Interface interface { + RESTClient() restclient.Interface + DeploymentConfigsGetter +} + +// DeployV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type DeployV1Client struct { + restClient restclient.Interface +} + +func (c *DeployV1Client) DeploymentConfigs(namespace string) DeploymentConfigInterface { + return newDeploymentConfigs(c, namespace) +} + +// NewForConfig creates a new DeployV1Client for the given config. +func NewForConfig(c *restclient.Config) (*DeployV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &DeployV1Client{client}, nil +} + +// NewForConfigOrDie creates a new DeployV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *DeployV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new DeployV1Client for the given RESTClient. +func New(c restclient.Interface) *DeployV1Client { + return &DeployV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("apps.openshift.io/v1") + if err != nil { + return err + } + // if apps.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("apps.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *DeployV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/deploymentconfig.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/deploymentconfig.go new file mode 100644 index 000000000000..5ff1c7188146 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/deploymentconfig.go @@ -0,0 +1,151 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/deploy/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// DeploymentConfigsGetter has a method to return a DeploymentConfigInterface. +// A group's client should implement this interface. +type DeploymentConfigsGetter interface { + DeploymentConfigs(namespace string) DeploymentConfigInterface +} + +// DeploymentConfigInterface has methods to work with DeploymentConfig resources. +type DeploymentConfigInterface interface { + Create(*v1.DeploymentConfig) (*v1.DeploymentConfig, error) + Update(*v1.DeploymentConfig) (*v1.DeploymentConfig, error) + UpdateStatus(*v1.DeploymentConfig) (*v1.DeploymentConfig, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.DeploymentConfig, error) + List(opts api_v1.ListOptions) (*v1.DeploymentConfigList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.DeploymentConfig, err error) + DeploymentConfigExpansion +} + +// deploymentConfigs implements DeploymentConfigInterface +type deploymentConfigs struct { + client restclient.Interface + ns string +} + +// newDeploymentConfigs returns a DeploymentConfigs +func newDeploymentConfigs(c *DeployV1Client, namespace string) *deploymentConfigs { + return &deploymentConfigs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a deploymentConfig and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Create(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// Update takes the representation of a deploymentConfig and updates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Update(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfig.Name). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +func (c *deploymentConfigs) UpdateStatus(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfig.Name). + SubResource("status"). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// Delete takes name of the deploymentConfig and deletes it. Returns an error if one occurs. +func (c *deploymentConfigs) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *deploymentConfigs) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the deploymentConfig, and returns the corresponding deploymentConfig object, and an error if there is any. +func (c *deploymentConfigs) Get(name string) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DeploymentConfigs that match those selectors. +func (c *deploymentConfigs) List(opts api_v1.ListOptions) (result *v1.DeploymentConfigList, err error) { + result = &v1.DeploymentConfigList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested deploymentConfigs. +func (c *deploymentConfigs) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched deploymentConfig. +func (c *deploymentConfigs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("deploymentconfigs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/doc.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/doc.go new file mode 100644 index 000000000000..fa633e6040ad --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/v1] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/doc.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/doc.go new file mode 100644 index 000000000000..12c0ac578d2e --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/deploy/clientset --go-header-file=hack/boilerplate.txt --group=deploy --input=[api/v1] --input-base=github.com/openshift/origin/pkg/deploy --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/fake_deploy_client.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/fake_deploy_client.go new file mode 100644 index 000000000000..565345014b10 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/fake_deploy_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/deploy/clientset/release_v3_6/typed/deploy/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeDeployV1 struct { + *core.Fake +} + +func (c *FakeDeployV1) DeploymentConfigs(namespace string) v1.DeploymentConfigInterface { + return &FakeDeploymentConfigs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeDeployV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/fake_deploymentconfig.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/fake_deploymentconfig.go new file mode 100644 index 000000000000..01bfa6903536 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/fake/fake_deploymentconfig.go @@ -0,0 +1,112 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/deploy/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeDeploymentConfigs implements DeploymentConfigInterface +type FakeDeploymentConfigs struct { + Fake *FakeDeployV1 + ns string +} + +var deploymentconfigsResource = unversioned.GroupVersionResource{Group: "apps.openshift.io", Version: "v1", Resource: "deploymentconfigs"} + +func (c *FakeDeploymentConfigs) Create(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(deploymentconfigsResource, c.ns, deploymentConfig), &v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) Update(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(deploymentconfigsResource, c.ns, deploymentConfig), &v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) UpdateStatus(deploymentConfig *v1.DeploymentConfig) (*v1.DeploymentConfig, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction(deploymentconfigsResource, "status", c.ns, deploymentConfig), &v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(deploymentconfigsResource, c.ns, name), &v1.DeploymentConfig{}) + + return err +} + +func (c *FakeDeploymentConfigs) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(deploymentconfigsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.DeploymentConfigList{}) + return err +} + +func (c *FakeDeploymentConfigs) Get(name string) (result *v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(deploymentconfigsResource, c.ns, name), &v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DeploymentConfig), err +} + +func (c *FakeDeploymentConfigs) List(opts api_v1.ListOptions) (result *v1.DeploymentConfigList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(deploymentconfigsResource, c.ns, opts), &v1.DeploymentConfigList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.DeploymentConfigList{} + for _, item := range obj.(*v1.DeploymentConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested deploymentConfigs. +func (c *FakeDeploymentConfigs) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(deploymentconfigsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched deploymentConfig. +func (c *FakeDeploymentConfigs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(deploymentconfigsResource, c.ns, name, data, subresources...), &v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DeploymentConfig), err +} diff --git a/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/generated_expansion.go b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/generated_expansion.go new file mode 100644 index 000000000000..113ade54be42 --- /dev/null +++ b/pkg/deploy/clientset/release_v3_6/typed/deploy/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type DeploymentConfigExpansion interface{} diff --git a/pkg/image/api/doc.go b/pkg/image/api/doc.go index 9f6c967cfa9e..b7f24dc0aed8 100644 --- a/pkg/image/api/doc.go +++ b/pkg/image/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=image.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/image/api/v1/doc.go b/pkg/image/api/v1/doc.go index 410e68cc811b..68566693e894 100644 --- a/pkg/image/api/v1/doc.go +++ b/pkg/image/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=image.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/image/clientset/internalclientset/clientset.go b/pkg/image/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..57829b299388 --- /dev/null +++ b/pkg/image/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionimage "github.com/openshift/origin/pkg/image/clientset/internalclientset/typed/image/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Image() internalversionimage.ImageInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionimage.ImageClient +} + +// Image retrieves the ImageClient +func (c *Clientset) Image() internalversionimage.ImageInterface { + if c == nil { + return nil + } + return c.ImageClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.ImageClient, err = internalversionimage.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.ImageClient = internalversionimage.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.ImageClient = internalversionimage.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/image/clientset/internalclientset/doc.go b/pkg/image/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..afc4e66e774e --- /dev/null +++ b/pkg/image/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/image/clientset/internalclientset/fake/clientset_generated.go b/pkg/image/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..77efd1182170 --- /dev/null +++ b/pkg/image/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/image/clientset/internalclientset" + internalversionimage "github.com/openshift/origin/pkg/image/clientset/internalclientset/typed/image/internalversion" + fakeinternalversionimage "github.com/openshift/origin/pkg/image/clientset/internalclientset/typed/image/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Image retrieves the ImageClient +func (c *Clientset) Image() internalversionimage.ImageInterface { + return &fakeinternalversionimage.FakeImage{Fake: &c.Fake} +} diff --git a/pkg/image/clientset/internalclientset/fake/doc.go b/pkg/image/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..dc701f2b1080 --- /dev/null +++ b/pkg/image/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/doc.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/doc.go new file mode 100644 index 000000000000..ff78a36bef6c --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/doc.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/doc.go new file mode 100644 index 000000000000..5dfa2a0aba11 --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/fake_image.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/fake_image.go new file mode 100644 index 000000000000..be016f2cb4ee --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/fake_image.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/image/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeImages implements ImageResourceInterface +type FakeImages struct { + Fake *FakeImage + ns string +} + +var imagesResource = unversioned.GroupVersionResource{Group: "image.openshift.io", Version: "", Resource: "images"} + +func (c *FakeImages) Create(image *api.Image) (result *api.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(imagesResource, c.ns, image), &api.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Image), err +} + +func (c *FakeImages) Update(image *api.Image) (result *api.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(imagesResource, c.ns, image), &api.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Image), err +} + +func (c *FakeImages) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(imagesResource, c.ns, name), &api.Image{}) + + return err +} + +func (c *FakeImages) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(imagesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ImageList{}) + return err +} + +func (c *FakeImages) Get(name string) (result *api.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(imagesResource, c.ns, name), &api.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Image), err +} + +func (c *FakeImages) List(opts pkg_api.ListOptions) (result *api.ImageList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(imagesResource, c.ns, opts), &api.ImageList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.ImageList{} + for _, item := range obj.(*api.ImageList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested images. +func (c *FakeImages) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(imagesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched image. +func (c *FakeImages) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(imagesResource, c.ns, name, data, subresources...), &api.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Image), err +} diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/fake_image_client.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/fake_image_client.go new file mode 100644 index 000000000000..533812df5fcf --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/fake/fake_image_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/image/clientset/internalclientset/typed/image/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeImage struct { + *core.Fake +} + +func (c *FakeImage) Images(namespace string) internalversion.ImageResourceInterface { + return &FakeImages{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeImage) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/generated_expansion.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/generated_expansion.go new file mode 100644 index 000000000000..21c840aa6af2 --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type ImageResourceExpansion interface{} diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/image.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/image.go new file mode 100644 index 000000000000..6e9b15ed918c --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/image.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/image/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ImagesGetter has a method to return a ImageResourceInterface. +// A group's client should implement this interface. +type ImagesGetter interface { + Images(namespace string) ImageResourceInterface +} + +// ImageResourceInterface has methods to work with ImageResource resources. +type ImageResourceInterface interface { + Create(*api.Image) (*api.Image, error) + Update(*api.Image) (*api.Image, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.Image, error) + List(opts pkg_api.ListOptions) (*api.ImageList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Image, err error) + ImageResourceExpansion +} + +// images implements ImageResourceInterface +type images struct { + client restclient.Interface + ns string +} + +// newImages returns a Images +func newImages(c *ImageClient, namespace string) *images { + return &images{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a image and creates it. Returns the server's representation of the image, and an error, if there is any. +func (c *images) Create(image *api.Image) (result *api.Image, err error) { + result = &api.Image{} + err = c.client.Post(). + Namespace(c.ns). + Resource("images"). + Body(image). + Do(). + Into(result) + return +} + +// Update takes the representation of a image and updates it. Returns the server's representation of the image, and an error, if there is any. +func (c *images) Update(image *api.Image) (result *api.Image, err error) { + result = &api.Image{} + err = c.client.Put(). + Namespace(c.ns). + Resource("images"). + Name(image.Name). + Body(image). + Do(). + Into(result) + return +} + +// Delete takes name of the image and deletes it. Returns an error if one occurs. +func (c *images) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("images"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *images) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("images"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the image, and returns the corresponding image object, and an error if there is any. +func (c *images) Get(name string) (result *api.Image, err error) { + result = &api.Image{} + err = c.client.Get(). + Namespace(c.ns). + Resource("images"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Images that match those selectors. +func (c *images) List(opts pkg_api.ListOptions) (result *api.ImageList, err error) { + result = &api.ImageList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("images"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested images. +func (c *images) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("images"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched image. +func (c *images) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Image, err error) { + result = &api.Image{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("images"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/image/clientset/internalclientset/typed/image/internalversion/image_client.go b/pkg/image/clientset/internalclientset/typed/image/internalversion/image_client.go new file mode 100644 index 000000000000..194d6e6cf519 --- /dev/null +++ b/pkg/image/clientset/internalclientset/typed/image/internalversion/image_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type ImageInterface interface { + RESTClient() restclient.Interface + ImagesGetter +} + +// ImageClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type ImageClient struct { + restClient restclient.Interface +} + +func (c *ImageClient) Images(namespace string) ImageResourceInterface { + return newImages(c, namespace) +} + +// NewForConfig creates a new ImageClient for the given config. +func NewForConfig(c *restclient.Config) (*ImageClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ImageClient{client}, nil +} + +// NewForConfigOrDie creates a new ImageClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *ImageClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ImageClient for the given RESTClient. +func New(c restclient.Interface) *ImageClient { + return &ImageClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if image group is not registered, return an error + g, err := registered.Group("image.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ImageClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/image/clientset/release_v3_6/clientset.go b/pkg/image/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..71373b4ceb0b --- /dev/null +++ b/pkg/image/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1image "github.com/openshift/origin/pkg/image/clientset/release_v3_6/typed/image/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ImageV1() v1image.ImageV1Interface + // Deprecated: please explicitly pick a version if possible. + Image() v1image.ImageV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1image.ImageV1Client +} + +// ImageV1 retrieves the ImageV1Client +func (c *Clientset) ImageV1() v1image.ImageV1Interface { + if c == nil { + return nil + } + return c.ImageV1Client +} + +// Deprecated: Image retrieves the default version of ImageClient. +// Please explicitly pick a version. +func (c *Clientset) Image() v1image.ImageV1Interface { + if c == nil { + return nil + } + return c.ImageV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.ImageV1Client, err = v1image.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.ImageV1Client = v1image.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.ImageV1Client = v1image.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/image/clientset/release_v3_6/doc.go b/pkg/image/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..387110f07440 --- /dev/null +++ b/pkg/image/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/v1] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/image/clientset/release_v3_6/fake/clientset_generated.go b/pkg/image/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..d8dc18d7210d --- /dev/null +++ b/pkg/image/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/image/clientset/release_v3_6" + v1image "github.com/openshift/origin/pkg/image/clientset/release_v3_6/typed/image/v1" + fakev1image "github.com/openshift/origin/pkg/image/clientset/release_v3_6/typed/image/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// ImageV1 retrieves the ImageV1Client +func (c *Clientset) ImageV1() v1image.ImageV1Interface { + return &fakev1image.FakeImageV1{Fake: &c.Fake} +} + +// Image retrieves the ImageV1Client +func (c *Clientset) Image() v1image.ImageV1Interface { + return &fakev1image.FakeImageV1{Fake: &c.Fake} +} diff --git a/pkg/image/clientset/release_v3_6/fake/doc.go b/pkg/image/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..88af20316b4d --- /dev/null +++ b/pkg/image/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/v1] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/doc.go b/pkg/image/clientset/release_v3_6/typed/image/v1/doc.go new file mode 100644 index 000000000000..be8fa28fbcdd --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/v1] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/fake/doc.go b/pkg/image/clientset/release_v3_6/typed/image/v1/fake/doc.go new file mode 100644 index 000000000000..f4331727275b --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/image/clientset --go-header-file=hack/boilerplate.txt --group=image --input=[api/v1] --input-base=github.com/openshift/origin/pkg/image --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/fake/fake_image.go b/pkg/image/clientset/release_v3_6/typed/image/v1/fake/fake_image.go new file mode 100644 index 000000000000..1a76e6093d5d --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/fake/fake_image.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/image/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeImages implements ImageResourceInterface +type FakeImages struct { + Fake *FakeImageV1 + ns string +} + +var imagesResource = unversioned.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "images"} + +func (c *FakeImages) Create(image *v1.Image) (result *v1.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(imagesResource, c.ns, image), &v1.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Image), err +} + +func (c *FakeImages) Update(image *v1.Image) (result *v1.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(imagesResource, c.ns, image), &v1.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Image), err +} + +func (c *FakeImages) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(imagesResource, c.ns, name), &v1.Image{}) + + return err +} + +func (c *FakeImages) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(imagesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.ImageList{}) + return err +} + +func (c *FakeImages) Get(name string) (result *v1.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(imagesResource, c.ns, name), &v1.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Image), err +} + +func (c *FakeImages) List(opts api_v1.ListOptions) (result *v1.ImageList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(imagesResource, c.ns, opts), &v1.ImageList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ImageList{} + for _, item := range obj.(*v1.ImageList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested images. +func (c *FakeImages) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(imagesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched image. +func (c *FakeImages) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Image, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(imagesResource, c.ns, name, data, subresources...), &v1.Image{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Image), err +} diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/fake/fake_image_client.go b/pkg/image/clientset/release_v3_6/typed/image/v1/fake/fake_image_client.go new file mode 100644 index 000000000000..d6f34907e059 --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/fake/fake_image_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/image/clientset/release_v3_6/typed/image/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeImageV1 struct { + *core.Fake +} + +func (c *FakeImageV1) Images(namespace string) v1.ImageResourceInterface { + return &FakeImages{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeImageV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/generated_expansion.go b/pkg/image/clientset/release_v3_6/typed/image/v1/generated_expansion.go new file mode 100644 index 000000000000..662f9384669a --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type ImageResourceExpansion interface{} diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/image.go b/pkg/image/clientset/release_v3_6/typed/image/v1/image.go new file mode 100644 index 000000000000..c58ed0de2b32 --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/image.go @@ -0,0 +1,137 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/image/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ImagesGetter has a method to return a ImageResourceInterface. +// A group's client should implement this interface. +type ImagesGetter interface { + Images(namespace string) ImageResourceInterface +} + +// ImageResourceInterface has methods to work with ImageResource resources. +type ImageResourceInterface interface { + Create(*v1.Image) (*v1.Image, error) + Update(*v1.Image) (*v1.Image, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.Image, error) + List(opts api_v1.ListOptions) (*v1.ImageList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Image, err error) + ImageResourceExpansion +} + +// images implements ImageResourceInterface +type images struct { + client restclient.Interface + ns string +} + +// newImages returns a Images +func newImages(c *ImageV1Client, namespace string) *images { + return &images{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a image and creates it. Returns the server's representation of the image, and an error, if there is any. +func (c *images) Create(image *v1.Image) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Post(). + Namespace(c.ns). + Resource("images"). + Body(image). + Do(). + Into(result) + return +} + +// Update takes the representation of a image and updates it. Returns the server's representation of the image, and an error, if there is any. +func (c *images) Update(image *v1.Image) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Put(). + Namespace(c.ns). + Resource("images"). + Name(image.Name). + Body(image). + Do(). + Into(result) + return +} + +// Delete takes name of the image and deletes it. Returns an error if one occurs. +func (c *images) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("images"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *images) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("images"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the image, and returns the corresponding image object, and an error if there is any. +func (c *images) Get(name string) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Get(). + Namespace(c.ns). + Resource("images"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Images that match those selectors. +func (c *images) List(opts api_v1.ListOptions) (result *v1.ImageList, err error) { + result = &v1.ImageList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("images"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested images. +func (c *images) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("images"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched image. +func (c *images) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("images"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/image/clientset/release_v3_6/typed/image/v1/image_client.go b/pkg/image/clientset/release_v3_6/typed/image/v1/image_client.go new file mode 100644 index 000000000000..d8b7e83bd332 --- /dev/null +++ b/pkg/image/clientset/release_v3_6/typed/image/v1/image_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type ImageV1Interface interface { + RESTClient() restclient.Interface + ImagesGetter +} + +// ImageV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type ImageV1Client struct { + restClient restclient.Interface +} + +func (c *ImageV1Client) Images(namespace string) ImageResourceInterface { + return newImages(c, namespace) +} + +// NewForConfig creates a new ImageV1Client for the given config. +func NewForConfig(c *restclient.Config) (*ImageV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ImageV1Client{client}, nil +} + +// NewForConfigOrDie creates a new ImageV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *ImageV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ImageV1Client for the given RESTClient. +func New(c restclient.Interface) *ImageV1Client { + return &ImageV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("image.openshift.io/v1") + if err != nil { + return err + } + // if image.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("image.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ImageV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/oauth/api/doc.go b/pkg/oauth/api/doc.go index 9f6c967cfa9e..8672f1a19747 100644 --- a/pkg/oauth/api/doc.go +++ b/pkg/oauth/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=oauth.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/oauth/api/v1/doc.go b/pkg/oauth/api/v1/doc.go index 5a697b441ddd..40f16e53a412 100644 --- a/pkg/oauth/api/v1/doc.go +++ b/pkg/oauth/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=oauth.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/oauth/clientset/internalclientset/clientset.go b/pkg/oauth/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..84449f77ace0 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionoauth "github.com/openshift/origin/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Oauth() internalversionoauth.OauthInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionoauth.OauthClient +} + +// Oauth retrieves the OauthClient +func (c *Clientset) Oauth() internalversionoauth.OauthInterface { + if c == nil { + return nil + } + return c.OauthClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.OauthClient, err = internalversionoauth.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.OauthClient = internalversionoauth.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.OauthClient = internalversionoauth.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/oauth/clientset/internalclientset/doc.go b/pkg/oauth/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..ab61e67ea6e6 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/oauth/clientset/internalclientset/fake/clientset_generated.go b/pkg/oauth/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..028423c3eb2f --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/oauth/clientset/internalclientset" + internalversionoauth "github.com/openshift/origin/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion" + fakeinternalversionoauth "github.com/openshift/origin/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Oauth retrieves the OauthClient +func (c *Clientset) Oauth() internalversionoauth.OauthInterface { + return &fakeinternalversionoauth.FakeOauth{Fake: &c.Fake} +} diff --git a/pkg/oauth/clientset/internalclientset/fake/doc.go b/pkg/oauth/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..e5677aac6458 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/doc.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/doc.go new file mode 100644 index 000000000000..dff1ea5febb6 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/doc.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/doc.go new file mode 100644 index 000000000000..3b4b58b238b9 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/fake_oauth_client.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/fake_oauth_client.go new file mode 100644 index 000000000000..743405857920 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/fake_oauth_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeOauth struct { + *core.Fake +} + +func (c *FakeOauth) OAuthClients(namespace string) internalversion.OAuthClientInterface { + return &FakeOAuthClients{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOauth) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/fake_oauthclient.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/fake_oauthclient.go new file mode 100644 index 000000000000..54fb0817618d --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/fake/fake_oauthclient.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/oauth/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeOAuthClients implements OAuthClientInterface +type FakeOAuthClients struct { + Fake *FakeOauth + ns string +} + +var oauthclientsResource = unversioned.GroupVersionResource{Group: "oauth.openshift.io", Version: "", Resource: "oauthclients"} + +func (c *FakeOAuthClients) Create(oAuthClient *api.OAuthClient) (result *api.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(oauthclientsResource, c.ns, oAuthClient), &api.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*api.OAuthClient), err +} + +func (c *FakeOAuthClients) Update(oAuthClient *api.OAuthClient) (result *api.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(oauthclientsResource, c.ns, oAuthClient), &api.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*api.OAuthClient), err +} + +func (c *FakeOAuthClients) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(oauthclientsResource, c.ns, name), &api.OAuthClient{}) + + return err +} + +func (c *FakeOAuthClients) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(oauthclientsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.OAuthClientList{}) + return err +} + +func (c *FakeOAuthClients) Get(name string) (result *api.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(oauthclientsResource, c.ns, name), &api.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*api.OAuthClient), err +} + +func (c *FakeOAuthClients) List(opts pkg_api.ListOptions) (result *api.OAuthClientList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(oauthclientsResource, c.ns, opts), &api.OAuthClientList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.OAuthClientList{} + for _, item := range obj.(*api.OAuthClientList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested oAuthClients. +func (c *FakeOAuthClients) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(oauthclientsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched oAuthClient. +func (c *FakeOAuthClients) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(oauthclientsResource, c.ns, name, data, subresources...), &api.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*api.OAuthClient), err +} diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/generated_expansion.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/generated_expansion.go new file mode 100644 index 000000000000..ccd55c861370 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type OAuthClientExpansion interface{} diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/oauth_client.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/oauth_client.go new file mode 100644 index 000000000000..4718df4c89ab --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/oauth_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type OauthInterface interface { + RESTClient() restclient.Interface + OAuthClientsGetter +} + +// OauthClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type OauthClient struct { + restClient restclient.Interface +} + +func (c *OauthClient) OAuthClients(namespace string) OAuthClientInterface { + return newOAuthClients(c, namespace) +} + +// NewForConfig creates a new OauthClient for the given config. +func NewForConfig(c *restclient.Config) (*OauthClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &OauthClient{client}, nil +} + +// NewForConfigOrDie creates a new OauthClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *OauthClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OauthClient for the given RESTClient. +func New(c restclient.Interface) *OauthClient { + return &OauthClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if oauth group is not registered, return an error + g, err := registered.Group("oauth.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OauthClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/oauthclient.go b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/oauthclient.go new file mode 100644 index 000000000000..8493029b36c9 --- /dev/null +++ b/pkg/oauth/clientset/internalclientset/typed/oauth/internalversion/oauthclient.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/oauth/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// OAuthClientsGetter has a method to return a OAuthClientInterface. +// A group's client should implement this interface. +type OAuthClientsGetter interface { + OAuthClients(namespace string) OAuthClientInterface +} + +// OAuthClientInterface has methods to work with OAuthClient resources. +type OAuthClientInterface interface { + Create(*api.OAuthClient) (*api.OAuthClient, error) + Update(*api.OAuthClient) (*api.OAuthClient, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.OAuthClient, error) + List(opts pkg_api.ListOptions) (*api.OAuthClientList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.OAuthClient, err error) + OAuthClientExpansion +} + +// oAuthClients implements OAuthClientInterface +type oAuthClients struct { + client restclient.Interface + ns string +} + +// newOAuthClients returns a OAuthClients +func newOAuthClients(c *OauthClient, namespace string) *oAuthClients { + return &oAuthClients{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a oAuthClient and creates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *oAuthClients) Create(oAuthClient *api.OAuthClient) (result *api.OAuthClient, err error) { + result = &api.OAuthClient{} + err = c.client.Post(). + Namespace(c.ns). + Resource("oauthclients"). + Body(oAuthClient). + Do(). + Into(result) + return +} + +// Update takes the representation of a oAuthClient and updates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *oAuthClients) Update(oAuthClient *api.OAuthClient) (result *api.OAuthClient, err error) { + result = &api.OAuthClient{} + err = c.client.Put(). + Namespace(c.ns). + Resource("oauthclients"). + Name(oAuthClient.Name). + Body(oAuthClient). + Do(). + Into(result) + return +} + +// Delete takes name of the oAuthClient and deletes it. Returns an error if one occurs. +func (c *oAuthClients) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("oauthclients"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *oAuthClients) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("oauthclients"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the oAuthClient, and returns the corresponding oAuthClient object, and an error if there is any. +func (c *oAuthClients) Get(name string) (result *api.OAuthClient, err error) { + result = &api.OAuthClient{} + err = c.client.Get(). + Namespace(c.ns). + Resource("oauthclients"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of OAuthClients that match those selectors. +func (c *oAuthClients) List(opts pkg_api.ListOptions) (result *api.OAuthClientList, err error) { + result = &api.OAuthClientList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("oauthclients"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested oAuthClients. +func (c *oAuthClients) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("oauthclients"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched oAuthClient. +func (c *oAuthClients) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.OAuthClient, err error) { + result = &api.OAuthClient{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("oauthclients"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/oauth/clientset/release_v3_6/clientset.go b/pkg/oauth/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..0f9349352c27 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1oauth "github.com/openshift/origin/pkg/oauth/clientset/release_v3_6/typed/oauth/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + OauthV1() v1oauth.OauthV1Interface + // Deprecated: please explicitly pick a version if possible. + Oauth() v1oauth.OauthV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1oauth.OauthV1Client +} + +// OauthV1 retrieves the OauthV1Client +func (c *Clientset) OauthV1() v1oauth.OauthV1Interface { + if c == nil { + return nil + } + return c.OauthV1Client +} + +// Deprecated: Oauth retrieves the default version of OauthClient. +// Please explicitly pick a version. +func (c *Clientset) Oauth() v1oauth.OauthV1Interface { + if c == nil { + return nil + } + return c.OauthV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.OauthV1Client, err = v1oauth.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.OauthV1Client = v1oauth.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.OauthV1Client = v1oauth.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/oauth/clientset/release_v3_6/doc.go b/pkg/oauth/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..214e65d42ff7 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/v1] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/oauth/clientset/release_v3_6/fake/clientset_generated.go b/pkg/oauth/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..595d115ce10a --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/oauth/clientset/release_v3_6" + v1oauth "github.com/openshift/origin/pkg/oauth/clientset/release_v3_6/typed/oauth/v1" + fakev1oauth "github.com/openshift/origin/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// OauthV1 retrieves the OauthV1Client +func (c *Clientset) OauthV1() v1oauth.OauthV1Interface { + return &fakev1oauth.FakeOauthV1{Fake: &c.Fake} +} + +// Oauth retrieves the OauthV1Client +func (c *Clientset) Oauth() v1oauth.OauthV1Interface { + return &fakev1oauth.FakeOauthV1{Fake: &c.Fake} +} diff --git a/pkg/oauth/clientset/release_v3_6/fake/doc.go b/pkg/oauth/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..3e29cf799540 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/v1] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/doc.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/doc.go new file mode 100644 index 000000000000..91242b036ab5 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/v1] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/doc.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/doc.go new file mode 100644 index 000000000000..f721e574f2a3 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/oauth/clientset --go-header-file=hack/boilerplate.txt --group=oauth --input=[api/v1] --input-base=github.com/openshift/origin/pkg/oauth --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/fake_oauth_client.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/fake_oauth_client.go new file mode 100644 index 000000000000..df63eba9a51b --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/fake_oauth_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/oauth/clientset/release_v3_6/typed/oauth/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeOauthV1 struct { + *core.Fake +} + +func (c *FakeOauthV1) OAuthClients(namespace string) v1.OAuthClientInterface { + return &FakeOAuthClients{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOauthV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/fake_oauthclient.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/fake_oauthclient.go new file mode 100644 index 000000000000..65d1ab1d7a81 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/fake/fake_oauthclient.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/oauth/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeOAuthClients implements OAuthClientInterface +type FakeOAuthClients struct { + Fake *FakeOauthV1 + ns string +} + +var oauthclientsResource = unversioned.GroupVersionResource{Group: "oauth.openshift.io", Version: "v1", Resource: "oauthclients"} + +func (c *FakeOAuthClients) Create(oAuthClient *v1.OAuthClient) (result *v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(oauthclientsResource, c.ns, oAuthClient), &v1.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.OAuthClient), err +} + +func (c *FakeOAuthClients) Update(oAuthClient *v1.OAuthClient) (result *v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(oauthclientsResource, c.ns, oAuthClient), &v1.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.OAuthClient), err +} + +func (c *FakeOAuthClients) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(oauthclientsResource, c.ns, name), &v1.OAuthClient{}) + + return err +} + +func (c *FakeOAuthClients) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(oauthclientsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.OAuthClientList{}) + return err +} + +func (c *FakeOAuthClients) Get(name string) (result *v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(oauthclientsResource, c.ns, name), &v1.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.OAuthClient), err +} + +func (c *FakeOAuthClients) List(opts api_v1.ListOptions) (result *v1.OAuthClientList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(oauthclientsResource, c.ns, opts), &v1.OAuthClientList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.OAuthClientList{} + for _, item := range obj.(*v1.OAuthClientList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested oAuthClients. +func (c *FakeOAuthClients) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(oauthclientsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched oAuthClient. +func (c *FakeOAuthClients) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(oauthclientsResource, c.ns, name, data, subresources...), &v1.OAuthClient{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.OAuthClient), err +} diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/generated_expansion.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/generated_expansion.go new file mode 100644 index 000000000000..43ce2a165607 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type OAuthClientExpansion interface{} diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/oauth_client.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/oauth_client.go new file mode 100644 index 000000000000..225d34c16c81 --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/oauth_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type OauthV1Interface interface { + RESTClient() restclient.Interface + OAuthClientsGetter +} + +// OauthV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type OauthV1Client struct { + restClient restclient.Interface +} + +func (c *OauthV1Client) OAuthClients(namespace string) OAuthClientInterface { + return newOAuthClients(c, namespace) +} + +// NewForConfig creates a new OauthV1Client for the given config. +func NewForConfig(c *restclient.Config) (*OauthV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &OauthV1Client{client}, nil +} + +// NewForConfigOrDie creates a new OauthV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *OauthV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OauthV1Client for the given RESTClient. +func New(c restclient.Interface) *OauthV1Client { + return &OauthV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("oauth.openshift.io/v1") + if err != nil { + return err + } + // if oauth.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("oauth.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OauthV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/oauthclient.go b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/oauthclient.go new file mode 100644 index 000000000000..2f9573b6297e --- /dev/null +++ b/pkg/oauth/clientset/release_v3_6/typed/oauth/v1/oauthclient.go @@ -0,0 +1,137 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/oauth/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// OAuthClientsGetter has a method to return a OAuthClientInterface. +// A group's client should implement this interface. +type OAuthClientsGetter interface { + OAuthClients(namespace string) OAuthClientInterface +} + +// OAuthClientInterface has methods to work with OAuthClient resources. +type OAuthClientInterface interface { + Create(*v1.OAuthClient) (*v1.OAuthClient, error) + Update(*v1.OAuthClient) (*v1.OAuthClient, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.OAuthClient, error) + List(opts api_v1.ListOptions) (*v1.OAuthClientList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.OAuthClient, err error) + OAuthClientExpansion +} + +// oAuthClients implements OAuthClientInterface +type oAuthClients struct { + client restclient.Interface + ns string +} + +// newOAuthClients returns a OAuthClients +func newOAuthClients(c *OauthV1Client, namespace string) *oAuthClients { + return &oAuthClients{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a oAuthClient and creates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *oAuthClients) Create(oAuthClient *v1.OAuthClient) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Post(). + Namespace(c.ns). + Resource("oauthclients"). + Body(oAuthClient). + Do(). + Into(result) + return +} + +// Update takes the representation of a oAuthClient and updates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *oAuthClients) Update(oAuthClient *v1.OAuthClient) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Put(). + Namespace(c.ns). + Resource("oauthclients"). + Name(oAuthClient.Name). + Body(oAuthClient). + Do(). + Into(result) + return +} + +// Delete takes name of the oAuthClient and deletes it. Returns an error if one occurs. +func (c *oAuthClients) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("oauthclients"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *oAuthClients) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("oauthclients"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the oAuthClient, and returns the corresponding oAuthClient object, and an error if there is any. +func (c *oAuthClients) Get(name string) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Get(). + Namespace(c.ns). + Resource("oauthclients"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of OAuthClients that match those selectors. +func (c *oAuthClients) List(opts api_v1.ListOptions) (result *v1.OAuthClientList, err error) { + result = &v1.OAuthClientList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("oauthclients"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested oAuthClients. +func (c *oAuthClients) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("oauthclients"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched oAuthClient. +func (c *oAuthClients) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("oauthclients"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/openapi/zz_generated.openapi.go b/pkg/openapi/zz_generated.openapi.go index d8b77f3195e2..a5e58cec0c7a 100644 --- a/pkg/openapi/zz_generated.openapi.go +++ b/pkg/openapi/zz_generated.openapi.go @@ -7666,6 +7666,127 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{ Dependencies: []string{ "v1.ObjectMeta", "v1.ObjectReference"}, }, + "v1.BrokerTemplateInstance": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BrokerTemplateInstance holds the service broker-related state associated with a TemplateInstance. BrokerTemplateInstance is part of an experimental API.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object metadata.", + Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "spec describes the state of this BrokerTemplateInstance.", + Ref: spec.MustCreateRef("#/definitions/v1.BrokerTemplateInstanceSpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "v1.BrokerTemplateInstanceSpec", "v1.ObjectMeta"}, + }, + "v1.BrokerTemplateInstanceList": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object metadata.", + Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "items is a list of BrokerTemplateInstances", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: spec.MustCreateRef("#/definitions/v1.BrokerTemplateInstance"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "unversioned.ListMeta", "v1.BrokerTemplateInstance"}, + }, + "v1.BrokerTemplateInstanceSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance.", + Properties: map[string]spec.Schema{ + "templateInstance": { + SchemaProps: spec.SchemaProps{ + Description: "templateinstance is a reference to a TemplateInstance object residing in a namespace.", + Ref: spec.MustCreateRef("#/definitions/v1.ObjectReference"), + }, + }, + "secret": { + SchemaProps: spec.SchemaProps{ + Description: "secret is a reference to a Secret object residing in a namespace, containing the necessary template parameters.", + Ref: spec.MustCreateRef("#/definitions/v1.ObjectReference"), + }, + }, + "bindingIDs": { + SchemaProps: spec.SchemaProps{ + Description: "bindingids is a list of 'binding_id's provided during successive bind calls to the template service broker.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"templateInstance", "secret", "bindingIDs"}, + }, + }, + Dependencies: []string{ + "v1.ObjectReference"}, + }, "v1.Build": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -23816,6 +23937,214 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{ Dependencies: []string{ "runtime.RawExtension", "v1.ObjectMeta", "v1.Parameter"}, }, + "v1.TemplateInstance": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateInstance requests and records the instantiation of a Template. TemplateInstance is part of an experimental API.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object metadata.", + Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "spec describes the desired state of this TemplateInstance.", + Ref: spec.MustCreateRef("#/definitions/v1.TemplateInstanceSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status describes the current state of this TemplateInstance.", + Ref: spec.MustCreateRef("#/definitions/v1.TemplateInstanceStatus"), + }, + }, + }, + Required: []string{"spec", "status"}, + }, + }, + Dependencies: []string{ + "v1.ObjectMeta", "v1.TemplateInstanceSpec", "v1.TemplateInstanceStatus"}, + }, + "v1.TemplateInstanceCondition": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateInstanceCondition contains condition information for a TemplateInstance.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the condition, currently Ready or InstantiateFailure.", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition, one of True, False or Unknown.", + Type: []string{"string"}, + Format: "", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "LastTransitionTime is the last time a condition status transitioned from one state to another.", + Ref: spec.MustCreateRef("#/definitions/unversioned.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "Reason is a brief machine readable explanation for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Message is a human readable description of the details of the last transition, complementing reason.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "unversioned.Time"}, + }, + "v1.TemplateInstanceList": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateInstanceList is a list of TemplateInstance objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object metadata.", + Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "items is a list of Templateinstances", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: spec.MustCreateRef("#/definitions/v1.TemplateInstance"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "unversioned.ListMeta", "v1.TemplateInstance"}, + }, + "v1.TemplateInstanceRequestor": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateInstanceRequestor holds the identity of an agent requesting a template instantiation.", + Properties: map[string]spec.Schema{ + "username": { + SchemaProps: spec.SchemaProps{ + Description: "username is the username of the agent requesting a template instantiation.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"username"}, + }, + }, + Dependencies: []string{}, + }, + "v1.TemplateInstanceSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateInstanceSpec describes the desired state of a TemplateInstance.", + Properties: map[string]spec.Schema{ + "template": { + SchemaProps: spec.SchemaProps{ + Description: "template is a full copy of the template for instantiation.", + Ref: spec.MustCreateRef("#/definitions/v1.Template"), + }, + }, + "secret": { + SchemaProps: spec.SchemaProps{ + Description: "secret is a reference to a Secret object containing the necessary template parameters.", + Ref: spec.MustCreateRef("#/definitions/v1.LocalObjectReference"), + }, + }, + "requestor": { + SchemaProps: spec.SchemaProps{ + Description: "requestor holds the identity of the agent requesting the template instantiation.", + Ref: spec.MustCreateRef("#/definitions/v1.TemplateInstanceRequestor"), + }, + }, + }, + Required: []string{"template", "secret", "requestor"}, + }, + }, + Dependencies: []string{ + "v1.LocalObjectReference", "v1.Template", "v1.TemplateInstanceRequestor"}, + }, + "v1.TemplateInstanceStatus": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateInstanceStatus describes the current state of a TemplateInstance.", + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "conditions represent the latest available observations of a TemplateInstance's current state.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: spec.MustCreateRef("#/definitions/v1.TemplateInstanceCondition"), + }, + }, + }, + }, + }, + }, + Required: []string{"conditions"}, + }, + }, + Dependencies: []string{ + "v1.TemplateInstanceCondition"}, + }, "v1.TemplateList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ diff --git a/pkg/openservicebroker/api/helpers.go b/pkg/openservicebroker/api/helpers.go new file mode 100644 index 000000000000..564ef97eebbb --- /dev/null +++ b/pkg/openservicebroker/api/helpers.go @@ -0,0 +1,15 @@ +package api + +import "net/http" + +func NewResponse(code int, body interface{}, err error) *Response { + return &Response{Code: code, Body: body, Err: err} +} + +func BadRequest(err error) *Response { + return NewResponse(http.StatusBadRequest, nil, err) +} + +func InternalServerError(err error) *Response { + return NewResponse(http.StatusInternalServerError, nil, err) +} diff --git a/pkg/openservicebroker/api/types.go b/pkg/openservicebroker/api/types.go new file mode 100644 index 000000000000..7a89139dc973 --- /dev/null +++ b/pkg/openservicebroker/api/types.go @@ -0,0 +1,160 @@ +package api + +// from https://github.com/openservicebrokerapi/servicebroker/blob/1d301105c66187b5aa2e061a1264ecf3cbc3d2a0/_spec.md + +const ( + XBrokerAPIVersion = "X-Broker-Api-Version" + APIVersion = "2.11" +) + +type Service struct { + Name string `json:"name"` + ID string `json:"id"` + Description string `json:"description"` + Tags []string `json:"tags,omitempty"` + Requires []string `json:"requires,omitempty"` + Bindable bool `json:"bindable"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + DashboardClient *DashboardClient `json:"dashboard_client,omitempty"` + PlanUpdatable bool `json:"plan_updateable,omitempty"` + Plans []Plan `json:"plans"` +} + +type DashboardClient struct { + ID string `json:"id"` + Secret string `json:"secret"` + RedirectURI string `json:"redirect_uri"` +} + +type Plan struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Free bool `json:"free,omitempty"` + Bindable bool `json:"bindable,omitempty"` +} + +type CatalogResponse struct { + Services []*Service `json:"services"` +} + +type LastOperationResponse struct { + State LastOperationState `json:"state"` + Description string `json:"description,omitempty"` +} + +type LastOperationState string + +const ( + LastOperationStateInProgress LastOperationState = "in progress" + LastOperationStateSucceeded LastOperationState = "succeeded" + LastOperationStateFailed LastOperationState = "failed" +) + +type ProvisionRequest struct { + ServiceID string `json:"service_id"` + PlanID string `json:"plan_id"` + Parameters map[string]string `json:"parameters,omitempty"` + AcceptsIncomplete bool `json:"accepts_incomplete,omitempty"` + OrganizationID string `json:"organization_guid"` + SpaceID string `json:"space_guid"` +} + +type ProvisionResponse struct { + DashboardURL string `json:"dashboard_url,omitempty"` + Operation Operation `json:"operation,omitempty"` +} + +type Operation string + +type UpdateRequest struct { + ServiceID string `json:"service_id"` + PlanID string `json:"plan_id,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` + AcceptsIncomplete bool `json:"accepts_incomplete,omitempty"` + PreviousValues struct { + ServiceID string `json:"service_id,omitempty"` + PlanID string `json:"plan_id,omitempty"` + OrganizationID string `json:"organization_id,omitempty"` + SpaceID string `json:"space_id,omitempty"` + } `json:"previous_values,omitempty"` +} + +type UpdateResponse struct { + Operation Operation `json:"operation,omitempty"` +} + +type BindRequest struct { + ServiceID string `json:"service_id"` + PlanID string `json:"plan_id"` + AppGUID string `json:"app_guid,omitempty"` + BindResource struct { + AppGUID string `json:"app_guid,omitempty"` + Route string `json:"route,omitempty"` + } `json:"bind_resource,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` +} + +type BindResponse struct { + Credentials map[string]interface{} `json:"credentials,omitempty"` + SyslogDrainURL string `json:"syslog_drain_url,omitempty"` + RouteServiceURL string `json:"route_service_url,omitempty"` + VolumeMounts []interface{} `json:"volume_mounts,omitempty"` +} + +type UnbindResponse struct { +} + +type DeprovisionResponse struct { + Operation Operation `json:"operation,omitempty"` +} + +type ErrorResponse struct { + Description string `json:"description"` +} + +// asyncRequiredResponse type is not formally defined in the spec +type asyncRequiredResponse struct { + Error string `json:"error,omitempty"` + Description string `json:"description"` +} + +var AsyncRequired = asyncRequiredResponse{ + Error: "AsyncRequired", + Description: "This service plan requires client support for asynchronous service operations.", +} + +// from http://docs.cloudfoundry.org/services/catalog-metadata.html#services-metadata-fields + +const ( + ServiceMetadataDisplayName = "displayName" + ServiceMetadataImageURL = "imageUrl" + ServiceMetadataLongDescription = "longDescription" + ServiceMetadataProviderDisplayName = "providerDisplayName" + ServiceMetadataDocumentationURL = "documentationUrl" + ServiceMetadataSupportURL = "supportUrl" +) + +// the types below are not specified in the openservicebrokerapi spec + +type Response struct { + Code int + Body interface{} + Err error +} + +type Broker interface { + Catalog() *Response + Provision(instanceID string, preq *ProvisionRequest) *Response + Deprovision(instanceID string) *Response + Bind(instanceID string, bindingID string, breq *BindRequest) *Response + Unbind(instanceID string, bindingID string) *Response + LastOperation(instanceID string, operation Operation) *Response +} + +const ( + OperationProvisioning Operation = "provisioning" + OperationUpdating Operation = "updating" + OperationDeprovisioning Operation = "deprovisioning" +) diff --git a/pkg/openservicebroker/api/validation.go b/pkg/openservicebroker/api/validation.go new file mode 100644 index 000000000000..a701dcd4fe91 --- /dev/null +++ b/pkg/openservicebroker/api/validation.go @@ -0,0 +1,30 @@ +package api + +import ( + "regexp" + + "k8s.io/kubernetes/pkg/util/validation/field" +) + +func ValidateProvisionRequest(preq *ProvisionRequest) field.ErrorList { + errors := ValidateUUID(field.NewPath("service_id"), preq.ServiceID) + errors = append(errors, ValidateUUID(field.NewPath("plan_id"), preq.PlanID)...) + + return errors +} + +func ValidateBindRequest(breq *BindRequest) field.ErrorList { + errors := ValidateUUID(field.NewPath("service_id"), breq.ServiceID) + errors = append(errors, ValidateUUID(field.NewPath("plan_id"), breq.PlanID)...) + + return errors +} + +var uuidRegex = regexp.MustCompile("^(?i)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$") + +func ValidateUUID(path *field.Path, uuid string) field.ErrorList { + if uuidRegex.MatchString(uuid) { + return nil + } + return field.ErrorList{field.Invalid(path, uuid, "must be a valid UUID")} +} diff --git a/pkg/openservicebroker/api/validation_test.go b/pkg/openservicebroker/api/validation_test.go new file mode 100644 index 000000000000..eb855d0c6bc3 --- /dev/null +++ b/pkg/openservicebroker/api/validation_test.go @@ -0,0 +1,187 @@ +package api + +import ( + "testing" + + "k8s.io/kubernetes/pkg/util/validation/field" +) + +const validUUID = "fe6e44ea-377a-457c-9fa1-ba06ad356839" + +func TestValidateProvisionRequest(t *testing.T) { + tests := []struct { + name string + preq ProvisionRequest + expectError string + }{ + { + name: "empty ServiceID", + preq: ProvisionRequest{ + PlanID: validUUID, + }, + expectError: `service_id: Invalid value: "": must be a valid UUID`, + }, + { + name: "bad ServiceID", + preq: ProvisionRequest{ + ServiceID: "bad", + PlanID: validUUID, + }, + expectError: `service_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "empty PlanID", + preq: ProvisionRequest{ + ServiceID: validUUID, + }, + expectError: `plan_id: Invalid value: "": must be a valid UUID`, + }, + { + name: "bad PlanID", + preq: ProvisionRequest{ + ServiceID: validUUID, + PlanID: "bad", + }, + expectError: `plan_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "good", + preq: ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + }, + expectError: ``, + }, + } + + for _, test := range tests { + errors := ValidateProvisionRequest(&test.preq) + if test.expectError == "" { + if len(errors) > 0 { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } else { + found := false + for _, err := range errors { + if err.Error() == test.expectError { + found = true + break + } + } + if !found { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } + } +} + +func TestValidateBindRequest(t *testing.T) { + tests := []struct { + name string + breq BindRequest + expectError string + }{ + { + name: "empty ServiceID", + breq: BindRequest{ + PlanID: validUUID, + }, + expectError: `service_id: Invalid value: "": must be a valid UUID`, + }, + { + name: "bad ServiceID", + breq: BindRequest{ + ServiceID: "bad", + PlanID: validUUID, + }, + expectError: `service_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "empty PlanID", + breq: BindRequest{ + ServiceID: validUUID, + }, + expectError: `plan_id: Invalid value: "": must be a valid UUID`, + }, + { + name: "bad PlanID", + breq: BindRequest{ + ServiceID: validUUID, + PlanID: "bad", + }, + expectError: `plan_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "good", + breq: BindRequest{ + ServiceID: validUUID, + PlanID: validUUID, + }, + expectError: ``, + }, + } + + for _, test := range tests { + errors := ValidateBindRequest(&test.breq) + if test.expectError == "" { + if len(errors) > 0 { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } else { + found := false + for _, err := range errors { + if err.Error() == test.expectError { + found = true + break + } + } + if !found { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } + } +} + +func TestValidateUUID(t *testing.T) { + tests := []struct { + name string + uuid string + expectError string + }{ + { + name: "empty UUID", + uuid: "", + expectError: `uuid: Invalid value: "": must be a valid UUID`, + }, + { + name: "bad UUID", + uuid: "bad", + expectError: `uuid: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "good", + uuid: validUUID, + expectError: ``, + }, + } + + for _, test := range tests { + errors := ValidateUUID(field.NewPath("uuid"), test.uuid) + if test.expectError == "" { + if len(errors) > 0 { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } else { + found := false + for _, err := range errors { + if err.Error() == test.expectError { + found = true + break + } + } + if !found { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } + } +} diff --git a/pkg/openservicebroker/client/#client.go# b/pkg/openservicebroker/client/#client.go# new file mode 100644 index 000000000000..537278a23028 --- /dev/null +++ b/pkg/openservicebroker/client/#client.go# @@ -0,0 +1,377 @@ +package client + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "time" + + "k8s.io/kubernetes/pkg/util/validation/field" + + "github.com/openshift/origin/pkg/openservicebroker/api" +) + +type Client interface { + Catalog() (*api.CatalogResponse, error) + Provision(instanceID string, preq *api.ProvisionRequest) (*api.ProvisionResponse, error) + Deprovision(instanceID string) error + Bind(instanceID, bindingID string, breq *api.BindRequest) (*api.BindResponse, error) + Unbind(instanceID, bindingID string) error +} + +type client struct { + cli *http.Client + root string +} + +func NewClient(cli *http.Client, root string) Client { + return &client{cli: cli, root: root} +} + +func (c *client) Catalog() (*api.CatalogResponse, error) { + req, err := http.NewRequest(http.MethodGet, c.root+"/v2/catalog", nil) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK { + var r *api.CatalogResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) Provision(instanceID string, preq *api.ProvisionRequest) (*api.ProvisionResponse, error) { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + preq.AcceptsIncomplete = true + + pr, pw := io.Pipe() + go func() { + e := json.NewEncoder(pw) + pw.CloseWithError(e.Encode(preq)) + }() + + req, err := http.NewRequest(http.MethodPut, c.root+"/v2/service_instances/"+instanceID, pr) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + req.Header.Add("Content-Type", "application/json") + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusCreated, http.StatusAccepted: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusCreated || + resp.StatusCode == http.StatusOK || + resp.StatusCode == http.StatusAccepted { + var r *api.ProvisionResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + + if resp.StatusCode == http.StatusAccepted { + var state api.LastOperationState + state, err = c.WaitForOperation(instanceID, r.Operation) + if err != nil { + return nil, err + } + if state != api.LastOperationStateSucceeded { + return nil, fmt.Errorf("operation returned state %s", string(state)) + } + } + + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) Deprovision(instanceID string) error { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return errs.ToAggregate() + } + + req, err := http.NewRequest(http.MethodDelete, c.root+"/v2/service_instances/"+instanceID+"?accepts_incomplete=true", nil) + if err != nil { + return err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusAccepted, http.StatusGone: + default: + return errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || + resp.StatusCode == http.StatusAccepted || + resp.StatusCode == http.StatusGone { + var r *api.DeprovisionResponse + err = d.Decode(&r) + if err != nil { + return err + } + + if resp.StatusCode == http.StatusAccepted { + var state api.LastOperationState + state, err = c.WaitForOperation(instanceID, r.Operation) + if err != nil { + return err + } + if state != api.LastOperationStateSucceeded { + return fmt.Errorf("operation returned state %s", string(state)) + } + } + + return nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return err + } + return errors.New(r.Description) +} + +func (c *client) LastOperation(instanceID string, operation api.Operation) (*api.LastOperationResponse, error) { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + req, err := http.NewRequest(http.MethodGet, c.root+"/v2/service_instances/"+instanceID+"/last_operation?operation="+string(operation), nil) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusGone: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusGone { + var r *api.LastOperationResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) WaitForOperation(instanceID string, operation api.Operation) (api.LastOperationState, error) { + done := ctx.Done() + for { + op, err := c.LastOperation(ctx, instanceID, operation) + if err != nil { + return api.LastOperationStateFailed, err + } + + if op.State != api.LastOperationStateInProgress { + return op.State, nil + } + + select { + case <-done: + return api.LastOperationStateFailed, ctx.Err() + default: + } + + time.Sleep(1 * time.Second) + } +} + +func (c *client) Bind(instanceID, bindingID string, breq *api.BindRequest) (*api.BindResponse, error) { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + if errs := api.ValidateUUID(field.NewPath("bindingID"), bindingID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + pr, pw := io.Pipe() + go func() { + e := json.NewEncoder(pw) + pw.CloseWithError(e.Encode(breq)) + }() + + req, err := http.NewRequest(http.MethodPut, c.root+"/v2/service_instances/"+instanceID+"/service_bindings/"+bindingID, pr) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + req.Header.Add("Content-Type", "application/json") + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusCreated: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusCreated { + var r *api.BindResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) Unbind(instanceID, bindingID string) error { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return errs.ToAggregate() + } + + if errs := api.ValidateUUID(field.NewPath("bindingID"), bindingID); len(errs) > 0 { + return errs.ToAggregate() + } + + req, err := http.NewRequest(http.MethodDelete, c.root+"/v2/service_instances/"+instanceID+"/service_bindings/"+bindingID, nil) + if err != nil { + return err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusGone: + default: + return errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusGone { + var r *api.UnbindResponse + err = d.Decode(&r) + if err != nil { + return err + } + return nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return err + } + return errors.New(r.Description) +} diff --git a/pkg/openservicebroker/client/client.go b/pkg/openservicebroker/client/client.go new file mode 100644 index 000000000000..7d648660fb35 --- /dev/null +++ b/pkg/openservicebroker/client/client.go @@ -0,0 +1,378 @@ +package client + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "time" + + "k8s.io/kubernetes/pkg/util/validation/field" + + "github.com/openshift/origin/pkg/openservicebroker/api" + "golang.org/x/net/context" +) + +type Client interface { + Catalog(ctx context.Context) (*api.CatalogResponse, error) + Provision(ctx context.Context, instanceID string, preq *api.ProvisionRequest) (*api.ProvisionResponse, error) + Deprovision(ctx context.Context, instanceID string) error + Bind(ctx context.Context, instanceID, bindingID string, breq *api.BindRequest) (*api.BindResponse, error) + Unbind(ctx context.Context, instanceID, bindingID string) error +} + +type client struct { + cli *http.Client + root string +} + +func NewClient(cli *http.Client, root string) Client { + return &client{cli: cli, root: root} +} + +func (c *client) Catalog(ctx context.Context) (*api.CatalogResponse, error) { + req, err := http.NewRequest(http.MethodGet, c.root+"/v2/catalog", nil) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK { + var r *api.CatalogResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) Provision(ctx context.Context, instanceID string, preq *api.ProvisionRequest) (*api.ProvisionResponse, error) { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + preq.AcceptsIncomplete = true + + pr, pw := io.Pipe() + go func() { + e := json.NewEncoder(pw) + pw.CloseWithError(e.Encode(preq)) + }() + + req, err := http.NewRequest(http.MethodPut, c.root+"/v2/service_instances/"+instanceID, pr) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + req.Header.Add("Content-Type", "application/json") + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusCreated, http.StatusAccepted: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusCreated || + resp.StatusCode == http.StatusOK || + resp.StatusCode == http.StatusAccepted { + var r *api.ProvisionResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + + if resp.StatusCode == http.StatusAccepted { + var state api.LastOperationState + state, err = c.WaitForOperation(ctx, instanceID, r.Operation) + if err != nil { + return nil, err + } + if state != api.LastOperationStateSucceeded { + return nil, fmt.Errorf("operation returned state %s", string(state)) + } + } + + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) Deprovision(ctx context.Context, instanceID string) error { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return errs.ToAggregate() + } + + req, err := http.NewRequest(http.MethodDelete, c.root+"/v2/service_instances/"+instanceID+"?accepts_incomplete=true", nil) + if err != nil { + return err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusAccepted, http.StatusGone: + default: + return errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || + resp.StatusCode == http.StatusAccepted || + resp.StatusCode == http.StatusGone { + var r *api.DeprovisionResponse + err = d.Decode(&r) + if err != nil { + return err + } + + if resp.StatusCode == http.StatusAccepted { + var state api.LastOperationState + state, err = c.WaitForOperation(ctx, instanceID, r.Operation) + if err != nil { + return err + } + if state != api.LastOperationStateSucceeded { + return fmt.Errorf("operation returned state %s", string(state)) + } + } + + return nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return err + } + return errors.New(r.Description) +} + +func (c *client) LastOperation(ctx context.Context, instanceID string, operation api.Operation) (*api.LastOperationResponse, error) { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + req, err := http.NewRequest(http.MethodGet, c.root+"/v2/service_instances/"+instanceID+"/last_operation?operation="+string(operation), nil) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusGone: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusGone { + var r *api.LastOperationResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) WaitForOperation(ctx context.Context, instanceID string, operation api.Operation) (api.LastOperationState, error) { + done := ctx.Done() + for { + op, err := c.LastOperation(ctx, instanceID, operation) + if err != nil { + return api.LastOperationStateFailed, err + } + + if op.State != api.LastOperationStateInProgress { + return op.State, nil + } + + select { + case <-done: + return api.LastOperationStateFailed, ctx.Err() + default: + } + + time.Sleep(1 * time.Second) + } +} + +func (c *client) Bind(ctx context.Context, instanceID, bindingID string, breq *api.BindRequest) (*api.BindResponse, error) { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + if errs := api.ValidateUUID(field.NewPath("bindingID"), bindingID); len(errs) > 0 { + return nil, errs.ToAggregate() + } + + pr, pw := io.Pipe() + go func() { + e := json.NewEncoder(pw) + pw.CloseWithError(e.Encode(breq)) + }() + + req, err := http.NewRequest(http.MethodPut, c.root+"/v2/service_instances/"+instanceID+"/service_bindings/"+bindingID, pr) + if err != nil { + return nil, err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + req.Header.Add("Content-Type", "application/json") + + resp, err := c.cli.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusCreated: + default: + return nil, errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return nil, errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusCreated { + var r *api.BindResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return r, nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return nil, err + } + return nil, errors.New(r.Description) +} + +func (c *client) Unbind(ctx context.Context, instanceID, bindingID string) error { + if errs := api.ValidateUUID(field.NewPath("instanceID"), instanceID); len(errs) > 0 { + return errs.ToAggregate() + } + + if errs := api.ValidateUUID(field.NewPath("bindingID"), bindingID); len(errs) > 0 { + return errs.ToAggregate() + } + + req, err := http.NewRequest(http.MethodDelete, c.root+"/v2/service_instances/"+instanceID+"/service_bindings/"+bindingID, nil) + if err != nil { + return err + } + + req.Header.Add(api.XBrokerAPIVersion, api.APIVersion) + + resp, err := c.cli.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusGone: + default: + return errors.New(http.StatusText(resp.StatusCode)) + } + + if resp.Header.Get("Content-Type") != "application/json" { + return errors.New("invalid response") + } + + d := json.NewDecoder(resp.Body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusGone { + var r *api.UnbindResponse + err = d.Decode(&r) + if err != nil { + return err + } + return nil + } + + var r *api.ErrorResponse + err = d.Decode(&r) + if err != nil { + return err + } + return errors.New(r.Description) +} diff --git a/pkg/openservicebroker/server/route.go b/pkg/openservicebroker/server/route.go new file mode 100644 index 000000000000..7644f906448d --- /dev/null +++ b/pkg/openservicebroker/server/route.go @@ -0,0 +1,164 @@ +package server + +import ( + "fmt" + "net/http" + "strconv" + "strings" + + restful "github.com/emicklei/go-restful" + "github.com/openshift/origin/pkg/openservicebroker/api" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +// minimum supported client version +const minAPIVersionMajor, minAPIVersionMinor = 2, 7 + +func Route(container *restful.Container, path string, b api.Broker) { + shim := func(f func(api.Broker, *restful.Request) *api.Response) func(*restful.Request, *restful.Response) { + return func(req *restful.Request, resp *restful.Response) { + response := f(b, req) + if response.Err != nil { + resp.WriteHeaderAndJson(response.Code, &api.ErrorResponse{Description: response.Err.Error()}, restful.MIME_JSON) + } else { + resp.WriteHeaderAndJson(response.Code, response.Body, restful.MIME_JSON) + } + } + } + + ws := restful.WebService{} + ws.Path(path + "/v2") + ws.Filter(apiVersion) + ws.Filter(contentType) + + ws.Route(ws.GET("/catalog").To(shim(catalog))) + ws.Route(ws.PUT("/service_instances/{instance_id}").To(shim(provision))) + ws.Route(ws.DELETE("/service_instances/{instance_id}").To(shim(deprovision))) + ws.Route(ws.GET("/service_instances/{instance_id}/last_operation").To(shim(lastOperation))) + ws.Route(ws.PUT("/service_instances/{instance_id}/service_bindings/{binding_id}").To(shim(bind))) + ws.Route(ws.DELETE("/service_instances/{instance_id}/service_bindings/{binding_id}").To(shim(unbind))) + container.Add(&ws) +} + +func atoi(s string) int { + rv, err := strconv.Atoi(s) + if err != nil { + rv = 0 + } + return rv +} + +func apiVersion(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { + resp.AddHeader(api.XBrokerAPIVersion, api.APIVersion) + + versions := strings.SplitN(req.HeaderParameter(api.XBrokerAPIVersion), ".", 3) + if len(versions) != 2 || atoi(versions[0]) != minAPIVersionMajor || atoi(versions[1]) < minAPIVersionMinor { + resp.WriteHeaderAndJson(http.StatusPreconditionFailed, &api.ErrorResponse{Description: fmt.Sprintf("%s header must >= %d.%d", api.XBrokerAPIVersion, minAPIVersionMajor, minAPIVersionMinor)}, restful.MIME_JSON) + return + } + + chain.ProcessFilter(req, resp) +} + +func contentType(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { + resp.AddHeader(restful.HEADER_ContentType, restful.MIME_JSON) + + if req.Request.Method == http.MethodPut && req.HeaderParameter(restful.HEADER_ContentType) != restful.MIME_JSON { + resp.WriteHeaderAndJson(http.StatusUnsupportedMediaType, &api.ErrorResponse{Description: fmt.Sprintf("%s header must == %s", restful.HEADER_ContentType, restful.MIME_JSON)}, restful.MIME_JSON) + return + } + + chain.ProcessFilter(req, resp) +} + +func catalog(b api.Broker, req *restful.Request) *api.Response { + return b.Catalog() +} + +func provision(b api.Broker, req *restful.Request) *api.Response { + instanceID := req.PathParameter("instance_id") + if errors := api.ValidateUUID(field.NewPath("instance_id"), instanceID); errors != nil { + return api.BadRequest(errors.ToAggregate()) + } + + var preq api.ProvisionRequest + err := req.ReadEntity(&preq) + if err != nil { + return api.BadRequest(err) + } + if errors := api.ValidateProvisionRequest(&preq); errors != nil { + return api.BadRequest(errors.ToAggregate()) + } + + if !preq.AcceptsIncomplete { + return api.NewResponse(http.StatusUnprocessableEntity, api.AsyncRequired, nil) + } + + return b.Provision(instanceID, &preq) +} + +func deprovision(b api.Broker, req *restful.Request) *api.Response { + instanceID := req.PathParameter("instance_id") + if errors := api.ValidateUUID(field.NewPath("instance_id"), instanceID); errors != nil { + return api.BadRequest(errors.ToAggregate()) + } + + if req.QueryParameter("accepts_incomplete") != "true" { + return api.NewResponse(http.StatusUnprocessableEntity, &api.AsyncRequired, nil) + } + + return b.Deprovision(instanceID) +} + +func lastOperation(b api.Broker, req *restful.Request) *api.Response { + instanceID := req.PathParameter("instance_id") + if errors := api.ValidateUUID(field.NewPath("instance_id"), instanceID); errors != nil { + return api.BadRequest(errors.ToAggregate()) + } + + operation := api.Operation(req.QueryParameter("operation")) + if operation != api.OperationProvisioning && + operation != api.OperationUpdating && + operation != api.OperationDeprovisioning { + return api.BadRequest(fmt.Errorf("invalid operation")) + } + + return b.LastOperation(instanceID, operation) +} + +func bind(b api.Broker, req *restful.Request) *api.Response { + instanceID := req.PathParameter("instance_id") + errors := api.ValidateUUID(field.NewPath("instance_id"), instanceID) + + bindingID := req.PathParameter("binding_id") + errors = append(errors, api.ValidateUUID(field.NewPath("binding_id"), bindingID)...) + + if len(errors) > 0 { + return api.BadRequest(errors.ToAggregate()) + } + + var breq api.BindRequest + err := req.ReadEntity(&breq) + if err != nil { + return api.BadRequest(err) + } + if errors = api.ValidateBindRequest(&breq); errors != nil { + return api.BadRequest(errors.ToAggregate()) + } + + return b.Bind(instanceID, bindingID, &breq) +} + +func unbind(b api.Broker, req *restful.Request) *api.Response { + instanceID := req.PathParameter("instance_id") + errors := api.ValidateUUID(field.NewPath("instance_id"), instanceID) + + bindingID := req.PathParameter("binding_id") + errors = append(errors, api.ValidateUUID(field.NewPath("binding_id"), bindingID)...) + + if len(errors) > 0 { + return api.BadRequest(errors.ToAggregate()) + } + + return b.Unbind(instanceID, bindingID) +} diff --git a/pkg/openservicebroker/server/route_test.go b/pkg/openservicebroker/server/route_test.go new file mode 100644 index 000000000000..9b7a153ba2c3 --- /dev/null +++ b/pkg/openservicebroker/server/route_test.go @@ -0,0 +1,594 @@ +package server + +import ( + "bytes" + "encoding/json" + "errors" + "io/ioutil" + "net/http" + "net/url" + "strings" + "testing" + + restful "github.com/emicklei/go-restful" + "github.com/openshift/origin/pkg/openservicebroker/api" +) + +const validUUID = "decd59a9-1dd2-453e-942e-2deba96bfa96" + +type fakeBroker api.Response + +func (b *fakeBroker) Catalog() *api.Response { + r := api.Response(*b) + return &r +} + +func (b *fakeBroker) Provision(instanceID string, preq *api.ProvisionRequest) *api.Response { + r := api.Response(*b) + return &r +} + +func (b *fakeBroker) Deprovision(instanceID string) *api.Response { + r := api.Response(*b) + return &r +} + +func (b *fakeBroker) Bind(instanceID string, bindingID string, breq *api.BindRequest) *api.Response { + r := api.Response(*b) + return &r +} + +func (b *fakeBroker) Unbind(instanceID string, bindingID string) *api.Response { + r := api.Response(*b) + return &r +} + +func (b *fakeBroker) LastOperation(instanceID string, operation api.Operation) *api.Response { + r := api.Response(*b) + return &r +} + +var _ api.Broker = &fakeBroker{} + +type fakeResponseWriter struct { + h http.Header + code int + buf bytes.Buffer + o map[string]interface{} +} + +func newFakeResponseWriter() *fakeResponseWriter { + return &fakeResponseWriter{h: make(http.Header), code: -1} +} + +func (rw *fakeResponseWriter) Header() http.Header { + return rw.h +} + +func (rw *fakeResponseWriter) Write(b []byte) (int, error) { + if rw.code == -1 { + rw.code = http.StatusOK + } + return rw.buf.Write(b) +} + +func (rw *fakeResponseWriter) WriteHeader(code int) { + rw.code = code +} + +var _ http.ResponseWriter = &fakeResponseWriter{} + +func parseUrl(t *testing.T, s string) *url.URL { + u, err := url.Parse(s) + if err != nil { + t.Fatal(err) + } + return u +} + +func checkResponseWriter(t *testing.T, rw *fakeResponseWriter) { + expectedHeaders := map[string]string{ + restful.HEADER_ContentType: restful.MIME_JSON, + api.XBrokerAPIVersion: api.APIVersion, + } + for k, v := range expectedHeaders { + if rw.h.Get(k) != v { + t.Errorf("%s header was %q, expected %q", k, rw.h.Get(k), v) + } + } + + err := json.Unmarshal(rw.buf.Bytes(), &rw.o) + if err != nil { + t.Fatal(err) + } +} + +func TestRequiresXBrokerAPIVersionHeader(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + rw := newFakeResponseWriter() + c.ServeHTTP(rw, &http.Request{ + Method: http.MethodGet, + URL: parseUrl(t, "/v2/catalog"), + }) + checkResponseWriter(t, rw) + + if rw.code != http.StatusPreconditionFailed { + t.Errorf("Expected code %d, got %d", http.StatusPreconditionFailed, rw.code) + } + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, "header must") { + t.Errorf("Expected description containing text %q; got %q", "header must", description) + } +} + +func TestRequiresContentTypeHeader(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + rw := newFakeResponseWriter() + c.ServeHTTP(rw, &http.Request{ + Method: http.MethodPut, + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + Header: http.Header{ + api.XBrokerAPIVersion: []string{api.APIVersion}, + }, + Body: ioutil.NopCloser(bytes.NewBufferString("{}")), + }) + checkResponseWriter(t, rw) + + if rw.code != http.StatusUnsupportedMediaType { + t.Errorf("Expected code %d, got %d", http.StatusUnsupportedMediaType, rw.code) + } + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, "header must") { + t.Errorf("Expected description containing text %q; got %q", "header must", description) + } +} + +func TestInternalServerError(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.InternalServerError(errors.New("test error"))) + Route(c, "", &fb) + + rw := newFakeResponseWriter() + c.ServeHTTP(rw, &http.Request{ + Method: http.MethodGet, + URL: parseUrl(t, "/v2/catalog"), + Header: http.Header{api.XBrokerAPIVersion: []string{api.APIVersion}}, + }) + checkResponseWriter(t, rw) + + if rw.code != http.StatusInternalServerError { + t.Errorf("Expected code %d, got %d", http.StatusInternalServerError, rw.code) + } + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, "test error") { + t.Errorf("Expected description containing text %q", "test error") + } +} + +func TestBadRequestError(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.BadRequest(errors.New("test error"))) + Route(c, "", &fb) + + rw := newFakeResponseWriter() + c.ServeHTTP(rw, &http.Request{ + Method: http.MethodGet, + URL: parseUrl(t, "/v2/catalog"), + Header: http.Header{api.XBrokerAPIVersion: []string{api.APIVersion}}, + }) + checkResponseWriter(t, rw) + + if rw.code != http.StatusBadRequest { + t.Errorf("Expected code %d, got %d", http.StatusBadRequest, rw.code) + } + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, "test error") { + t.Errorf("Expected description containing text %q", "test error") + } +} + +func TestProvision(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + tests := []struct { + name string + req http.Request + body *api.ProvisionRequest + expectCode int + expectError string + }{ + { + name: "bad instance_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/bad"), + }, + expectError: `instance_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "empty body", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + Body: ioutil.NopCloser(bytes.NewBufferString("")), + }, + expectError: `EOF`, + }, + { + name: "bad body", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + Body: ioutil.NopCloser(bytes.NewBufferString("bad")), + }, + expectError: `invalid character`, + }, + { + name: "invalid body", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + }, + body: &api.ProvisionRequest{}, + expectError: `service_id: Invalid value: "": must be a valid UUID`, + }, + { + name: "no acceptsincomplete", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + }, + body: &api.ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + }, + expectCode: http.StatusUnprocessableEntity, + expectError: `This service plan requires client support for asynchronous service operations.`, + }, + { + name: "good", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + }, + body: &api.ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + AcceptsIncomplete: true, + }, + expectCode: http.StatusOK, + }, + } + + for _, test := range tests { + rw := newFakeResponseWriter() + + test.req.Method = http.MethodPut + if test.req.Header == nil { + test.req.Header = make(http.Header) + } + test.req.Header.Set(api.XBrokerAPIVersion, api.APIVersion) + test.req.Header.Set(restful.HEADER_ContentType, restful.MIME_JSON) + if test.expectCode == 0 { + test.expectCode = http.StatusBadRequest + } + + if test.body != nil { + b, err := json.Marshal(&test.body) + if err != nil { + t.Fatal(err) + } + test.req.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + } + + c.ServeHTTP(rw, &test.req) + checkResponseWriter(t, rw) + + if test.expectCode != rw.code { + t.Errorf("%q: expectCode was %d but code was %d", test.name, test.expectCode, rw.code) + } + if test.expectError == "" { + if description, ok := rw.o["description"].(string); ok { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } else { + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, test.expectError) { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } + } +} + +func TestDeprovision(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + tests := []struct { + name string + req http.Request + expectCode int + expectError string + }{ + { + name: "bad instance_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/bad"), + }, + expectError: `instance_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "no acceptsincomplete", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID), + }, + expectCode: http.StatusUnprocessableEntity, + expectError: `This service plan requires client support for asynchronous service operations.`, + }, + { + name: "good", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"?accepts_incomplete=true"), + }, + expectCode: http.StatusOK, + }, + } + + for _, test := range tests { + rw := newFakeResponseWriter() + + test.req.Method = http.MethodDelete + if test.req.Header == nil { + test.req.Header = make(http.Header) + } + test.req.Header.Set(api.XBrokerAPIVersion, api.APIVersion) + if test.expectCode == 0 { + test.expectCode = http.StatusBadRequest + } + + c.ServeHTTP(rw, &test.req) + checkResponseWriter(t, rw) + + if test.expectCode != rw.code { + t.Errorf("%q: expectCode was %d but code was %d", test.name, test.expectCode, rw.code) + } + if test.expectError == "" { + if description, ok := rw.o["description"].(string); ok { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } else { + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, test.expectError) { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } + } +} + +func TestLastOperation(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + tests := []struct { + name string + req http.Request + expectCode int + expectError string + }{ + { + name: "bad instance_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/bad/last_operation"), + }, + expectError: `instance_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "no operation", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/last_operation"), + }, + expectError: `invalid operation`, + }, + { + name: "good", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/last_operation?operation=provisioning"), + }, + expectCode: http.StatusOK, + }, + } + + for _, test := range tests { + rw := newFakeResponseWriter() + + test.req.Method = http.MethodGet + if test.req.Header == nil { + test.req.Header = make(http.Header) + } + test.req.Header.Set(api.XBrokerAPIVersion, api.APIVersion) + if test.expectCode == 0 { + test.expectCode = http.StatusBadRequest + } + + c.ServeHTTP(rw, &test.req) + checkResponseWriter(t, rw) + + if test.expectCode != rw.code { + t.Errorf("%q: expectCode was %d but code was %d", test.name, test.expectCode, rw.code) + } + if test.expectError == "" { + if description, ok := rw.o["description"].(string); ok { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } else { + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, test.expectError) { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } + } +} + +func TestBind(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + tests := []struct { + name string + req http.Request + body *api.BindRequest + expectCode int + expectError string + }{ + { + name: "bad instance_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/bad/service_bindings/"+validUUID), + }, + expectError: `instance_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "bad binding_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/bad"), + }, + expectError: `binding_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "empty body", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/"+validUUID), + Body: ioutil.NopCloser(bytes.NewBufferString("")), + }, + expectError: `EOF`, + }, + { + name: "bad body", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/"+validUUID), + Body: ioutil.NopCloser(bytes.NewBufferString("bad")), + }, + expectError: `invalid character`, + }, + { + name: "invalid body", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/"+validUUID), + }, + body: &api.BindRequest{}, + expectError: `service_id: Invalid value: "": must be a valid UUID`, + }, + { + name: "good", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/"+validUUID), + }, + body: &api.BindRequest{ + ServiceID: validUUID, + PlanID: validUUID, + }, + expectCode: http.StatusOK, + }, + } + + for _, test := range tests { + rw := newFakeResponseWriter() + + test.req.Method = http.MethodPut + if test.req.Header == nil { + test.req.Header = make(http.Header) + } + test.req.Header.Set(api.XBrokerAPIVersion, api.APIVersion) + test.req.Header.Set(restful.HEADER_ContentType, restful.MIME_JSON) + if test.expectCode == 0 { + test.expectCode = http.StatusBadRequest + } + + if test.body != nil { + b, err := json.Marshal(&test.body) + if err != nil { + t.Fatal(err) + } + test.req.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + } + + c.ServeHTTP(rw, &test.req) + checkResponseWriter(t, rw) + + if test.expectCode != rw.code { + t.Errorf("%q: expectCode was %d but code was %d", test.name, test.expectCode, rw.code) + } + if test.expectError == "" { + if description, ok := rw.o["description"].(string); ok { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } else { + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, test.expectError) { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } + } +} + +func TestUnbind(t *testing.T) { + c := restful.NewContainer() + fb := fakeBroker(*api.NewResponse(http.StatusOK, map[string]interface{}{}, nil)) + Route(c, "", &fb) + + tests := []struct { + name string + req http.Request + expectCode int + expectError string + }{ + { + name: "bad instance_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/bad/service_bindings/"+validUUID), + }, + expectError: `instance_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "bad binding_id", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/bad"), + }, + expectError: `binding_id: Invalid value: "bad": must be a valid UUID`, + }, + { + name: "good", + req: http.Request{ + URL: parseUrl(t, "/v2/service_instances/"+validUUID+"/service_bindings/"+validUUID), + }, + expectCode: http.StatusOK, + }, + } + + for _, test := range tests { + rw := newFakeResponseWriter() + + test.req.Method = http.MethodDelete + if test.req.Header == nil { + test.req.Header = make(http.Header) + } + test.req.Header.Set(api.XBrokerAPIVersion, api.APIVersion) + test.req.Header.Set(restful.HEADER_ContentType, restful.MIME_JSON) + if test.expectCode == 0 { + test.expectCode = http.StatusBadRequest + } + + c.ServeHTTP(rw, &test.req) + checkResponseWriter(t, rw) + + if test.expectCode != rw.code { + t.Errorf("%q: expectCode was %d but code was %d", test.name, test.expectCode, rw.code) + } + if test.expectError == "" { + if description, ok := rw.o["description"].(string); ok { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } else { + if description, ok := rw.o["description"].(string); !ok || !strings.Contains(description, test.expectError) { + t.Errorf("%q: expectError was %q but description was %q", test.name, test.expectError, description) + } + } + } +} diff --git a/pkg/project/api/doc.go b/pkg/project/api/doc.go index 9f6c967cfa9e..251919fb373b 100644 --- a/pkg/project/api/doc.go +++ b/pkg/project/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=project.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/project/api/v1/doc.go b/pkg/project/api/v1/doc.go index 386b6d8b1715..40f746f2fe8b 100644 --- a/pkg/project/api/v1/doc.go +++ b/pkg/project/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=project.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/project/clientset/internalclientset/clientset.go b/pkg/project/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..59d00fa370a8 --- /dev/null +++ b/pkg/project/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionproject "github.com/openshift/origin/pkg/project/clientset/internalclientset/typed/project/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Project() internalversionproject.ProjectInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionproject.ProjectClient +} + +// Project retrieves the ProjectClient +func (c *Clientset) Project() internalversionproject.ProjectInterface { + if c == nil { + return nil + } + return c.ProjectClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.ProjectClient, err = internalversionproject.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.ProjectClient = internalversionproject.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.ProjectClient = internalversionproject.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/project/clientset/internalclientset/doc.go b/pkg/project/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..84f0564e5356 --- /dev/null +++ b/pkg/project/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/project/clientset/internalclientset/fake/clientset_generated.go b/pkg/project/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..8b93cacc91b2 --- /dev/null +++ b/pkg/project/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/project/clientset/internalclientset" + internalversionproject "github.com/openshift/origin/pkg/project/clientset/internalclientset/typed/project/internalversion" + fakeinternalversionproject "github.com/openshift/origin/pkg/project/clientset/internalclientset/typed/project/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Project retrieves the ProjectClient +func (c *Clientset) Project() internalversionproject.ProjectInterface { + return &fakeinternalversionproject.FakeProject{Fake: &c.Fake} +} diff --git a/pkg/project/clientset/internalclientset/fake/doc.go b/pkg/project/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..bdd32084d819 --- /dev/null +++ b/pkg/project/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/doc.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/doc.go new file mode 100644 index 000000000000..a409bde9f233 --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/doc.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/doc.go new file mode 100644 index 000000000000..d768ca735359 --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/fake_project.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/fake_project.go new file mode 100644 index 000000000000..b7f6316f5f23 --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/fake_project.go @@ -0,0 +1,93 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/project/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeProjects implements ProjectResourceInterface +type FakeProjects struct { + Fake *FakeProject +} + +var projectsResource = unversioned.GroupVersionResource{Group: "project.openshift.io", Version: "", Resource: "projects"} + +func (c *FakeProjects) Create(project *api.Project) (result *api.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction(projectsResource, project), &api.Project{}) + if obj == nil { + return nil, err + } + return obj.(*api.Project), err +} + +func (c *FakeProjects) Update(project *api.Project) (result *api.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction(projectsResource, project), &api.Project{}) + if obj == nil { + return nil, err + } + return obj.(*api.Project), err +} + +func (c *FakeProjects) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction(projectsResource, name), &api.Project{}) + return err +} + +func (c *FakeProjects) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewRootDeleteCollectionAction(projectsResource, listOptions) + + _, err := c.Fake.Invokes(action, &api.ProjectList{}) + return err +} + +func (c *FakeProjects) Get(name string) (result *api.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction(projectsResource, name), &api.Project{}) + if obj == nil { + return nil, err + } + return obj.(*api.Project), err +} + +func (c *FakeProjects) List(opts pkg_api.ListOptions) (result *api.ProjectList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction(projectsResource, opts), &api.ProjectList{}) + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.ProjectList{} + for _, item := range obj.(*api.ProjectList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *FakeProjects) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction(projectsResource, opts)) +} + +// Patch applies the patch and returns the patched project. +func (c *FakeProjects) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootPatchSubresourceAction(projectsResource, name, data, subresources...), &api.Project{}) + if obj == nil { + return nil, err + } + return obj.(*api.Project), err +} diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/fake_project_client.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/fake_project_client.go new file mode 100644 index 000000000000..2ecc8cda95b0 --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/fake/fake_project_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/project/clientset/internalclientset/typed/project/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeProject struct { + *core.Fake +} + +func (c *FakeProject) Projects() internalversion.ProjectResourceInterface { + return &FakeProjects{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeProject) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/generated_expansion.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/generated_expansion.go new file mode 100644 index 000000000000..a2d97cc4916a --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type ProjectResourceExpansion interface{} diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/project.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/project.go new file mode 100644 index 000000000000..291bf564428e --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/project.go @@ -0,0 +1,126 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/project/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ProjectsGetter has a method to return a ProjectResourceInterface. +// A group's client should implement this interface. +type ProjectsGetter interface { + Projects() ProjectResourceInterface +} + +// ProjectResourceInterface has methods to work with ProjectResource resources. +type ProjectResourceInterface interface { + Create(*api.Project) (*api.Project, error) + Update(*api.Project) (*api.Project, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.Project, error) + List(opts pkg_api.ListOptions) (*api.ProjectList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Project, err error) + ProjectResourceExpansion +} + +// projects implements ProjectResourceInterface +type projects struct { + client restclient.Interface +} + +// newProjects returns a Projects +func newProjects(c *ProjectClient) *projects { + return &projects{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a project and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Create(project *api.Project) (result *api.Project, err error) { + result = &api.Project{} + err = c.client.Post(). + Resource("projects"). + Body(project). + Do(). + Into(result) + return +} + +// Update takes the representation of a project and updates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Update(project *api.Project) (result *api.Project, err error) { + result = &api.Project{} + err = c.client.Put(). + Resource("projects"). + Name(project.Name). + Body(project). + Do(). + Into(result) + return +} + +// Delete takes name of the project and deletes it. Returns an error if one occurs. +func (c *projects) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Resource("projects"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *projects) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Resource("projects"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *projects) Get(name string) (result *api.Project, err error) { + result = &api.Project{} + err = c.client.Get(). + Resource("projects"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *projects) List(opts pkg_api.ListOptions) (result *api.ProjectList, err error) { + result = &api.ProjectList{} + err = c.client.Get(). + Resource("projects"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *projects) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("projects"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched project. +func (c *projects) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Project, err error) { + result = &api.Project{} + err = c.client.Patch(pt). + Resource("projects"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/project/clientset/internalclientset/typed/project/internalversion/project_client.go b/pkg/project/clientset/internalclientset/typed/project/internalversion/project_client.go new file mode 100644 index 000000000000..633326b16605 --- /dev/null +++ b/pkg/project/clientset/internalclientset/typed/project/internalversion/project_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type ProjectInterface interface { + RESTClient() restclient.Interface + ProjectsGetter +} + +// ProjectClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type ProjectClient struct { + restClient restclient.Interface +} + +func (c *ProjectClient) Projects() ProjectResourceInterface { + return newProjects(c) +} + +// NewForConfig creates a new ProjectClient for the given config. +func NewForConfig(c *restclient.Config) (*ProjectClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ProjectClient{client}, nil +} + +// NewForConfigOrDie creates a new ProjectClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *ProjectClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ProjectClient for the given RESTClient. +func New(c restclient.Interface) *ProjectClient { + return &ProjectClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if project group is not registered, return an error + g, err := registered.Group("project.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ProjectClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/project/clientset/release_v3_6/clientset.go b/pkg/project/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..c6c35e051747 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1project "github.com/openshift/origin/pkg/project/clientset/release_v3_6/typed/project/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ProjectV1() v1project.ProjectV1Interface + // Deprecated: please explicitly pick a version if possible. + Project() v1project.ProjectV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1project.ProjectV1Client +} + +// ProjectV1 retrieves the ProjectV1Client +func (c *Clientset) ProjectV1() v1project.ProjectV1Interface { + if c == nil { + return nil + } + return c.ProjectV1Client +} + +// Deprecated: Project retrieves the default version of ProjectClient. +// Please explicitly pick a version. +func (c *Clientset) Project() v1project.ProjectV1Interface { + if c == nil { + return nil + } + return c.ProjectV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.ProjectV1Client, err = v1project.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.ProjectV1Client = v1project.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.ProjectV1Client = v1project.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/project/clientset/release_v3_6/doc.go b/pkg/project/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..6df31af2b250 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/v1] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/project/clientset/release_v3_6/fake/clientset_generated.go b/pkg/project/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..8f07c6e8c55f --- /dev/null +++ b/pkg/project/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/project/clientset/release_v3_6" + v1project "github.com/openshift/origin/pkg/project/clientset/release_v3_6/typed/project/v1" + fakev1project "github.com/openshift/origin/pkg/project/clientset/release_v3_6/typed/project/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// ProjectV1 retrieves the ProjectV1Client +func (c *Clientset) ProjectV1() v1project.ProjectV1Interface { + return &fakev1project.FakeProjectV1{Fake: &c.Fake} +} + +// Project retrieves the ProjectV1Client +func (c *Clientset) Project() v1project.ProjectV1Interface { + return &fakev1project.FakeProjectV1{Fake: &c.Fake} +} diff --git a/pkg/project/clientset/release_v3_6/fake/doc.go b/pkg/project/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..ef8e1d944023 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/v1] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/doc.go b/pkg/project/clientset/release_v3_6/typed/project/v1/doc.go new file mode 100644 index 000000000000..d969b685caf9 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/v1] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/fake/doc.go b/pkg/project/clientset/release_v3_6/typed/project/v1/fake/doc.go new file mode 100644 index 000000000000..4e3eeb5daa94 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/project/clientset --go-header-file=hack/boilerplate.txt --group=project --input=[api/v1] --input-base=github.com/openshift/origin/pkg/project --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/fake/fake_project.go b/pkg/project/clientset/release_v3_6/typed/project/v1/fake/fake_project.go new file mode 100644 index 000000000000..af9e011c199e --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/fake/fake_project.go @@ -0,0 +1,103 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/project/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeProjects implements ProjectResourceInterface +type FakeProjects struct { + Fake *FakeProjectV1 +} + +var projectsResource = unversioned.GroupVersionResource{Group: "project.openshift.io", Version: "v1", Resource: "projects"} + +func (c *FakeProjects) Create(project *v1.Project) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction(projectsResource, project), &v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +func (c *FakeProjects) Update(project *v1.Project) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction(projectsResource, project), &v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +func (c *FakeProjects) UpdateStatus(project *v1.Project) (*v1.Project, error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateSubresourceAction(projectsResource, "status", project), &v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +func (c *FakeProjects) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction(projectsResource, name), &v1.Project{}) + return err +} + +func (c *FakeProjects) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewRootDeleteCollectionAction(projectsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1.ProjectList{}) + return err +} + +func (c *FakeProjects) Get(name string) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction(projectsResource, name), &v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +func (c *FakeProjects) List(opts api_v1.ListOptions) (result *v1.ProjectList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction(projectsResource, opts), &v1.ProjectList{}) + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ProjectList{} + for _, item := range obj.(*v1.ProjectList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *FakeProjects) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction(projectsResource, opts)) +} + +// Patch applies the patch and returns the patched project. +func (c *FakeProjects) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(core.NewRootPatchSubresourceAction(projectsResource, name, data, subresources...), &v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/fake/fake_project_client.go b/pkg/project/clientset/release_v3_6/typed/project/v1/fake/fake_project_client.go new file mode 100644 index 000000000000..84e9ebde8869 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/fake/fake_project_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/project/clientset/release_v3_6/typed/project/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeProjectV1 struct { + *core.Fake +} + +func (c *FakeProjectV1) Projects() v1.ProjectResourceInterface { + return &FakeProjects{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeProjectV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/generated_expansion.go b/pkg/project/clientset/release_v3_6/typed/project/v1/generated_expansion.go new file mode 100644 index 000000000000..fc95d1e8a96d --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type ProjectResourceExpansion interface{} diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/project.go b/pkg/project/clientset/release_v3_6/typed/project/v1/project.go new file mode 100644 index 000000000000..4177f740ed10 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/project.go @@ -0,0 +1,140 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/project/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ProjectsGetter has a method to return a ProjectResourceInterface. +// A group's client should implement this interface. +type ProjectsGetter interface { + Projects() ProjectResourceInterface +} + +// ProjectResourceInterface has methods to work with ProjectResource resources. +type ProjectResourceInterface interface { + Create(*v1.Project) (*v1.Project, error) + Update(*v1.Project) (*v1.Project, error) + UpdateStatus(*v1.Project) (*v1.Project, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.Project, error) + List(opts api_v1.ListOptions) (*v1.ProjectList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Project, err error) + ProjectResourceExpansion +} + +// projects implements ProjectResourceInterface +type projects struct { + client restclient.Interface +} + +// newProjects returns a Projects +func newProjects(c *ProjectV1Client) *projects { + return &projects{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a project and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Create(project *v1.Project) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Post(). + Resource("projects"). + Body(project). + Do(). + Into(result) + return +} + +// Update takes the representation of a project and updates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Update(project *v1.Project) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Put(). + Resource("projects"). + Name(project.Name). + Body(project). + Do(). + Into(result) + return +} + +func (c *projects) UpdateStatus(project *v1.Project) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Put(). + Resource("projects"). + Name(project.Name). + SubResource("status"). + Body(project). + Do(). + Into(result) + return +} + +// Delete takes name of the project and deletes it. Returns an error if one occurs. +func (c *projects) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("projects"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *projects) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Resource("projects"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *projects) Get(name string) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Get(). + Resource("projects"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *projects) List(opts api_v1.ListOptions) (result *v1.ProjectList, err error) { + result = &v1.ProjectList{} + err = c.client.Get(). + Resource("projects"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *projects) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("projects"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched project. +func (c *projects) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Patch(pt). + Resource("projects"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/project/clientset/release_v3_6/typed/project/v1/project_client.go b/pkg/project/clientset/release_v3_6/typed/project/v1/project_client.go new file mode 100644 index 000000000000..7426f64b6719 --- /dev/null +++ b/pkg/project/clientset/release_v3_6/typed/project/v1/project_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type ProjectV1Interface interface { + RESTClient() restclient.Interface + ProjectsGetter +} + +// ProjectV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type ProjectV1Client struct { + restClient restclient.Interface +} + +func (c *ProjectV1Client) Projects() ProjectResourceInterface { + return newProjects(c) +} + +// NewForConfig creates a new ProjectV1Client for the given config. +func NewForConfig(c *restclient.Config) (*ProjectV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ProjectV1Client{client}, nil +} + +// NewForConfigOrDie creates a new ProjectV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *ProjectV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ProjectV1Client for the given RESTClient. +func New(c restclient.Interface) *ProjectV1Client { + return &ProjectV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("project.openshift.io/v1") + if err != nil { + return err + } + // if project.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("project.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ProjectV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/quota/api/doc.go b/pkg/quota/api/doc.go index 9f6c967cfa9e..f90285e3db43 100644 --- a/pkg/quota/api/doc.go +++ b/pkg/quota/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=quota.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/quota/api/types.go b/pkg/quota/api/types.go index 7fac14caf118..cbb74ce5232d 100644 --- a/pkg/quota/api/types.go +++ b/pkg/quota/api/types.go @@ -8,6 +8,9 @@ import ( "k8s.io/kubernetes/pkg/api/unversioned" ) +// +genclient=true +// +nonNamespaced=true + // ClusterResourceQuota mirrors ResourceQuota at a cluster scope. This object is easily convertible to // synthetic ResourceQuota object to allow quota evaluation re-use. type ClusterResourceQuota struct { diff --git a/pkg/quota/api/v1/doc.go b/pkg/quota/api/v1/doc.go index 5a7dbcdb129b..d85349c22e90 100644 --- a/pkg/quota/api/v1/doc.go +++ b/pkg/quota/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=quota.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/quota/api/v1/types.go b/pkg/quota/api/v1/types.go index 647138285e63..95dc499a6d9a 100644 --- a/pkg/quota/api/v1/types.go +++ b/pkg/quota/api/v1/types.go @@ -5,6 +5,9 @@ import ( kapi "k8s.io/kubernetes/pkg/api/v1" ) +// +genclient=true +// +nonNamespaced=true + // ClusterResourceQuota mirrors ResourceQuota at a cluster scope. This object is easily convertible to // synthetic ResourceQuota object to allow quota evaluation re-use. type ClusterResourceQuota struct { diff --git a/pkg/quota/clientset/internalclientset/clientset.go b/pkg/quota/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..cc6a927b0fc4 --- /dev/null +++ b/pkg/quota/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionquota "github.com/openshift/origin/pkg/quota/clientset/internalclientset/typed/quota/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Quota() internalversionquota.QuotaInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionquota.QuotaClient +} + +// Quota retrieves the QuotaClient +func (c *Clientset) Quota() internalversionquota.QuotaInterface { + if c == nil { + return nil + } + return c.QuotaClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.QuotaClient, err = internalversionquota.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.QuotaClient = internalversionquota.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.QuotaClient = internalversionquota.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/quota/clientset/internalclientset/doc.go b/pkg/quota/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..9cc186f93e19 --- /dev/null +++ b/pkg/quota/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/quota/clientset/internalclientset/fake/clientset_generated.go b/pkg/quota/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..3cc4a7da0b2c --- /dev/null +++ b/pkg/quota/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/quota/clientset/internalclientset" + internalversionquota "github.com/openshift/origin/pkg/quota/clientset/internalclientset/typed/quota/internalversion" + fakeinternalversionquota "github.com/openshift/origin/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Quota retrieves the QuotaClient +func (c *Clientset) Quota() internalversionquota.QuotaInterface { + return &fakeinternalversionquota.FakeQuota{Fake: &c.Fake} +} diff --git a/pkg/quota/clientset/internalclientset/fake/doc.go b/pkg/quota/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..9add8759004a --- /dev/null +++ b/pkg/quota/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/clusterresourcequota.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/clusterresourcequota.go new file mode 100644 index 000000000000..13569db56ee5 --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/clusterresourcequota.go @@ -0,0 +1,126 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/quota/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ClusterResourceQuotasGetter has a method to return a ClusterResourceQuotaInterface. +// A group's client should implement this interface. +type ClusterResourceQuotasGetter interface { + ClusterResourceQuotas() ClusterResourceQuotaInterface +} + +// ClusterResourceQuotaInterface has methods to work with ClusterResourceQuota resources. +type ClusterResourceQuotaInterface interface { + Create(*api.ClusterResourceQuota) (*api.ClusterResourceQuota, error) + Update(*api.ClusterResourceQuota) (*api.ClusterResourceQuota, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.ClusterResourceQuota, error) + List(opts pkg_api.ListOptions) (*api.ClusterResourceQuotaList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.ClusterResourceQuota, err error) + ClusterResourceQuotaExpansion +} + +// clusterResourceQuotas implements ClusterResourceQuotaInterface +type clusterResourceQuotas struct { + client restclient.Interface +} + +// newClusterResourceQuotas returns a ClusterResourceQuotas +func newClusterResourceQuotas(c *QuotaClient) *clusterResourceQuotas { + return &clusterResourceQuotas{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a clusterResourceQuota and creates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *clusterResourceQuotas) Create(clusterResourceQuota *api.ClusterResourceQuota) (result *api.ClusterResourceQuota, err error) { + result = &api.ClusterResourceQuota{} + err = c.client.Post(). + Resource("clusterresourcequotas"). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterResourceQuota and updates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *clusterResourceQuotas) Update(clusterResourceQuota *api.ClusterResourceQuota) (result *api.ClusterResourceQuota, err error) { + result = &api.ClusterResourceQuota{} + err = c.client.Put(). + Resource("clusterresourcequotas"). + Name(clusterResourceQuota.Name). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterResourceQuota and deletes it. Returns an error if one occurs. +func (c *clusterResourceQuotas) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterresourcequotas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterResourceQuotas) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Resource("clusterresourcequotas"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the clusterResourceQuota, and returns the corresponding clusterResourceQuota object, and an error if there is any. +func (c *clusterResourceQuotas) Get(name string) (result *api.ClusterResourceQuota, err error) { + result = &api.ClusterResourceQuota{} + err = c.client.Get(). + Resource("clusterresourcequotas"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterResourceQuotas that match those selectors. +func (c *clusterResourceQuotas) List(opts pkg_api.ListOptions) (result *api.ClusterResourceQuotaList, err error) { + result = &api.ClusterResourceQuotaList{} + err = c.client.Get(). + Resource("clusterresourcequotas"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterResourceQuotas. +func (c *clusterResourceQuotas) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("clusterresourcequotas"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched clusterResourceQuota. +func (c *clusterResourceQuotas) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.ClusterResourceQuota, err error) { + result = &api.ClusterResourceQuota{} + err = c.client.Patch(pt). + Resource("clusterresourcequotas"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/doc.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/doc.go new file mode 100644 index 000000000000..dd08a5845932 --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/doc.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/doc.go new file mode 100644 index 000000000000..d1b7868fe22e --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/fake_clusterresourcequota.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/fake_clusterresourcequota.go new file mode 100644 index 000000000000..5ce7383451d4 --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/fake_clusterresourcequota.go @@ -0,0 +1,93 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/quota/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeClusterResourceQuotas implements ClusterResourceQuotaInterface +type FakeClusterResourceQuotas struct { + Fake *FakeQuota +} + +var clusterresourcequotasResource = unversioned.GroupVersionResource{Group: "quota.openshift.io", Version: "", Resource: "clusterresourcequotas"} + +func (c *FakeClusterResourceQuotas) Create(clusterResourceQuota *api.ClusterResourceQuota) (result *api.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction(clusterresourcequotasResource, clusterResourceQuota), &api.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*api.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) Update(clusterResourceQuota *api.ClusterResourceQuota) (result *api.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction(clusterresourcequotasResource, clusterResourceQuota), &api.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*api.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction(clusterresourcequotasResource, name), &api.ClusterResourceQuota{}) + return err +} + +func (c *FakeClusterResourceQuotas) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewRootDeleteCollectionAction(clusterresourcequotasResource, listOptions) + + _, err := c.Fake.Invokes(action, &api.ClusterResourceQuotaList{}) + return err +} + +func (c *FakeClusterResourceQuotas) Get(name string) (result *api.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction(clusterresourcequotasResource, name), &api.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*api.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) List(opts pkg_api.ListOptions) (result *api.ClusterResourceQuotaList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction(clusterresourcequotasResource, opts), &api.ClusterResourceQuotaList{}) + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.ClusterResourceQuotaList{} + for _, item := range obj.(*api.ClusterResourceQuotaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterResourceQuotas. +func (c *FakeClusterResourceQuotas) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction(clusterresourcequotasResource, opts)) +} + +// Patch applies the patch and returns the patched clusterResourceQuota. +func (c *FakeClusterResourceQuotas) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootPatchSubresourceAction(clusterresourcequotasResource, name, data, subresources...), &api.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*api.ClusterResourceQuota), err +} diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/fake_quota_client.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/fake_quota_client.go new file mode 100644 index 000000000000..6c685d759473 --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/fake/fake_quota_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/quota/clientset/internalclientset/typed/quota/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeQuota struct { + *core.Fake +} + +func (c *FakeQuota) ClusterResourceQuotas() internalversion.ClusterResourceQuotaInterface { + return &FakeClusterResourceQuotas{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeQuota) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/generated_expansion.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/generated_expansion.go new file mode 100644 index 000000000000..ef5900d02afe --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type ClusterResourceQuotaExpansion interface{} diff --git a/pkg/quota/clientset/internalclientset/typed/quota/internalversion/quota_client.go b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/quota_client.go new file mode 100644 index 000000000000..ebcfb38c02dc --- /dev/null +++ b/pkg/quota/clientset/internalclientset/typed/quota/internalversion/quota_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type QuotaInterface interface { + RESTClient() restclient.Interface + ClusterResourceQuotasGetter +} + +// QuotaClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type QuotaClient struct { + restClient restclient.Interface +} + +func (c *QuotaClient) ClusterResourceQuotas() ClusterResourceQuotaInterface { + return newClusterResourceQuotas(c) +} + +// NewForConfig creates a new QuotaClient for the given config. +func NewForConfig(c *restclient.Config) (*QuotaClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &QuotaClient{client}, nil +} + +// NewForConfigOrDie creates a new QuotaClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *QuotaClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new QuotaClient for the given RESTClient. +func New(c restclient.Interface) *QuotaClient { + return &QuotaClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if quota group is not registered, return an error + g, err := registered.Group("quota.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *QuotaClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/quota/clientset/release_v3_6/clientset.go b/pkg/quota/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..8d5381307496 --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1quota "github.com/openshift/origin/pkg/quota/clientset/release_v3_6/typed/quota/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + QuotaV1() v1quota.QuotaV1Interface + // Deprecated: please explicitly pick a version if possible. + Quota() v1quota.QuotaV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1quota.QuotaV1Client +} + +// QuotaV1 retrieves the QuotaV1Client +func (c *Clientset) QuotaV1() v1quota.QuotaV1Interface { + if c == nil { + return nil + } + return c.QuotaV1Client +} + +// Deprecated: Quota retrieves the default version of QuotaClient. +// Please explicitly pick a version. +func (c *Clientset) Quota() v1quota.QuotaV1Interface { + if c == nil { + return nil + } + return c.QuotaV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.QuotaV1Client, err = v1quota.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.QuotaV1Client = v1quota.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.QuotaV1Client = v1quota.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/quota/clientset/release_v3_6/doc.go b/pkg/quota/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..3312b373cc64 --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/v1] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/quota/clientset/release_v3_6/fake/clientset_generated.go b/pkg/quota/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..db11a4fc5a3d --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/quota/clientset/release_v3_6" + v1quota "github.com/openshift/origin/pkg/quota/clientset/release_v3_6/typed/quota/v1" + fakev1quota "github.com/openshift/origin/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// QuotaV1 retrieves the QuotaV1Client +func (c *Clientset) QuotaV1() v1quota.QuotaV1Interface { + return &fakev1quota.FakeQuotaV1{Fake: &c.Fake} +} + +// Quota retrieves the QuotaV1Client +func (c *Clientset) Quota() v1quota.QuotaV1Interface { + return &fakev1quota.FakeQuotaV1{Fake: &c.Fake} +} diff --git a/pkg/quota/clientset/release_v3_6/fake/doc.go b/pkg/quota/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..f1968fb7ea6e --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/v1] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/clusterresourcequota.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/clusterresourcequota.go new file mode 100644 index 000000000000..35626c7e89b8 --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/clusterresourcequota.go @@ -0,0 +1,140 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/quota/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ClusterResourceQuotasGetter has a method to return a ClusterResourceQuotaInterface. +// A group's client should implement this interface. +type ClusterResourceQuotasGetter interface { + ClusterResourceQuotas() ClusterResourceQuotaInterface +} + +// ClusterResourceQuotaInterface has methods to work with ClusterResourceQuota resources. +type ClusterResourceQuotaInterface interface { + Create(*v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) + Update(*v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) + UpdateStatus(*v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.ClusterResourceQuota, error) + List(opts api_v1.ListOptions) (*v1.ClusterResourceQuotaList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.ClusterResourceQuota, err error) + ClusterResourceQuotaExpansion +} + +// clusterResourceQuotas implements ClusterResourceQuotaInterface +type clusterResourceQuotas struct { + client restclient.Interface +} + +// newClusterResourceQuotas returns a ClusterResourceQuotas +func newClusterResourceQuotas(c *QuotaV1Client) *clusterResourceQuotas { + return &clusterResourceQuotas{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a clusterResourceQuota and creates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *clusterResourceQuotas) Create(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Post(). + Resource("clusterresourcequotas"). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterResourceQuota and updates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *clusterResourceQuotas) Update(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Put(). + Resource("clusterresourcequotas"). + Name(clusterResourceQuota.Name). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +func (c *clusterResourceQuotas) UpdateStatus(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Put(). + Resource("clusterresourcequotas"). + Name(clusterResourceQuota.Name). + SubResource("status"). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterResourceQuota and deletes it. Returns an error if one occurs. +func (c *clusterResourceQuotas) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterresourcequotas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterResourceQuotas) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterresourcequotas"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the clusterResourceQuota, and returns the corresponding clusterResourceQuota object, and an error if there is any. +func (c *clusterResourceQuotas) Get(name string) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Get(). + Resource("clusterresourcequotas"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterResourceQuotas that match those selectors. +func (c *clusterResourceQuotas) List(opts api_v1.ListOptions) (result *v1.ClusterResourceQuotaList, err error) { + result = &v1.ClusterResourceQuotaList{} + err = c.client.Get(). + Resource("clusterresourcequotas"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterResourceQuotas. +func (c *clusterResourceQuotas) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("clusterresourcequotas"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched clusterResourceQuota. +func (c *clusterResourceQuotas) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Patch(pt). + Resource("clusterresourcequotas"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/doc.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/doc.go new file mode 100644 index 000000000000..5698f7961c3d --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/v1] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/doc.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/doc.go new file mode 100644 index 000000000000..f323b3e1d8d1 --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/quota/clientset --go-header-file=hack/boilerplate.txt --group=quota --input=[api/v1] --input-base=github.com/openshift/origin/pkg/quota --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/fake_clusterresourcequota.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/fake_clusterresourcequota.go new file mode 100644 index 000000000000..6d7773253c7a --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/fake_clusterresourcequota.go @@ -0,0 +1,103 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/quota/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeClusterResourceQuotas implements ClusterResourceQuotaInterface +type FakeClusterResourceQuotas struct { + Fake *FakeQuotaV1 +} + +var clusterresourcequotasResource = unversioned.GroupVersionResource{Group: "quota.openshift.io", Version: "v1", Resource: "clusterresourcequotas"} + +func (c *FakeClusterResourceQuotas) Create(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction(clusterresourcequotasResource, clusterResourceQuota), &v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) Update(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction(clusterresourcequotasResource, clusterResourceQuota), &v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) UpdateStatus(clusterResourceQuota *v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateSubresourceAction(clusterresourcequotasResource, "status", clusterResourceQuota), &v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction(clusterresourcequotasResource, name), &v1.ClusterResourceQuota{}) + return err +} + +func (c *FakeClusterResourceQuotas) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewRootDeleteCollectionAction(clusterresourcequotasResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1.ClusterResourceQuotaList{}) + return err +} + +func (c *FakeClusterResourceQuotas) Get(name string) (result *v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction(clusterresourcequotasResource, name), &v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterResourceQuota), err +} + +func (c *FakeClusterResourceQuotas) List(opts api_v1.ListOptions) (result *v1.ClusterResourceQuotaList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction(clusterresourcequotasResource, opts), &v1.ClusterResourceQuotaList{}) + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ClusterResourceQuotaList{} + for _, item := range obj.(*v1.ClusterResourceQuotaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterResourceQuotas. +func (c *FakeClusterResourceQuotas) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction(clusterresourcequotasResource, opts)) +} + +// Patch applies the patch and returns the patched clusterResourceQuota. +func (c *FakeClusterResourceQuotas) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(core.NewRootPatchSubresourceAction(clusterresourcequotasResource, name, data, subresources...), &v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterResourceQuota), err +} diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/fake_quota_client.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/fake_quota_client.go new file mode 100644 index 000000000000..e61bc9b5c154 --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/fake/fake_quota_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/quota/clientset/release_v3_6/typed/quota/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeQuotaV1 struct { + *core.Fake +} + +func (c *FakeQuotaV1) ClusterResourceQuotas() v1.ClusterResourceQuotaInterface { + return &FakeClusterResourceQuotas{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeQuotaV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/generated_expansion.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/generated_expansion.go new file mode 100644 index 000000000000..c0a6ea2be671 --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type ClusterResourceQuotaExpansion interface{} diff --git a/pkg/quota/clientset/release_v3_6/typed/quota/v1/quota_client.go b/pkg/quota/clientset/release_v3_6/typed/quota/v1/quota_client.go new file mode 100644 index 000000000000..2dfd4695181e --- /dev/null +++ b/pkg/quota/clientset/release_v3_6/typed/quota/v1/quota_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type QuotaV1Interface interface { + RESTClient() restclient.Interface + ClusterResourceQuotasGetter +} + +// QuotaV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type QuotaV1Client struct { + restClient restclient.Interface +} + +func (c *QuotaV1Client) ClusterResourceQuotas() ClusterResourceQuotaInterface { + return newClusterResourceQuotas(c) +} + +// NewForConfig creates a new QuotaV1Client for the given config. +func NewForConfig(c *restclient.Config) (*QuotaV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &QuotaV1Client{client}, nil +} + +// NewForConfigOrDie creates a new QuotaV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *QuotaV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new QuotaV1Client for the given RESTClient. +func New(c restclient.Interface) *QuotaV1Client { + return &QuotaV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("quota.openshift.io/v1") + if err != nil { + return err + } + // if quota.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("quota.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *QuotaV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/route/api/doc.go b/pkg/route/api/doc.go index 9f6c967cfa9e..2440c399c077 100644 --- a/pkg/route/api/doc.go +++ b/pkg/route/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=route.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/route/api/v1/doc.go b/pkg/route/api/v1/doc.go index fe86724dcc80..020539b5f127 100644 --- a/pkg/route/api/v1/doc.go +++ b/pkg/route/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=route.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/route/clientset/internalclientset/clientset.go b/pkg/route/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..6e5037921815 --- /dev/null +++ b/pkg/route/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionroute "github.com/openshift/origin/pkg/route/clientset/internalclientset/typed/route/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Route() internalversionroute.RouteInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionroute.RouteClient +} + +// Route retrieves the RouteClient +func (c *Clientset) Route() internalversionroute.RouteInterface { + if c == nil { + return nil + } + return c.RouteClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.RouteClient, err = internalversionroute.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.RouteClient = internalversionroute.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.RouteClient = internalversionroute.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/route/clientset/internalclientset/doc.go b/pkg/route/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..b062768b13dd --- /dev/null +++ b/pkg/route/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/route/clientset/internalclientset/fake/clientset_generated.go b/pkg/route/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..dce6173b4799 --- /dev/null +++ b/pkg/route/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/route/clientset/internalclientset" + internalversionroute "github.com/openshift/origin/pkg/route/clientset/internalclientset/typed/route/internalversion" + fakeinternalversionroute "github.com/openshift/origin/pkg/route/clientset/internalclientset/typed/route/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Route retrieves the RouteClient +func (c *Clientset) Route() internalversionroute.RouteInterface { + return &fakeinternalversionroute.FakeRoute{Fake: &c.Fake} +} diff --git a/pkg/route/clientset/internalclientset/fake/doc.go b/pkg/route/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..37e74cc197a0 --- /dev/null +++ b/pkg/route/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/doc.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/doc.go new file mode 100644 index 000000000000..ea469d356773 --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/doc.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/doc.go new file mode 100644 index 000000000000..d19c53f19ece --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/fake_route.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/fake_route.go new file mode 100644 index 000000000000..54873f5a435d --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/fake_route.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/route/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeRoutes implements RouteResourceInterface +type FakeRoutes struct { + Fake *FakeRoute + ns string +} + +var routesResource = unversioned.GroupVersionResource{Group: "route.openshift.io", Version: "", Resource: "routes"} + +func (c *FakeRoutes) Create(route *api.Route) (result *api.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(routesResource, c.ns, route), &api.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Route), err +} + +func (c *FakeRoutes) Update(route *api.Route) (result *api.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(routesResource, c.ns, route), &api.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Route), err +} + +func (c *FakeRoutes) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(routesResource, c.ns, name), &api.Route{}) + + return err +} + +func (c *FakeRoutes) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(routesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.RouteList{}) + return err +} + +func (c *FakeRoutes) Get(name string) (result *api.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(routesResource, c.ns, name), &api.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Route), err +} + +func (c *FakeRoutes) List(opts pkg_api.ListOptions) (result *api.RouteList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(routesResource, c.ns, opts), &api.RouteList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.RouteList{} + for _, item := range obj.(*api.RouteList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested routes. +func (c *FakeRoutes) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(routesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched route. +func (c *FakeRoutes) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(routesResource, c.ns, name, data, subresources...), &api.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Route), err +} diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/fake_route_client.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/fake_route_client.go new file mode 100644 index 000000000000..76ccdbdafd41 --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/fake/fake_route_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/route/clientset/internalclientset/typed/route/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeRoute struct { + *core.Fake +} + +func (c *FakeRoute) Routes(namespace string) internalversion.RouteResourceInterface { + return &FakeRoutes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRoute) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/generated_expansion.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/generated_expansion.go new file mode 100644 index 000000000000..8dc3f98ec967 --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type RouteResourceExpansion interface{} diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/route.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/route.go new file mode 100644 index 000000000000..c85af4d56038 --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/route.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/route/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// RoutesGetter has a method to return a RouteResourceInterface. +// A group's client should implement this interface. +type RoutesGetter interface { + Routes(namespace string) RouteResourceInterface +} + +// RouteResourceInterface has methods to work with RouteResource resources. +type RouteResourceInterface interface { + Create(*api.Route) (*api.Route, error) + Update(*api.Route) (*api.Route, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.Route, error) + List(opts pkg_api.ListOptions) (*api.RouteList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Route, err error) + RouteResourceExpansion +} + +// routes implements RouteResourceInterface +type routes struct { + client restclient.Interface + ns string +} + +// newRoutes returns a Routes +func newRoutes(c *RouteClient, namespace string) *routes { + return &routes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a route and creates it. Returns the server's representation of the route, and an error, if there is any. +func (c *routes) Create(route *api.Route) (result *api.Route, err error) { + result = &api.Route{} + err = c.client.Post(). + Namespace(c.ns). + Resource("routes"). + Body(route). + Do(). + Into(result) + return +} + +// Update takes the representation of a route and updates it. Returns the server's representation of the route, and an error, if there is any. +func (c *routes) Update(route *api.Route) (result *api.Route, err error) { + result = &api.Route{} + err = c.client.Put(). + Namespace(c.ns). + Resource("routes"). + Name(route.Name). + Body(route). + Do(). + Into(result) + return +} + +// Delete takes name of the route and deletes it. Returns an error if one occurs. +func (c *routes) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *routes) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the route, and returns the corresponding route object, and an error if there is any. +func (c *routes) Get(name string) (result *api.Route, err error) { + result = &api.Route{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routes"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Routes that match those selectors. +func (c *routes) List(opts pkg_api.ListOptions) (result *api.RouteList, err error) { + result = &api.RouteList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested routes. +func (c *routes) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched route. +func (c *routes) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Route, err error) { + result = &api.Route{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("routes"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/route/clientset/internalclientset/typed/route/internalversion/route_client.go b/pkg/route/clientset/internalclientset/typed/route/internalversion/route_client.go new file mode 100644 index 000000000000..47212addde86 --- /dev/null +++ b/pkg/route/clientset/internalclientset/typed/route/internalversion/route_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type RouteInterface interface { + RESTClient() restclient.Interface + RoutesGetter +} + +// RouteClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type RouteClient struct { + restClient restclient.Interface +} + +func (c *RouteClient) Routes(namespace string) RouteResourceInterface { + return newRoutes(c, namespace) +} + +// NewForConfig creates a new RouteClient for the given config. +func NewForConfig(c *restclient.Config) (*RouteClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &RouteClient{client}, nil +} + +// NewForConfigOrDie creates a new RouteClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *RouteClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RouteClient for the given RESTClient. +func New(c restclient.Interface) *RouteClient { + return &RouteClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if route group is not registered, return an error + g, err := registered.Group("route.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RouteClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/route/clientset/release_v3_6/clientset.go b/pkg/route/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..4ba5e7d7f3d6 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1route "github.com/openshift/origin/pkg/route/clientset/release_v3_6/typed/route/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + RouteV1() v1route.RouteV1Interface + // Deprecated: please explicitly pick a version if possible. + Route() v1route.RouteV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1route.RouteV1Client +} + +// RouteV1 retrieves the RouteV1Client +func (c *Clientset) RouteV1() v1route.RouteV1Interface { + if c == nil { + return nil + } + return c.RouteV1Client +} + +// Deprecated: Route retrieves the default version of RouteClient. +// Please explicitly pick a version. +func (c *Clientset) Route() v1route.RouteV1Interface { + if c == nil { + return nil + } + return c.RouteV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.RouteV1Client, err = v1route.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.RouteV1Client = v1route.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.RouteV1Client = v1route.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/route/clientset/release_v3_6/doc.go b/pkg/route/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..34dd0818a803 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/v1] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/route/clientset/release_v3_6/fake/clientset_generated.go b/pkg/route/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..d3d7758f6816 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/route/clientset/release_v3_6" + v1route "github.com/openshift/origin/pkg/route/clientset/release_v3_6/typed/route/v1" + fakev1route "github.com/openshift/origin/pkg/route/clientset/release_v3_6/typed/route/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// RouteV1 retrieves the RouteV1Client +func (c *Clientset) RouteV1() v1route.RouteV1Interface { + return &fakev1route.FakeRouteV1{Fake: &c.Fake} +} + +// Route retrieves the RouteV1Client +func (c *Clientset) Route() v1route.RouteV1Interface { + return &fakev1route.FakeRouteV1{Fake: &c.Fake} +} diff --git a/pkg/route/clientset/release_v3_6/fake/doc.go b/pkg/route/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..5b5fbfbf8fe9 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/v1] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/doc.go b/pkg/route/clientset/release_v3_6/typed/route/v1/doc.go new file mode 100644 index 000000000000..a9b34cbda138 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/v1] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/fake/doc.go b/pkg/route/clientset/release_v3_6/typed/route/v1/fake/doc.go new file mode 100644 index 000000000000..2f0f3bdf7ad1 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/route/clientset --go-header-file=hack/boilerplate.txt --group=route --input=[api/v1] --input-base=github.com/openshift/origin/pkg/route --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/fake/fake_route.go b/pkg/route/clientset/release_v3_6/typed/route/v1/fake/fake_route.go new file mode 100644 index 000000000000..5a0115a013fd --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/fake/fake_route.go @@ -0,0 +1,112 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/route/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeRoutes implements RouteResourceInterface +type FakeRoutes struct { + Fake *FakeRouteV1 + ns string +} + +var routesResource = unversioned.GroupVersionResource{Group: "route.openshift.io", Version: "v1", Resource: "routes"} + +func (c *FakeRoutes) Create(route *v1.Route) (result *v1.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(routesResource, c.ns, route), &v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Route), err +} + +func (c *FakeRoutes) Update(route *v1.Route) (result *v1.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(routesResource, c.ns, route), &v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Route), err +} + +func (c *FakeRoutes) UpdateStatus(route *v1.Route) (*v1.Route, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction(routesResource, "status", c.ns, route), &v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Route), err +} + +func (c *FakeRoutes) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(routesResource, c.ns, name), &v1.Route{}) + + return err +} + +func (c *FakeRoutes) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(routesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.RouteList{}) + return err +} + +func (c *FakeRoutes) Get(name string) (result *v1.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(routesResource, c.ns, name), &v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Route), err +} + +func (c *FakeRoutes) List(opts api_v1.ListOptions) (result *v1.RouteList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(routesResource, c.ns, opts), &v1.RouteList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.RouteList{} + for _, item := range obj.(*v1.RouteList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested routes. +func (c *FakeRoutes) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(routesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched route. +func (c *FakeRoutes) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Route, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(routesResource, c.ns, name, data, subresources...), &v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Route), err +} diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/fake/fake_route_client.go b/pkg/route/clientset/release_v3_6/typed/route/v1/fake/fake_route_client.go new file mode 100644 index 000000000000..40d3cdd2f470 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/fake/fake_route_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/route/clientset/release_v3_6/typed/route/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeRouteV1 struct { + *core.Fake +} + +func (c *FakeRouteV1) Routes(namespace string) v1.RouteResourceInterface { + return &FakeRoutes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRouteV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/generated_expansion.go b/pkg/route/clientset/release_v3_6/typed/route/v1/generated_expansion.go new file mode 100644 index 000000000000..c389b10b35e0 --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type RouteResourceExpansion interface{} diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/route.go b/pkg/route/clientset/release_v3_6/typed/route/v1/route.go new file mode 100644 index 000000000000..5c35f519d0df --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/route.go @@ -0,0 +1,151 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/route/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// RoutesGetter has a method to return a RouteResourceInterface. +// A group's client should implement this interface. +type RoutesGetter interface { + Routes(namespace string) RouteResourceInterface +} + +// RouteResourceInterface has methods to work with RouteResource resources. +type RouteResourceInterface interface { + Create(*v1.Route) (*v1.Route, error) + Update(*v1.Route) (*v1.Route, error) + UpdateStatus(*v1.Route) (*v1.Route, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.Route, error) + List(opts api_v1.ListOptions) (*v1.RouteList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Route, err error) + RouteResourceExpansion +} + +// routes implements RouteResourceInterface +type routes struct { + client restclient.Interface + ns string +} + +// newRoutes returns a Routes +func newRoutes(c *RouteV1Client, namespace string) *routes { + return &routes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a route and creates it. Returns the server's representation of the route, and an error, if there is any. +func (c *routes) Create(route *v1.Route) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Post(). + Namespace(c.ns). + Resource("routes"). + Body(route). + Do(). + Into(result) + return +} + +// Update takes the representation of a route and updates it. Returns the server's representation of the route, and an error, if there is any. +func (c *routes) Update(route *v1.Route) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Put(). + Namespace(c.ns). + Resource("routes"). + Name(route.Name). + Body(route). + Do(). + Into(result) + return +} + +func (c *routes) UpdateStatus(route *v1.Route) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Put(). + Namespace(c.ns). + Resource("routes"). + Name(route.Name). + SubResource("status"). + Body(route). + Do(). + Into(result) + return +} + +// Delete takes name of the route and deletes it. Returns an error if one occurs. +func (c *routes) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *routes) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the route, and returns the corresponding route object, and an error if there is any. +func (c *routes) Get(name string) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routes"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Routes that match those selectors. +func (c *routes) List(opts api_v1.ListOptions) (result *v1.RouteList, err error) { + result = &v1.RouteList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested routes. +func (c *routes) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched route. +func (c *routes) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("routes"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/route/clientset/release_v3_6/typed/route/v1/route_client.go b/pkg/route/clientset/release_v3_6/typed/route/v1/route_client.go new file mode 100644 index 000000000000..d3f4d2d7034b --- /dev/null +++ b/pkg/route/clientset/release_v3_6/typed/route/v1/route_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type RouteV1Interface interface { + RESTClient() restclient.Interface + RoutesGetter +} + +// RouteV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type RouteV1Client struct { + restClient restclient.Interface +} + +func (c *RouteV1Client) Routes(namespace string) RouteResourceInterface { + return newRoutes(c, namespace) +} + +// NewForConfig creates a new RouteV1Client for the given config. +func NewForConfig(c *restclient.Config) (*RouteV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &RouteV1Client{client}, nil +} + +// NewForConfigOrDie creates a new RouteV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *RouteV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RouteV1Client for the given RESTClient. +func New(c restclient.Interface) *RouteV1Client { + return &RouteV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("route.openshift.io/v1") + if err != nil { + return err + } + // if route.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("route.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RouteV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/sdn/api/doc.go b/pkg/sdn/api/doc.go index 9f6c967cfa9e..6355014b7507 100644 --- a/pkg/sdn/api/doc.go +++ b/pkg/sdn/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=network.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/sdn/api/v1/doc.go b/pkg/sdn/api/v1/doc.go index 175535b7add1..c5124436d686 100644 --- a/pkg/sdn/api/v1/doc.go +++ b/pkg/sdn/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=network.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/sdn/clientset/internalclientset/clientset.go b/pkg/sdn/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..65480ad12363 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionsdn "github.com/openshift/origin/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Sdn() internalversionsdn.SdnInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionsdn.SdnClient +} + +// Sdn retrieves the SdnClient +func (c *Clientset) Sdn() internalversionsdn.SdnInterface { + if c == nil { + return nil + } + return c.SdnClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.SdnClient, err = internalversionsdn.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.SdnClient = internalversionsdn.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.SdnClient = internalversionsdn.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/sdn/clientset/internalclientset/doc.go b/pkg/sdn/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..86f55220c2aa --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/sdn/clientset/internalclientset/fake/clientset_generated.go b/pkg/sdn/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..9b5dc2774f03 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/sdn/clientset/internalclientset" + internalversionsdn "github.com/openshift/origin/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion" + fakeinternalversionsdn "github.com/openshift/origin/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Sdn retrieves the SdnClient +func (c *Clientset) Sdn() internalversionsdn.SdnInterface { + return &fakeinternalversionsdn.FakeSdn{Fake: &c.Fake} +} diff --git a/pkg/sdn/clientset/internalclientset/fake/doc.go b/pkg/sdn/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..efb51b8a94f3 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/clusternetwork.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/clusternetwork.go new file mode 100644 index 000000000000..3dc22e2411eb --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/clusternetwork.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/sdn/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ClusterNetworksGetter has a method to return a ClusterNetworkInterface. +// A group's client should implement this interface. +type ClusterNetworksGetter interface { + ClusterNetworks(namespace string) ClusterNetworkInterface +} + +// ClusterNetworkInterface has methods to work with ClusterNetwork resources. +type ClusterNetworkInterface interface { + Create(*api.ClusterNetwork) (*api.ClusterNetwork, error) + Update(*api.ClusterNetwork) (*api.ClusterNetwork, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.ClusterNetwork, error) + List(opts pkg_api.ListOptions) (*api.ClusterNetworkList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.ClusterNetwork, err error) + ClusterNetworkExpansion +} + +// clusterNetworks implements ClusterNetworkInterface +type clusterNetworks struct { + client restclient.Interface + ns string +} + +// newClusterNetworks returns a ClusterNetworks +func newClusterNetworks(c *SdnClient, namespace string) *clusterNetworks { + return &clusterNetworks{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a clusterNetwork and creates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *clusterNetworks) Create(clusterNetwork *api.ClusterNetwork) (result *api.ClusterNetwork, err error) { + result = &api.ClusterNetwork{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusternetworks"). + Body(clusterNetwork). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterNetwork and updates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *clusterNetworks) Update(clusterNetwork *api.ClusterNetwork) (result *api.ClusterNetwork, err error) { + result = &api.ClusterNetwork{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusternetworks"). + Name(clusterNetwork.Name). + Body(clusterNetwork). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterNetwork and deletes it. Returns an error if one occurs. +func (c *clusterNetworks) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusternetworks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterNetworks) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusternetworks"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the clusterNetwork, and returns the corresponding clusterNetwork object, and an error if there is any. +func (c *clusterNetworks) Get(name string) (result *api.ClusterNetwork, err error) { + result = &api.ClusterNetwork{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusternetworks"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterNetworks that match those selectors. +func (c *clusterNetworks) List(opts pkg_api.ListOptions) (result *api.ClusterNetworkList, err error) { + result = &api.ClusterNetworkList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusternetworks"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterNetworks. +func (c *clusterNetworks) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("clusternetworks"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched clusterNetwork. +func (c *clusterNetworks) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.ClusterNetwork, err error) { + result = &api.ClusterNetwork{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusternetworks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/doc.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/doc.go new file mode 100644 index 000000000000..758c11a8fa56 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/doc.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/doc.go new file mode 100644 index 000000000000..58e4d2b49943 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/fake_clusternetwork.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/fake_clusternetwork.go new file mode 100644 index 000000000000..b05dc922bc2c --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/fake_clusternetwork.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/sdn/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeClusterNetworks implements ClusterNetworkInterface +type FakeClusterNetworks struct { + Fake *FakeSdn + ns string +} + +var clusternetworksResource = unversioned.GroupVersionResource{Group: "network.openshift.io", Version: "", Resource: "clusternetworks"} + +func (c *FakeClusterNetworks) Create(clusterNetwork *api.ClusterNetwork) (result *api.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(clusternetworksResource, c.ns, clusterNetwork), &api.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ClusterNetwork), err +} + +func (c *FakeClusterNetworks) Update(clusterNetwork *api.ClusterNetwork) (result *api.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(clusternetworksResource, c.ns, clusterNetwork), &api.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ClusterNetwork), err +} + +func (c *FakeClusterNetworks) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(clusternetworksResource, c.ns, name), &api.ClusterNetwork{}) + + return err +} + +func (c *FakeClusterNetworks) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(clusternetworksResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.ClusterNetworkList{}) + return err +} + +func (c *FakeClusterNetworks) Get(name string) (result *api.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(clusternetworksResource, c.ns, name), &api.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ClusterNetwork), err +} + +func (c *FakeClusterNetworks) List(opts pkg_api.ListOptions) (result *api.ClusterNetworkList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(clusternetworksResource, c.ns, opts), &api.ClusterNetworkList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.ClusterNetworkList{} + for _, item := range obj.(*api.ClusterNetworkList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterNetworks. +func (c *FakeClusterNetworks) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(clusternetworksResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched clusterNetwork. +func (c *FakeClusterNetworks) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(clusternetworksResource, c.ns, name, data, subresources...), &api.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*api.ClusterNetwork), err +} diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/fake_sdn_client.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/fake_sdn_client.go new file mode 100644 index 000000000000..32eb7ba76102 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/fake/fake_sdn_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeSdn struct { + *core.Fake +} + +func (c *FakeSdn) ClusterNetworks(namespace string) internalversion.ClusterNetworkInterface { + return &FakeClusterNetworks{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSdn) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/generated_expansion.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/generated_expansion.go new file mode 100644 index 000000000000..e1ffdee414b4 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type ClusterNetworkExpansion interface{} diff --git a/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/sdn_client.go b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/sdn_client.go new file mode 100644 index 000000000000..80d16b33bee6 --- /dev/null +++ b/pkg/sdn/clientset/internalclientset/typed/sdn/internalversion/sdn_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type SdnInterface interface { + RESTClient() restclient.Interface + ClusterNetworksGetter +} + +// SdnClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type SdnClient struct { + restClient restclient.Interface +} + +func (c *SdnClient) ClusterNetworks(namespace string) ClusterNetworkInterface { + return newClusterNetworks(c, namespace) +} + +// NewForConfig creates a new SdnClient for the given config. +func NewForConfig(c *restclient.Config) (*SdnClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &SdnClient{client}, nil +} + +// NewForConfigOrDie creates a new SdnClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *SdnClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SdnClient for the given RESTClient. +func New(c restclient.Interface) *SdnClient { + return &SdnClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if sdn group is not registered, return an error + g, err := registered.Group("network.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SdnClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/sdn/clientset/release_v3_6/clientset.go b/pkg/sdn/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..f4c6e3869d2b --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1sdn "github.com/openshift/origin/pkg/sdn/clientset/release_v3_6/typed/sdn/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + SdnV1() v1sdn.SdnV1Interface + // Deprecated: please explicitly pick a version if possible. + Sdn() v1sdn.SdnV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1sdn.SdnV1Client +} + +// SdnV1 retrieves the SdnV1Client +func (c *Clientset) SdnV1() v1sdn.SdnV1Interface { + if c == nil { + return nil + } + return c.SdnV1Client +} + +// Deprecated: Sdn retrieves the default version of SdnClient. +// Please explicitly pick a version. +func (c *Clientset) Sdn() v1sdn.SdnV1Interface { + if c == nil { + return nil + } + return c.SdnV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.SdnV1Client, err = v1sdn.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.SdnV1Client = v1sdn.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.SdnV1Client = v1sdn.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/sdn/clientset/release_v3_6/doc.go b/pkg/sdn/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..6ba6e8aeda8f --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/v1] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/sdn/clientset/release_v3_6/fake/clientset_generated.go b/pkg/sdn/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..afb112cef62d --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/sdn/clientset/release_v3_6" + v1sdn "github.com/openshift/origin/pkg/sdn/clientset/release_v3_6/typed/sdn/v1" + fakev1sdn "github.com/openshift/origin/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// SdnV1 retrieves the SdnV1Client +func (c *Clientset) SdnV1() v1sdn.SdnV1Interface { + return &fakev1sdn.FakeSdnV1{Fake: &c.Fake} +} + +// Sdn retrieves the SdnV1Client +func (c *Clientset) Sdn() v1sdn.SdnV1Interface { + return &fakev1sdn.FakeSdnV1{Fake: &c.Fake} +} diff --git a/pkg/sdn/clientset/release_v3_6/fake/doc.go b/pkg/sdn/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..69bcde18ea93 --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/v1] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/clusternetwork.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/clusternetwork.go new file mode 100644 index 000000000000..886757608531 --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/clusternetwork.go @@ -0,0 +1,137 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/sdn/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// ClusterNetworksGetter has a method to return a ClusterNetworkInterface. +// A group's client should implement this interface. +type ClusterNetworksGetter interface { + ClusterNetworks(namespace string) ClusterNetworkInterface +} + +// ClusterNetworkInterface has methods to work with ClusterNetwork resources. +type ClusterNetworkInterface interface { + Create(*v1.ClusterNetwork) (*v1.ClusterNetwork, error) + Update(*v1.ClusterNetwork) (*v1.ClusterNetwork, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.ClusterNetwork, error) + List(opts api_v1.ListOptions) (*v1.ClusterNetworkList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.ClusterNetwork, err error) + ClusterNetworkExpansion +} + +// clusterNetworks implements ClusterNetworkInterface +type clusterNetworks struct { + client restclient.Interface + ns string +} + +// newClusterNetworks returns a ClusterNetworks +func newClusterNetworks(c *SdnV1Client, namespace string) *clusterNetworks { + return &clusterNetworks{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a clusterNetwork and creates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *clusterNetworks) Create(clusterNetwork *v1.ClusterNetwork) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusternetworks"). + Body(clusterNetwork). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterNetwork and updates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *clusterNetworks) Update(clusterNetwork *v1.ClusterNetwork) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusternetworks"). + Name(clusterNetwork.Name). + Body(clusterNetwork). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterNetwork and deletes it. Returns an error if one occurs. +func (c *clusterNetworks) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusternetworks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterNetworks) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusternetworks"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the clusterNetwork, and returns the corresponding clusterNetwork object, and an error if there is any. +func (c *clusterNetworks) Get(name string) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusternetworks"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterNetworks that match those selectors. +func (c *clusterNetworks) List(opts api_v1.ListOptions) (result *v1.ClusterNetworkList, err error) { + result = &v1.ClusterNetworkList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusternetworks"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterNetworks. +func (c *clusterNetworks) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("clusternetworks"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched clusterNetwork. +func (c *clusterNetworks) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusternetworks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/doc.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/doc.go new file mode 100644 index 000000000000..682df8aeb91a --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/v1] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/doc.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/doc.go new file mode 100644 index 000000000000..d4f8cff92c48 --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/sdn/clientset --go-header-file=hack/boilerplate.txt --group=sdn --input=[api/v1] --input-base=github.com/openshift/origin/pkg/sdn --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/fake_clusternetwork.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/fake_clusternetwork.go new file mode 100644 index 000000000000..b1d2ae7da8fd --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/fake_clusternetwork.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/sdn/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeClusterNetworks implements ClusterNetworkInterface +type FakeClusterNetworks struct { + Fake *FakeSdnV1 + ns string +} + +var clusternetworksResource = unversioned.GroupVersionResource{Group: "network.openshift.io", Version: "v1", Resource: "clusternetworks"} + +func (c *FakeClusterNetworks) Create(clusterNetwork *v1.ClusterNetwork) (result *v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(clusternetworksResource, c.ns, clusterNetwork), &v1.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterNetwork), err +} + +func (c *FakeClusterNetworks) Update(clusterNetwork *v1.ClusterNetwork) (result *v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(clusternetworksResource, c.ns, clusterNetwork), &v1.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterNetwork), err +} + +func (c *FakeClusterNetworks) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(clusternetworksResource, c.ns, name), &v1.ClusterNetwork{}) + + return err +} + +func (c *FakeClusterNetworks) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(clusternetworksResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.ClusterNetworkList{}) + return err +} + +func (c *FakeClusterNetworks) Get(name string) (result *v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(clusternetworksResource, c.ns, name), &v1.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterNetwork), err +} + +func (c *FakeClusterNetworks) List(opts api_v1.ListOptions) (result *v1.ClusterNetworkList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(clusternetworksResource, c.ns, opts), &v1.ClusterNetworkList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ClusterNetworkList{} + for _, item := range obj.(*v1.ClusterNetworkList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterNetworks. +func (c *FakeClusterNetworks) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(clusternetworksResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched clusterNetwork. +func (c *FakeClusterNetworks) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(clusternetworksResource, c.ns, name, data, subresources...), &v1.ClusterNetwork{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterNetwork), err +} diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/fake_sdn_client.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/fake_sdn_client.go new file mode 100644 index 000000000000..ec72b03705aa --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/fake/fake_sdn_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/sdn/clientset/release_v3_6/typed/sdn/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeSdnV1 struct { + *core.Fake +} + +func (c *FakeSdnV1) ClusterNetworks(namespace string) v1.ClusterNetworkInterface { + return &FakeClusterNetworks{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSdnV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/generated_expansion.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/generated_expansion.go new file mode 100644 index 000000000000..7aa2a123fc60 --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type ClusterNetworkExpansion interface{} diff --git a/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/sdn_client.go b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/sdn_client.go new file mode 100644 index 000000000000..5320fa847f29 --- /dev/null +++ b/pkg/sdn/clientset/release_v3_6/typed/sdn/v1/sdn_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type SdnV1Interface interface { + RESTClient() restclient.Interface + ClusterNetworksGetter +} + +// SdnV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type SdnV1Client struct { + restClient restclient.Interface +} + +func (c *SdnV1Client) ClusterNetworks(namespace string) ClusterNetworkInterface { + return newClusterNetworks(c, namespace) +} + +// NewForConfig creates a new SdnV1Client for the given config. +func NewForConfig(c *restclient.Config) (*SdnV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &SdnV1Client{client}, nil +} + +// NewForConfigOrDie creates a new SdnV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *SdnV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SdnV1Client for the given RESTClient. +func New(c restclient.Interface) *SdnV1Client { + return &SdnV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("network.openshift.io/v1") + if err != nil { + return err + } + // if network.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("network.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SdnV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/security/api/doc.go b/pkg/security/api/doc.go index 9f6c967cfa9e..6ace80757d01 100644 --- a/pkg/security/api/doc.go +++ b/pkg/security/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=security.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/security/api/v1/doc.go b/pkg/security/api/v1/doc.go index 6a49a84398e1..3b0b6935fc09 100644 --- a/pkg/security/api/v1/doc.go +++ b/pkg/security/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=security.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/template/api/constants.go b/pkg/template/api/constants.go new file mode 100644 index 000000000000..54543475af5c --- /dev/null +++ b/pkg/template/api/constants.go @@ -0,0 +1,46 @@ +package api + +// annotation keys +const ( + // IconClassAnnotation is the rss class of an icon representing a template + IconClassAnnotation = "iconClass" + + // LongDescriptionAnnotation is a template's long description + LongDescriptionAnnotation = "template.openshift.io/long-description" + + // ProviderDisplayNameAnnotation is the name of a template provider, e.g. + // "Red Hat, Inc." + ProviderDisplayNameAnnotation = "template.openshift.io/provider-display-name" + + // DocumentationURLAnnotation is the url where documentation associated with + // a template can be found + DocumentationURLAnnotation = "template.openshift.io/documentation-url" + + // SupportURLAnnotation is the url where support for a template can be found + SupportURLAnnotation = "template.openshift.io/support-url" + + // TemplateInstanceLabel is used to label every object created by the + // TemplateInstance API. + TemplateInstanceLabel = "template.openshift.io/template-instance" + + // NamespaceParameterKey is the name of the key in the Open Service Broker API + // ProvisionRequest Parameters object where we receive the name of the + // namespace into which a template should be provisioned. The '/' and '.' + // characters in the name happen to make this an invalid template parameter + // name so there is no immediate overlap with passed template parameters in + // the same object. + NamespaceParameterKey = "template.openshift.io/namespace" + + // RequesterUsernameParameterKey is the name of the key in the Open Service + // Broker API ProvisionRequest Parameters object where we receive the user + // name which will be impersonated during template provisioning. See above + // note. + RequesterUsernameParameterKey = "template.openshift.io/requester-username" + + // ServiceBrokerRoot is the API root of the template service broker. + ServiceBrokerRoot = "/brokers/template.openshift.io" + + // ServiceMetadataIconClass is the key for the template iconClass as returned + // in the services.metadata map from a service broker catalog response + ServiceMetadataIconClass = "template.openshift.io/iconClass" +) diff --git a/pkg/template/api/doc.go b/pkg/template/api/doc.go index 9f6c967cfa9e..2f389ec7b3d2 100644 --- a/pkg/template/api/doc.go +++ b/pkg/template/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=template.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/template/api/fields.go b/pkg/template/api/fields.go index 65f88d5b8070..f73be918aeba 100644 --- a/pkg/template/api/fields.go +++ b/pkg/template/api/fields.go @@ -9,3 +9,20 @@ func TemplateToSelectableFields(template *Template) fields.Set { "metadata.name": template.Name, } } + +// TemplateInstanceToSelectableFields returns a label set that represents the object +// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc +func TemplateInstanceToSelectableFields(templateInstance *TemplateInstance) fields.Set { + return fields.Set{ + "metadata.name": templateInstance.Name, + "metadata.namespace": templateInstance.Namespace, + } +} + +// BrokerTemplateInstanceToSelectableFields returns a label set that represents the object +// changes to the returned keys require registering conversions for existing versions using Scheme.AddFieldLabelConversionFunc +func BrokerTemplateInstanceToSelectableFields(brokertemplateinstance *BrokerTemplateInstance) fields.Set { + return fields.Set{ + "metadata.name": brokertemplateinstance.Name, + } +} diff --git a/pkg/template/api/install/apigroup.go b/pkg/template/api/install/apigroup.go index dc1504ad064b..d4b7767f9ab3 100644 --- a/pkg/template/api/install/apigroup.go +++ b/pkg/template/api/install/apigroup.go @@ -2,6 +2,7 @@ package install import ( "k8s.io/kubernetes/pkg/apimachinery/announced" + "k8s.io/kubernetes/pkg/util/sets" "github.com/openshift/origin/pkg/template/api" "github.com/openshift/origin/pkg/template/api/v1" @@ -14,6 +15,7 @@ func init() { VersionPreferenceOrder: []string{v1.LegacySchemeGroupVersion.Version}, ImportPrefix: importPrefix, AddInternalObjectsToScheme: api.AddToScheme, + RootScopedKinds: sets.NewString("BrokerTemplateInstance"), }, announced.VersionToSchemeFunc{ v1.LegacySchemeGroupVersion.Version: v1.AddToScheme, diff --git a/pkg/template/api/install/install.go b/pkg/template/api/install/install.go index 4e9313c77c0a..1282c0b58631 100644 --- a/pkg/template/api/install/install.go +++ b/pkg/template/api/install/install.go @@ -92,7 +92,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper for i := len(externalVersions) - 1; i >= 0; i-- { worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) } - rootScoped := sets.NewString() + rootScoped := sets.NewString("BrokerTemplateInstance") ignoredKinds := sets.NewString() return kapi.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) } diff --git a/pkg/template/api/register.go b/pkg/template/api/register.go index f0758c31c0ab..062dca927b92 100644 --- a/pkg/template/api/register.go +++ b/pkg/template/api/register.go @@ -60,6 +60,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { types := []runtime.Object{ &Template{}, &TemplateList{}, + &TemplateInstance{}, + &TemplateInstanceList{}, + &BrokerTemplateInstance{}, + &BrokerTemplateInstanceList{}, } scheme.AddKnownTypes(SchemeGroupVersion, append(types, diff --git a/pkg/template/api/types.go b/pkg/template/api/types.go index 37a0192823e8..4ebfec1b1c28 100644 --- a/pkg/template/api/types.go +++ b/pkg/template/api/types.go @@ -75,3 +75,123 @@ type Parameter struct { // Optional: Indicates the parameter must have a value. Defaults to false. Required bool } + +// +genclient=true + +// TemplateInstance requests and records the instantiation of a Template. +// TemplateInstance is part of an experimental API. +type TemplateInstance struct { + unversioned.TypeMeta + kapi.ObjectMeta + + // Spec describes the desired state of this TemplateInstance. + Spec TemplateInstanceSpec + + // Status describes the current state of this TemplateInstance. + Status TemplateInstanceStatus +} + +// TemplateInstanceSpec describes the desired state of a TemplateInstance. +type TemplateInstanceSpec struct { + // Template is a full copy of the template for instantiation. + Template Template + + // Secret is a reference to a Secret object containing the necessary + // template parameters. + Secret kapi.LocalObjectReference + + // Requestor holds the identity of the agent requesting the template + // instantiation. + Requestor *TemplateInstanceRequestor +} + +// TemplateInstanceRequestor holds the identity of an agent requesting a +// template instantiation. +type TemplateInstanceRequestor struct { + // Username is the username of the agent requesting a template instantiation. + Username string +} + +// TemplateInstanceStatus describes the current state of a TemplateInstance. +type TemplateInstanceStatus struct { + // Conditions represent the latest available observations of a + // TemplateInstance's current state. + Conditions []TemplateInstanceCondition +} + +// TemplateInstanceCondition contains condition information for a +// TemplateInstance. +type TemplateInstanceCondition struct { + // Type of the condition, currently Ready or InstantiateFailure. + Type TemplateInstanceConditionType + // Status of the condition, one of True, False or Unknown. + Status kapi.ConditionStatus + // LastTransitionTime is the last time a condition status transitioned from + // one state to another. + LastTransitionTime unversioned.Time + // Reason is a brief machine readable explanation for the condition's last + // transition. + Reason string + // Message is a human readable description of the details of the last + // transition, complementing reason. + Message string +} + +// TemplateInstanceConditionType is the type of condition pertaining to a +// TemplateInstance. +type TemplateInstanceConditionType string + +const ( + // TemplateInstanceReady indicates the readiness of the template + // instantiation. + TemplateInstanceReady TemplateInstanceConditionType = "Ready" + // TemplateInstanceInstantiateFailure indicates the failure of the template + // instantiation + TemplateInstanceInstantiateFailure TemplateInstanceConditionType = "InstantiateFailure" +) + +// TemplateInstanceList is a list of TemplateInstance objects. +type TemplateInstanceList struct { + unversioned.TypeMeta + unversioned.ListMeta + + // Items is a list of Templateinstances + Items []TemplateInstance +} + +// +genclient=true +// +nonNamespaced=true + +// BrokerTemplateInstance holds the service broker-related state associated with +// a TemplateInstance. BrokerTemplateInstance is part of an experimental API. +type BrokerTemplateInstance struct { + unversioned.TypeMeta + kapi.ObjectMeta + + // Spec describes the state of this BrokerTemplateInstance. + Spec BrokerTemplateInstanceSpec +} + +// BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance. +type BrokerTemplateInstanceSpec struct { + // TemplateInstance is a reference to a TemplateInstance object residing + // in a namespace. + TemplateInstance kapi.ObjectReference + + // Secret is a reference to a Secret object residing in a namespace, + // containing the necessary template parameters. + Secret kapi.ObjectReference + + // BindingIDs is a list of 'binding_id's provided during successive bind + // calls to the template service broker. + BindingIDs []string +} + +// BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects. +type BrokerTemplateInstanceList struct { + unversioned.TypeMeta + unversioned.ListMeta + + // Items is a list of BrokerTemplateInstances + Items []BrokerTemplateInstance +} diff --git a/pkg/template/api/v1/conversion.go b/pkg/template/api/v1/conversion.go index 1d863f431c63..21bc9909f463 100644 --- a/pkg/template/api/v1/conversion.go +++ b/pkg/template/api/v1/conversion.go @@ -9,9 +9,26 @@ import ( ) func addConversionFuncs(scheme *runtime.Scheme) error { - return scheme.AddFieldLabelConversionFunc("v1", "Template", + if err := scheme.AddFieldLabelConversionFunc("v1", "Template", oapi.GetFieldLabelConversionFunc(api.TemplateToSelectableFields(&api.Template{}), nil), - ) + ); err != nil { + return err + } + + if err := scheme.AddFieldLabelConversionFunc("v1", "TemplateInstance", + oapi.GetFieldLabelConversionFunc(api.TemplateInstanceToSelectableFields(&api.TemplateInstance{}), nil), + ); err != nil { + return err + } + + if err := scheme.AddFieldLabelConversionFunc("v1", "BrokerTemplateInstance", + oapi.GetFieldLabelConversionFunc(api.BrokerTemplateInstanceToSelectableFields(&api.BrokerTemplateInstance{}), nil), + ); err != nil { + return err + } + + return nil + } var _ runtime.NestedObjectDecoder = &Template{} diff --git a/pkg/template/api/v1/doc.go b/pkg/template/api/v1/doc.go index 1284a789f37f..e99b399bb933 100644 --- a/pkg/template/api/v1/doc.go +++ b/pkg/template/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=template.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/template/api/v1/generated.pb.go b/pkg/template/api/v1/generated.pb.go index ac9a6685b06f..eb570a28f674 100644 --- a/pkg/template/api/v1/generated.pb.go +++ b/pkg/template/api/v1/generated.pb.go @@ -9,8 +9,17 @@ github.com/openshift/origin/pkg/template/api/v1/generated.proto It has these top-level messages: + BrokerTemplateInstance + BrokerTemplateInstanceList + BrokerTemplateInstanceSpec Parameter Template + TemplateInstance + TemplateInstanceCondition + TemplateInstanceList + TemplateInstanceRequestor + TemplateInstanceSpec + TemplateInstanceStatus TemplateList */ package v1 @@ -19,6 +28,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" +import k8s_io_kubernetes_pkg_api_v1 "k8s.io/kubernetes/pkg/api/v1" import k8s_io_kubernetes_pkg_runtime "k8s.io/kubernetes/pkg/runtime" import strings "strings" @@ -36,23 +46,197 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. const _ = proto.GoGoProtoPackageIsVersion1 +func (m *BrokerTemplateInstance) Reset() { *m = BrokerTemplateInstance{} } +func (*BrokerTemplateInstance) ProtoMessage() {} +func (*BrokerTemplateInstance) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } + +func (m *BrokerTemplateInstanceList) Reset() { *m = BrokerTemplateInstanceList{} } +func (*BrokerTemplateInstanceList) ProtoMessage() {} +func (*BrokerTemplateInstanceList) Descriptor() ([]byte, []int) { + return fileDescriptorGenerated, []int{1} +} + +func (m *BrokerTemplateInstanceSpec) Reset() { *m = BrokerTemplateInstanceSpec{} } +func (*BrokerTemplateInstanceSpec) ProtoMessage() {} +func (*BrokerTemplateInstanceSpec) Descriptor() ([]byte, []int) { + return fileDescriptorGenerated, []int{2} +} + func (m *Parameter) Reset() { *m = Parameter{} } func (*Parameter) ProtoMessage() {} -func (*Parameter) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } +func (*Parameter) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} } func (m *Template) Reset() { *m = Template{} } func (*Template) ProtoMessage() {} -func (*Template) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} } +func (*Template) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{4} } + +func (m *TemplateInstance) Reset() { *m = TemplateInstance{} } +func (*TemplateInstance) ProtoMessage() {} +func (*TemplateInstance) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{5} } + +func (m *TemplateInstanceCondition) Reset() { *m = TemplateInstanceCondition{} } +func (*TemplateInstanceCondition) ProtoMessage() {} +func (*TemplateInstanceCondition) Descriptor() ([]byte, []int) { + return fileDescriptorGenerated, []int{6} +} + +func (m *TemplateInstanceList) Reset() { *m = TemplateInstanceList{} } +func (*TemplateInstanceList) ProtoMessage() {} +func (*TemplateInstanceList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{7} } + +func (m *TemplateInstanceRequestor) Reset() { *m = TemplateInstanceRequestor{} } +func (*TemplateInstanceRequestor) ProtoMessage() {} +func (*TemplateInstanceRequestor) Descriptor() ([]byte, []int) { + return fileDescriptorGenerated, []int{8} +} + +func (m *TemplateInstanceSpec) Reset() { *m = TemplateInstanceSpec{} } +func (*TemplateInstanceSpec) ProtoMessage() {} +func (*TemplateInstanceSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{9} } + +func (m *TemplateInstanceStatus) Reset() { *m = TemplateInstanceStatus{} } +func (*TemplateInstanceStatus) ProtoMessage() {} +func (*TemplateInstanceStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{10} } func (m *TemplateList) Reset() { *m = TemplateList{} } func (*TemplateList) ProtoMessage() {} -func (*TemplateList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} } +func (*TemplateList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{11} } func init() { + proto.RegisterType((*BrokerTemplateInstance)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.BrokerTemplateInstance") + proto.RegisterType((*BrokerTemplateInstanceList)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.BrokerTemplateInstanceList") + proto.RegisterType((*BrokerTemplateInstanceSpec)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.BrokerTemplateInstanceSpec") proto.RegisterType((*Parameter)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.Parameter") proto.RegisterType((*Template)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.Template") + proto.RegisterType((*TemplateInstance)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateInstance") + proto.RegisterType((*TemplateInstanceCondition)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateInstanceCondition") + proto.RegisterType((*TemplateInstanceList)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateInstanceList") + proto.RegisterType((*TemplateInstanceRequestor)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateInstanceRequestor") + proto.RegisterType((*TemplateInstanceSpec)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateInstanceSpec") + proto.RegisterType((*TemplateInstanceStatus)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateInstanceStatus") proto.RegisterType((*TemplateList)(nil), "proxy-git.cwkhome.fun.openshift.origin.pkg.template.api.v1.TemplateList") } +func (m *BrokerTemplateInstance) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *BrokerTemplateInstance) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) + n1, err := m.ObjectMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n1 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n2, err := m.Spec.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n2 + return i, nil +} + +func (m *BrokerTemplateInstanceList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *BrokerTemplateInstanceList) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) + n3, err := m.ListMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n3 + if len(m.Items) > 0 { + for _, msg := range m.Items { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *BrokerTemplateInstanceSpec) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *BrokerTemplateInstanceSpec) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.TemplateInstance.Size())) + n4, err := m.TemplateInstance.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n4 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Secret.Size())) + n5, err := m.Secret.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n5 + if len(m.BindingIDs) > 0 { + for _, s := range m.BindingIDs { + data[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } + return i, nil +} + func (m *Parameter) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) @@ -121,11 +305,11 @@ func (m *Template) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n1, err := m.ObjectMeta.MarshalTo(data[i:]) + n6, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n1 + i += n6 data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(len(m.Message))) @@ -174,7 +358,7 @@ func (m *Template) MarshalTo(data []byte) (int, error) { return i, nil } -func (m *TemplateList) Marshal() (data []byte, err error) { +func (m *TemplateInstance) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) @@ -184,7 +368,91 @@ func (m *TemplateList) Marshal() (data []byte, err error) { return data[:n], nil } -func (m *TemplateList) MarshalTo(data []byte) (int, error) { +func (m *TemplateInstance) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) + n7, err := m.ObjectMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n7 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) + n8, err := m.Spec.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n8 + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) + n9, err := m.Status.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n9 + return i, nil +} + +func (m *TemplateInstanceCondition) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *TemplateInstanceCondition) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Type))) + i += copy(data[i:], m.Type) + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Status))) + i += copy(data[i:], m.Status) + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.LastTransitionTime.Size())) + n10, err := m.LastTransitionTime.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n10 + data[i] = 0x22 + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Reason))) + i += copy(data[i:], m.Reason) + data[i] = 0x2a + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Message))) + i += copy(data[i:], m.Message) + return i, nil +} + +func (m *TemplateInstanceList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *TemplateInstanceList) MarshalTo(data []byte) (int, error) { var i int _ = i var l int @@ -192,11 +460,11 @@ func (m *TemplateList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n2, err := m.ListMeta.MarshalTo(data[i:]) + n11, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n2 + i += n11 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -212,67 +480,241 @@ func (m *TemplateList) MarshalTo(data []byte) (int, error) { return i, nil } -func encodeFixed64Generated(data []byte, offset int, v uint64) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - data[offset+4] = uint8(v >> 32) - data[offset+5] = uint8(v >> 40) - data[offset+6] = uint8(v >> 48) - data[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Generated(data []byte, offset int, v uint32) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintGenerated(data []byte, offset int, v uint64) int { - for v >= 1<<7 { - data[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *TemplateInstanceRequestor) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err } - data[offset] = uint8(v) - return offset + 1 + return data[:n], nil } -func (m *Parameter) Size() (n int) { + +func (m *TemplateInstanceRequestor) MarshalTo(data []byte) (int, error) { + var i int + _ = i var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.DisplayName) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Description) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Value) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Generate) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.From) - n += 1 + l + sovGenerated(uint64(l)) - n += 2 - return n + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Username))) + i += copy(data[i:], m.Username) + return i, nil } -func (m *Template) Size() (n int) { +func (m *TemplateInstanceSpec) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *TemplateInstanceSpec) MarshalTo(data []byte) (int, error) { + var i int + _ = i var l int _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Objects) > 0 { - for _, e := range m.Objects { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.Template.Size())) + n12, err := m.Template.MarshalTo(data[i:]) + if err != nil { + return 0, err } - if len(m.Parameters) > 0 { - for _, e := range m.Parameters { + i += n12 + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(m.Secret.Size())) + n13, err := m.Secret.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n13 + if m.Requestor != nil { + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.Requestor.Size())) + n14, err := m.Requestor.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n14 + } + return i, nil +} + +func (m *TemplateInstanceStatus) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *TemplateInstanceStatus) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Conditions) > 0 { + for _, msg := range m.Conditions { + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *TemplateList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *TemplateList) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) + n15, err := m.ListMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n15 + if len(m.Items) > 0 { + for _, msg := range m.Items { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func encodeFixed64Generated(data []byte, offset int, v uint64) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + data[offset+4] = uint8(v >> 32) + data[offset+5] = uint8(v >> 40) + data[offset+6] = uint8(v >> 48) + data[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Generated(data []byte, offset int, v uint32) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintGenerated(data []byte, offset int, v uint64) int { + for v >= 1<<7 { + data[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + data[offset] = uint8(v) + return offset + 1 +} +func (m *BrokerTemplateInstance) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *BrokerTemplateInstanceList) Size() (n int) { + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *BrokerTemplateInstanceSpec) Size() (n int) { + var l int + _ = l + l = m.TemplateInstance.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Secret.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.BindingIDs) > 0 { + for _, s := range m.BindingIDs { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Parameter) Size() (n int) { + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.DisplayName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Description) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Value) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Generate) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.From) + n += 1 + l + sovGenerated(uint64(l)) + n += 2 + return n +} + +func (m *Template) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Objects) > 0 { + for _, e := range m.Objects { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Parameters) > 0 { + for _, e := range m.Parameters { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } @@ -288,6 +730,82 @@ func (m *Template) Size() (n int) { return n } +func (m *TemplateInstance) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TemplateInstanceCondition) Size() (n int) { + var l int + _ = l + l = len(m.Type) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Status) + n += 1 + l + sovGenerated(uint64(l)) + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TemplateInstanceList) Size() (n int) { + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *TemplateInstanceRequestor) Size() (n int) { + var l int + _ = l + l = len(m.Username) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TemplateInstanceSpec) Size() (n int) { + var l int + _ = l + l = m.Template.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Secret.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.Requestor != nil { + l = m.Requestor.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *TemplateInstanceStatus) Size() (n int) { + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + func (m *TemplateList) Size() (n int) { var l int _ = l @@ -315,6 +833,40 @@ func sovGenerated(x uint64) (n int) { func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (this *BrokerTemplateInstance) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BrokerTemplateInstance{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "BrokerTemplateInstanceSpec", "BrokerTemplateInstanceSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *BrokerTemplateInstanceList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BrokerTemplateInstanceList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "BrokerTemplateInstance", "BrokerTemplateInstance", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *BrokerTemplateInstanceSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BrokerTemplateInstanceSpec{`, + `TemplateInstance:` + strings.Replace(strings.Replace(this.TemplateInstance.String(), "ObjectReference", "k8s_io_kubernetes_pkg_api_v1.ObjectReference", 1), `&`, ``, 1) + `,`, + `Secret:` + strings.Replace(strings.Replace(this.Secret.String(), "ObjectReference", "k8s_io_kubernetes_pkg_api_v1.ObjectReference", 1), `&`, ``, 1) + `,`, + `BindingIDs:` + fmt.Sprintf("%v", this.BindingIDs) + `,`, + `}`, + }, "") + return s +} func (this *Parameter) String() string { if this == nil { return "nil" @@ -344,37 +896,1132 @@ func (this *Template) String() string { for _, k := range keysForObjectLabels { mapStringForObjectLabels += fmt.Sprintf("%v: %v,", k, this.ObjectLabels[k]) } - mapStringForObjectLabels += "}" - s := strings.Join([]string{`&Template{`, - `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `Objects:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Objects), "RawExtension", "k8s_io_kubernetes_pkg_runtime.RawExtension", 1), `&`, ``, 1) + `,`, - `Parameters:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Parameters), "Parameter", "Parameter", 1), `&`, ``, 1) + `,`, - `ObjectLabels:` + mapStringForObjectLabels + `,`, - `}`, - }, "") - return s -} -func (this *TemplateList) String() string { - if this == nil { - return "nil" + mapStringForObjectLabels += "}" + s := strings.Join([]string{`&Template{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `Objects:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Objects), "RawExtension", "k8s_io_kubernetes_pkg_runtime.RawExtension", 1), `&`, ``, 1) + `,`, + `Parameters:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Parameters), "Parameter", "Parameter", 1), `&`, ``, 1) + `,`, + `ObjectLabels:` + mapStringForObjectLabels + `,`, + `}`, + }, "") + return s +} +func (this *TemplateInstance) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateInstance{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "TemplateInstanceSpec", "TemplateInstanceSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "TemplateInstanceStatus", "TemplateInstanceStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateInstanceCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateInstanceCondition{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(this.LastTransitionTime.String(), "Time", "k8s_io_kubernetes_pkg_api_unversioned.Time", 1), `&`, ``, 1) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateInstanceList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateInstanceList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "TemplateInstance", "TemplateInstance", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateInstanceRequestor) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateInstanceRequestor{`, + `Username:` + fmt.Sprintf("%v", this.Username) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateInstanceSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateInstanceSpec{`, + `Template:` + strings.Replace(strings.Replace(this.Template.String(), "Template", "Template", 1), `&`, ``, 1) + `,`, + `Secret:` + strings.Replace(strings.Replace(this.Secret.String(), "LocalObjectReference", "k8s_io_kubernetes_pkg_api_v1.LocalObjectReference", 1), `&`, ``, 1) + `,`, + `Requestor:` + strings.Replace(fmt.Sprintf("%v", this.Requestor), "TemplateInstanceRequestor", "TemplateInstanceRequestor", 1) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateInstanceStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateInstanceStatus{`, + `Conditions:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Conditions), "TemplateInstanceCondition", "TemplateInstanceCondition", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "Template", "Template", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *BrokerTemplateInstance) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BrokerTemplateInstance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BrokerTemplateInstance: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BrokerTemplateInstanceList) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BrokerTemplateInstanceList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BrokerTemplateInstanceList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, BrokerTemplateInstance{}) + if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BrokerTemplateInstanceSpec) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BrokerTemplateInstanceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BrokerTemplateInstanceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TemplateInstance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TemplateInstance.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Secret", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Secret.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BindingIDs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BindingIDs = append(m.BindingIDs, string(data[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Parameter) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Parameter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayName = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Generate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Generate = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Required", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Required = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Template) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Template: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Template: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Objects", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Objects = append(m.Objects, k8s_io_kubernetes_pkg_runtime.RawExtension{}) + if err := m.Objects[len(m.Objects)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parameters = append(m.Parameters, Parameter{}) + if err := m.Parameters[len(m.Parameters)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectLabels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(data[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(data[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + if m.ObjectLabels == nil { + m.ObjectLabels = make(map[string]string) + } + m.ObjectLabels[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - s := strings.Join([]string{`&TemplateList{`, - `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "Template", "Template", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s + return nil } -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" +func (m *TemplateInstance) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateInstance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateInstance: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *Parameter) Unmarshal(data []byte) error { +func (m *TemplateInstanceCondition) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { @@ -397,15 +2044,15 @@ func (m *Parameter) Unmarshal(data []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Parameter: wiretype end group for non-group") + return fmt.Errorf("proto: TemplateInstanceCondition: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TemplateInstanceCondition: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -430,11 +2077,11 @@ func (m *Parameter) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(data[iNdEx:postIndex]) + m.Type = TemplateInstanceConditionType(data[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DisplayName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -459,11 +2106,41 @@ func (m *Parameter) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DisplayName = string(data[iNdEx:postIndex]) + m.Status = k8s_io_kubernetes_pkg_api_v1.ConditionStatus(data[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTransitionTime.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -488,11 +2165,11 @@ func (m *Parameter) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(data[iNdEx:postIndex]) + m.Reason = string(data[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -517,13 +2194,63 @@ func (m *Parameter) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = string(data[iNdEx:postIndex]) + m.Message = string(data[iNdEx:postIndex]) iNdEx = postIndex - case 5: + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateInstanceList) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateInstanceList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateInstanceList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Generate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -533,26 +2260,27 @@ func (m *Parameter) Unmarshal(data []byte) error { } b := data[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - m.Generate = string(data[iNdEx:postIndex]) + if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -562,41 +2290,23 @@ func (m *Parameter) Unmarshal(data []byte) error { } b := data[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - m.From = string(data[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Required", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } + m.Items = append(m.Items, TemplateInstance{}) + if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err } - m.Required = bool(v != 0) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(data[iNdEx:]) @@ -618,7 +2328,7 @@ func (m *Parameter) Unmarshal(data []byte) error { } return nil } -func (m *Template) Unmarshal(data []byte) error { +func (m *TemplateInstanceRequestor) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { @@ -641,17 +2351,17 @@ func (m *Template) Unmarshal(data []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Template: wiretype end group for non-group") + return fmt.Errorf("proto: TemplateInstanceRequestor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Template: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TemplateInstanceRequestor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -661,54 +2371,74 @@ func (m *Template) Unmarshal(data []byte) error { } b := data[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + m.Username = string(data[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + if skippy < 0 { + return ErrInvalidLengthGenerated } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateInstanceSpec) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - postIndex := iNdEx + intStringLen - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Message = string(data[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateInstanceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateInstanceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Objects", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Template", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -732,14 +2462,13 @@ func (m *Template) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Objects = append(m.Objects, k8s_io_kubernetes_pkg_runtime.RawExtension{}) - if err := m.Objects[len(m.Objects)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + if err := m.Template.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Secret", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -763,14 +2492,13 @@ func (m *Template) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Parameters = append(m.Parameters, Parameter{}) - if err := m.Parameters[len(m.Parameters)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + if err := m.Secret.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectLabels", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Requestor", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -794,62 +2522,68 @@ func (m *Template) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } + if m.Requestor == nil { + m.Requestor = &TemplateInstanceRequestor{} } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } + if err := m.Requestor.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { return ErrInvalidLengthGenerated } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - mapkey := string(data[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - var valuekey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateInstanceStatus) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - var stringLenmapvalue uint64 + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateInstanceStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateInstanceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -859,25 +2593,22 @@ func (m *Template) Unmarshal(data []byte) error { } b := data[iNdEx] iNdEx++ - stringLenmapvalue |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue > l { + postIndex := iNdEx + msglen + if postIndex > l { return io.ErrUnexpectedEOF } - mapvalue := string(data[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - if m.ObjectLabels == nil { - m.ObjectLabels = make(map[string]string) + m.Conditions = append(m.Conditions, TemplateInstanceCondition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err } - m.ObjectLabels[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -1117,46 +2848,74 @@ var ( ) var fileDescriptorGenerated = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0xe6, 0x47, 0x93, 0x4e, 0x2a, 0x96, 0xb1, 0x87, 0x25, 0x87, 0x6d, 0xa8, 0x1e, 0x22, - 0xb6, 0xb3, 0xa4, 0x50, 0x68, 0x7b, 0x11, 0x82, 0x55, 0x84, 0x56, 0x65, 0x90, 0x22, 0x82, 0xc2, - 0xa4, 0x79, 0xdd, 0x8e, 0xc9, 0xee, 0xac, 0x33, 0xb3, 0xd1, 0xde, 0xbc, 0x79, 0xf5, 0x2f, 0xf2, - 0xdc, 0x8b, 0xd0, 0xa3, 0xa7, 0x62, 0xe3, 0x3f, 0x22, 0x3b, 0xfb, 0xd3, 0xa6, 0x15, 0xea, 0x6d, - 0xe7, 0xbd, 0xef, 0x7d, 0xdf, 0x7b, 0xf3, 0xbe, 0x59, 0xf4, 0xd8, 0xe3, 0xfa, 0x24, 0x1a, 0x92, - 0x23, 0xe1, 0xbb, 0x22, 0x84, 0x40, 0x9d, 0xf0, 0x63, 0xed, 0x0a, 0xc9, 0x3d, 0x1e, 0xb8, 0xe1, - 0xd8, 0x73, 0x35, 0xf8, 0xe1, 0x84, 0x69, 0x70, 0x59, 0xc8, 0xdd, 0x69, 0xdf, 0xf5, 0x20, 0x00, - 0xc9, 0x34, 0x8c, 0x48, 0x28, 0x85, 0x16, 0xd8, 0x2d, 0x08, 0x48, 0x4e, 0x40, 0x12, 0x02, 0x12, - 0x8e, 0x3d, 0x92, 0x11, 0x10, 0x16, 0x72, 0x32, 0xed, 0x77, 0x36, 0x4a, 0x8a, 0x9e, 0xf0, 0x84, - 0x6b, 0x78, 0x86, 0xd1, 0xb1, 0x39, 0x99, 0x83, 0xf9, 0x4a, 0xf8, 0x3b, 0x5b, 0xe3, 0x6d, 0x45, - 0xb8, 0x70, 0xc7, 0xd1, 0x10, 0x64, 0x00, 0x1a, 0x94, 0x69, 0x2b, 0xee, 0x26, 0x0a, 0xa6, 0x20, - 0x15, 0x17, 0x01, 0x8c, 0xae, 0xb6, 0xd5, 0x59, 0xbf, 0xb9, 0x6c, 0x7e, 0x88, 0xce, 0xc6, 0xf5, - 0x68, 0x19, 0x05, 0x9a, 0xfb, 0x30, 0x07, 0xef, 0x5f, 0x0f, 0x8f, 0x34, 0x9f, 0xb8, 0x3c, 0xd0, - 0x4a, 0xcb, 0xab, 0x25, 0x6b, 0xdf, 0xab, 0x68, 0xf1, 0x15, 0x93, 0xcc, 0x07, 0x0d, 0x12, 0x77, - 0x51, 0x3d, 0x60, 0x3e, 0xd8, 0x56, 0xd7, 0xea, 0x2d, 0x0e, 0x96, 0xce, 0x2e, 0x56, 0x2b, 0xb3, - 0x8b, 0xd5, 0xfa, 0x0b, 0xe6, 0x03, 0x35, 0x19, 0xbc, 0x85, 0xda, 0x23, 0xae, 0xc2, 0x09, 0x3b, - 0x8d, 0x83, 0x76, 0xd5, 0x00, 0xef, 0xa5, 0xc0, 0xf6, 0x93, 0x22, 0x45, 0xcb, 0x38, 0x53, 0x06, - 0xea, 0x48, 0xf2, 0x50, 0x73, 0x11, 0xd8, 0xb5, 0x2b, 0x65, 0x45, 0x8a, 0x96, 0x71, 0xf8, 0x3e, - 0x6a, 0x4c, 0xd9, 0x24, 0x02, 0xbb, 0x6e, 0x0a, 0xee, 0xa4, 0x05, 0x8d, 0xc3, 0x38, 0x48, 0x93, - 0x1c, 0x5e, 0x47, 0xad, 0x6c, 0x2a, 0xbb, 0x61, 0x70, 0xcb, 0x29, 0xae, 0xf5, 0x2c, 0x8d, 0xd3, - 0x1c, 0x11, 0x8f, 0x78, 0x2c, 0x85, 0x6f, 0x2f, 0xfc, 0x3d, 0xe2, 0x53, 0x29, 0x7c, 0x6a, 0x32, - 0x31, 0x9f, 0x84, 0x8f, 0x11, 0x97, 0x30, 0xb2, 0x9b, 0x5d, 0xab, 0xd7, 0x2a, 0xf8, 0x68, 0x1a, - 0xa7, 0x39, 0x62, 0xed, 0x6b, 0x1d, 0xb5, 0x5e, 0xa7, 0x56, 0xc2, 0x6f, 0x50, 0xcb, 0x07, 0xcd, - 0x46, 0x4c, 0x33, 0x73, 0x87, 0xed, 0xcd, 0x1e, 0x49, 0x76, 0x42, 0x8a, 0x9d, 0x18, 0xf7, 0x25, - 0xa6, 0x23, 0x2f, 0x87, 0x1f, 0xe0, 0x48, 0x1f, 0x80, 0x66, 0x03, 0x9c, 0x8a, 0xa0, 0x22, 0x46, - 0x73, 0x36, 0xfc, 0x10, 0x35, 0x7d, 0x50, 0x8a, 0x79, 0xd9, 0x9d, 0xdf, 0x4d, 0xe1, 0xcd, 0x83, - 0x24, 0x4c, 0xb3, 0x3c, 0x3e, 0x44, 0x4d, 0x61, 0x28, 0x94, 0x5d, 0xeb, 0xd6, 0x7a, 0xed, 0xcd, - 0x47, 0x37, 0xf4, 0x90, 0xda, 0x88, 0x50, 0xf6, 0x69, 0xef, 0xb3, 0x86, 0x20, 0xb6, 0x6c, 0xc1, - 0x9b, 0xb4, 0xa1, 0x68, 0x46, 0x86, 0x03, 0x84, 0xc2, 0xcc, 0x29, 0xca, 0xae, 0x1b, 0xea, 0x5d, - 0x72, 0xcb, 0x67, 0x46, 0x72, 0xb3, 0x15, 0x03, 0xe7, 0x21, 0x45, 0x4b, 0x0a, 0x58, 0xa1, 0x85, - 0x09, 0x1b, 0xc2, 0x44, 0xd9, 0x0d, 0xa3, 0xb5, 0x77, 0x6b, 0xad, 0x6c, 0x2f, 0x64, 0xdf, 0xf0, - 0xec, 0x05, 0x5a, 0x9e, 0x0e, 0x56, 0x52, 0xd9, 0xa5, 0x64, 0xc0, 0x24, 0x45, 0x53, 0xa9, 0xce, - 0x0e, 0x6a, 0x97, 0xc0, 0x78, 0x19, 0xd5, 0xc6, 0x70, 0x9a, 0xbc, 0x07, 0x1a, 0x7f, 0xe2, 0x95, - 0xcc, 0x92, 0x66, 0x0d, 0xa9, 0x07, 0x77, 0xab, 0xdb, 0xd6, 0xda, 0x0f, 0x0b, 0x2d, 0x65, 0x8a, - 0xfb, 0x5c, 0x69, 0xfc, 0x6e, 0xce, 0x0d, 0xee, 0x3f, 0xdc, 0x50, 0xfa, 0x6b, 0x90, 0xb8, 0xdc, - 0x98, 0x22, 0x77, 0x5e, 0x16, 0x29, 0x59, 0xe2, 0x3d, 0x6a, 0x70, 0x0d, 0xbe, 0xb2, 0xab, 0xe6, - 0x7a, 0x76, 0xfe, 0xfb, 0x7a, 0x8a, 0x77, 0xf5, 0x3c, 0xe6, 0xa3, 0x09, 0xed, 0xe0, 0xc1, 0xd9, - 0xa5, 0x53, 0x39, 0xbf, 0x74, 0x2a, 0x3f, 0x2f, 0x9d, 0xca, 0x97, 0x99, 0x63, 0x9d, 0xcd, 0x1c, - 0xeb, 0x7c, 0xe6, 0x58, 0xbf, 0x66, 0x8e, 0xf5, 0xed, 0xb7, 0x53, 0x79, 0x5b, 0x9d, 0xf6, 0xff, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x13, 0x2f, 0x8b, 0xdd, 0xa9, 0x05, 0x00, 0x00, + // 1100 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0x49, 0x6f, 0x1c, 0x45, + 0x14, 0x76, 0xcf, 0xe6, 0x99, 0x1a, 0x27, 0x58, 0x85, 0x15, 0x35, 0x23, 0x31, 0xb6, 0x1a, 0x84, + 0x8c, 0x12, 0x77, 0xcb, 0x96, 0x22, 0x25, 0x39, 0x80, 0xd2, 0xc4, 0x44, 0x06, 0x07, 0x50, 0xc5, + 0xb1, 0x50, 0x24, 0x90, 0x6a, 0x66, 0x9e, 0x3b, 0xc5, 0x4c, 0x2f, 0x54, 0xd5, 0xd8, 0xf8, 0x82, + 0x10, 0x17, 0xae, 0x1c, 0xf3, 0x6b, 0x38, 0x22, 0x5f, 0x90, 0x72, 0xe0, 0xc0, 0x05, 0x0b, 0x0f, + 0x27, 0xfe, 0x42, 0x4e, 0xa8, 0xab, 0xab, 0x97, 0x59, 0x6c, 0xbc, 0x40, 0xb8, 0x75, 0xbf, 0x7a, + 0xef, 0xfb, 0xde, 0x5e, 0x85, 0xde, 0xf7, 0x98, 0x7c, 0x36, 0xec, 0xd8, 0xdd, 0xd0, 0x77, 0xc2, + 0x08, 0x02, 0xf1, 0x8c, 0xed, 0x49, 0x27, 0xe4, 0xcc, 0x63, 0x81, 0x13, 0xf5, 0x3d, 0x47, 0x82, + 0x1f, 0x0d, 0xa8, 0x04, 0x87, 0x46, 0xcc, 0xd9, 0x5f, 0x77, 0x3c, 0x08, 0x80, 0x53, 0x09, 0x3d, + 0x3b, 0xe2, 0xa1, 0x0c, 0xb1, 0x93, 0x03, 0xd8, 0x19, 0x80, 0x9d, 0x00, 0xd8, 0x51, 0xdf, 0xb3, + 0x53, 0x00, 0x9b, 0x46, 0xcc, 0xde, 0x5f, 0x6f, 0xad, 0x15, 0x18, 0xbd, 0xd0, 0x0b, 0x1d, 0x85, + 0xd3, 0x19, 0xee, 0xa9, 0x3f, 0xf5, 0xa3, 0xbe, 0x12, 0xfc, 0xd6, 0xed, 0xfe, 0x1d, 0x61, 0xb3, + 0xd0, 0xe9, 0x0f, 0x3b, 0xc0, 0x03, 0x90, 0x20, 0x94, 0x5b, 0xb1, 0x37, 0xc3, 0x60, 0x1f, 0xb8, + 0x60, 0x61, 0x00, 0xbd, 0x49, 0xb7, 0x5a, 0xb7, 0x4e, 0x37, 0x9b, 0x0e, 0xa2, 0xb5, 0x36, 0x5b, + 0x9b, 0x0f, 0x03, 0xc9, 0x7c, 0x98, 0x52, 0x5f, 0x9f, 0xad, 0x3e, 0x94, 0x6c, 0xe0, 0xb0, 0x40, + 0x0a, 0xc9, 0x27, 0x4d, 0xac, 0x13, 0x03, 0xdd, 0x70, 0x79, 0xd8, 0x07, 0xbe, 0xa3, 0xf3, 0xb1, + 0x15, 0x08, 0x49, 0x83, 0x2e, 0xe0, 0xcf, 0x51, 0xdd, 0x07, 0x49, 0x7b, 0x54, 0x52, 0xd3, 0x58, + 0x31, 0x56, 0x9b, 0x1b, 0xab, 0x76, 0x42, 0x60, 0xe7, 0x04, 0x2a, 0x95, 0x49, 0x06, 0xed, 0x4f, + 0x3b, 0x5f, 0x41, 0x57, 0x3e, 0x02, 0x49, 0x5d, 0x7c, 0x74, 0xbc, 0x3c, 0x37, 0x3a, 0x5e, 0x46, + 0xb9, 0x8c, 0x64, 0x68, 0xd8, 0x47, 0x15, 0x11, 0x41, 0xd7, 0x2c, 0x29, 0xd4, 0x8f, 0xed, 0x0b, + 0x96, 0xca, 0x9e, 0xed, 0xf0, 0xe3, 0x08, 0xba, 0xee, 0x82, 0x26, 0xae, 0xc4, 0x7f, 0x44, 0xd1, + 0x58, 0x7f, 0x19, 0xa8, 0x35, 0xdb, 0x64, 0x9b, 0x09, 0x89, 0xbf, 0x98, 0x8a, 0xd3, 0x39, 0x23, + 0xce, 0x42, 0x71, 0xed, 0xd8, 0x5c, 0x85, 0xbb, 0xa8, 0x59, 0xeb, 0xa9, 0xa4, 0x10, 0xec, 0x00, + 0x55, 0x99, 0x04, 0x5f, 0x98, 0xa5, 0x95, 0xf2, 0x6a, 0x73, 0xe3, 0xe1, 0xbf, 0x14, 0xad, 0x7b, + 0x4d, 0x73, 0x56, 0xb7, 0x62, 0x74, 0x92, 0x90, 0x58, 0xcf, 0x4b, 0xa7, 0xc5, 0x1a, 0x27, 0x04, + 0x0b, 0xb4, 0x28, 0x27, 0xe4, 0x3a, 0xe6, 0xb5, 0xf3, 0xd4, 0x96, 0xc0, 0x1e, 0x70, 0x88, 0xd9, + 0x4d, 0xcd, 0xbe, 0x38, 0x49, 0x43, 0xa6, 0x08, 0xf0, 0x13, 0x54, 0x13, 0xd0, 0xe5, 0x20, 0x75, + 0xc1, 0x2f, 0x48, 0x75, 0x5d, 0x53, 0xd5, 0x1e, 0x2b, 0x10, 0xa2, 0xc1, 0xb0, 0x8d, 0x50, 0x87, + 0x05, 0x3d, 0x16, 0x78, 0x5b, 0x0f, 0x84, 0x59, 0x5e, 0x29, 0xaf, 0x36, 0xdc, 0xeb, 0x71, 0xcf, + 0xb9, 0x99, 0x94, 0x14, 0x34, 0xac, 0x9f, 0x4a, 0xa8, 0xf1, 0x19, 0xe5, 0xd4, 0x07, 0x09, 0x1c, + 0xaf, 0xa0, 0x4a, 0x40, 0xfd, 0x24, 0xfa, 0x46, 0xde, 0x36, 0x9f, 0x50, 0x1f, 0x88, 0x3a, 0xc1, + 0xb7, 0x51, 0xb3, 0xc7, 0x44, 0x34, 0xa0, 0x87, 0xb1, 0x50, 0xf9, 0xde, 0x70, 0x5f, 0xd7, 0x8a, + 0xcd, 0x07, 0xf9, 0x11, 0x29, 0xea, 0x29, 0x33, 0x10, 0x5d, 0xce, 0x22, 0xc9, 0xc2, 0xc0, 0x2c, + 0x4f, 0x98, 0xe5, 0x47, 0xa4, 0xa8, 0x87, 0xdf, 0x42, 0xd5, 0x7d, 0x3a, 0x18, 0x82, 0x59, 0x51, + 0x06, 0x59, 0x75, 0x77, 0x63, 0x21, 0x49, 0xce, 0xf0, 0x2d, 0x54, 0x4f, 0x07, 0xd8, 0xac, 0x2a, + 0xbd, 0xac, 0xf3, 0x1e, 0x6a, 0x39, 0xc9, 0x34, 0xe2, 0x10, 0xf7, 0x78, 0xe8, 0x9b, 0xb5, 0xf1, + 0x10, 0x3f, 0xe4, 0xa1, 0x4f, 0xd4, 0x49, 0x8c, 0xc7, 0xe1, 0xeb, 0x21, 0xe3, 0xd0, 0x33, 0xe7, + 0x57, 0x8c, 0xd5, 0x7a, 0x8e, 0x47, 0xb4, 0x9c, 0x64, 0x1a, 0xd6, 0x0f, 0x15, 0x54, 0x4f, 0xcb, + 0xfd, 0x1f, 0x6e, 0x87, 0x77, 0xd1, 0xbc, 0x0f, 0x42, 0x50, 0x2f, 0xcd, 0xf9, 0x6b, 0x5a, 0x7d, + 0xfe, 0x51, 0x22, 0x26, 0xe9, 0x39, 0xde, 0x45, 0xf3, 0xa1, 0x82, 0x48, 0xea, 0xdf, 0xdc, 0xb8, + 0x79, 0x8a, 0x0f, 0x7a, 0x63, 0xda, 0x84, 0x1e, 0x6c, 0x7e, 0x23, 0x21, 0x88, 0x07, 0x38, 0xc7, + 0x4d, 0xdc, 0x10, 0x24, 0x05, 0xc3, 0x01, 0x42, 0x51, 0xda, 0x29, 0xc2, 0xac, 0x28, 0xe8, 0x7b, + 0x17, 0x1e, 0xdc, 0xac, 0xd9, 0xf2, 0x80, 0x33, 0x91, 0x20, 0x05, 0x06, 0x2c, 0x50, 0x6d, 0x40, + 0x3b, 0x30, 0x10, 0x66, 0x55, 0x71, 0x6d, 0x5e, 0x98, 0x2b, 0xad, 0x8b, 0xbd, 0xad, 0x70, 0x36, + 0x03, 0xc9, 0x0f, 0xdd, 0x25, 0x4d, 0xbb, 0x90, 0x04, 0x98, 0x1c, 0x11, 0x4d, 0xd5, 0xba, 0x8b, + 0x9a, 0x05, 0x65, 0xbc, 0x88, 0xca, 0x7d, 0x38, 0x4c, 0xe6, 0x81, 0xc4, 0x9f, 0x78, 0x29, 0x6d, + 0x49, 0x55, 0x06, 0xdd, 0x83, 0xf7, 0x4a, 0x77, 0x0c, 0xeb, 0xe7, 0x12, 0x5a, 0x7c, 0x85, 0xf7, + 0x85, 0x37, 0x76, 0x5f, 0x5c, 0x3e, 0x39, 0xff, 0x74, 0x53, 0xe0, 0x10, 0xd5, 0x84, 0xa4, 0x72, + 0x28, 0xd4, 0xd8, 0x5e, 0x66, 0x59, 0x4f, 0x51, 0x29, 0xb8, 0xc2, 0x0e, 0x53, 0xff, 0x44, 0xd3, + 0x58, 0xdf, 0x97, 0xd1, 0x1b, 0x93, 0x26, 0x1f, 0x84, 0x41, 0x8f, 0xa9, 0x9d, 0x70, 0x1f, 0x55, + 0xe4, 0x61, 0x94, 0xee, 0xa8, 0xb5, 0xd4, 0xe1, 0x9d, 0xc3, 0x08, 0x5e, 0x1e, 0x2f, 0xbf, 0x79, + 0xaa, 0x61, 0xac, 0x40, 0x94, 0x29, 0xde, 0xcd, 0x22, 0x4a, 0x66, 0xe9, 0xbd, 0x71, 0x47, 0x5e, + 0x1e, 0x2f, 0x9f, 0xf9, 0x22, 0xb1, 0x33, 0xcc, 0x71, 0xc7, 0xf1, 0x01, 0xc2, 0x03, 0x2a, 0xe4, + 0x0e, 0xa7, 0x81, 0x48, 0x38, 0x99, 0x0f, 0x3a, 0x6b, 0x37, 0xcf, 0x79, 0x7d, 0xc6, 0x26, 0x6e, + 0x4b, 0x3b, 0x84, 0xb7, 0xa7, 0xe0, 0xc8, 0x0c, 0x0a, 0xfc, 0x0e, 0xaa, 0x71, 0xa0, 0x22, 0x0c, + 0xf4, 0xa2, 0xcc, 0x32, 0x4b, 0x94, 0x94, 0xe8, 0xd3, 0xe2, 0x16, 0xa9, 0x9e, 0xbd, 0x45, 0xac, + 0xdf, 0x0d, 0xb4, 0xf4, 0x7f, 0xbc, 0x0c, 0xf6, 0xc6, 0x5f, 0x06, 0xf7, 0xaf, 0xdc, 0x6c, 0xa7, + 0xbc, 0x09, 0xb6, 0xa6, 0x7b, 0x2c, 0xde, 0xee, 0x20, 0x64, 0xc8, 0xe3, 0x2b, 0x60, 0x28, 0x80, + 0x17, 0xee, 0xc2, 0xcc, 0xe5, 0x27, 0x5a, 0x4e, 0x32, 0x0d, 0xeb, 0xd7, 0xd2, 0x74, 0xaa, 0xd4, + 0xc3, 0xc2, 0x43, 0xf5, 0xd4, 0x3b, 0x9d, 0xaa, 0xbb, 0x97, 0x0e, 0x27, 0xf7, 0x20, 0x95, 0x90, + 0x0c, 0x1c, 0x3f, 0x9d, 0x78, 0x4c, 0x6c, 0x9c, 0xbd, 0x63, 0xb6, 0xc3, 0x2e, 0x1d, 0x9c, 0xf7, + 0x45, 0x71, 0x80, 0x1a, 0x3c, 0x4d, 0x8c, 0xee, 0xe5, 0x8f, 0xae, 0x5c, 0x94, 0x2c, 0xd5, 0xee, + 0xb5, 0xd1, 0xf1, 0x72, 0x23, 0xfb, 0x25, 0x39, 0x97, 0xf5, 0xdc, 0x40, 0x37, 0x66, 0x6f, 0x0e, + 0xfc, 0x2d, 0x42, 0xdd, 0x74, 0x06, 0x85, 0x69, 0xa8, 0x4e, 0xb9, 0xba, 0x53, 0xd9, 0x58, 0xe7, + 0x9b, 0x37, 0x13, 0x09, 0x52, 0x60, 0xb4, 0x7e, 0x31, 0xd0, 0x42, 0x6a, 0xfd, 0x2a, 0x86, 0xe2, + 0xcb, 0xf1, 0xa1, 0xb8, 0x42, 0x17, 0xcd, 0x1c, 0x06, 0xf7, 0xed, 0xa3, 0x93, 0xf6, 0xdc, 0x8b, + 0x93, 0xf6, 0xdc, 0x6f, 0x27, 0xed, 0xb9, 0xef, 0x46, 0x6d, 0xe3, 0x68, 0xd4, 0x36, 0x5e, 0x8c, + 0xda, 0xc6, 0x1f, 0xa3, 0xb6, 0xf1, 0xe3, 0x9f, 0xed, 0xb9, 0xa7, 0xa5, 0xfd, 0xf5, 0xbf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x55, 0xfb, 0xb8, 0x80, 0x7f, 0x0e, 0x00, 0x00, } diff --git a/pkg/template/api/v1/generated.proto b/pkg/template/api/v1/generated.proto index 86691f856fb4..ff61d5235258 100644 --- a/pkg/template/api/v1/generated.proto +++ b/pkg/template/api/v1/generated.proto @@ -13,6 +13,40 @@ import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; // Package-wide variables from generator "generated". option go_package = "v1"; +// BrokerTemplateInstance holds the service broker-related state associated with +// a TemplateInstance. BrokerTemplateInstance is part of an experimental API. +message BrokerTemplateInstance { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1; + + // spec describes the state of this BrokerTemplateInstance. + optional BrokerTemplateInstanceSpec spec = 2; +} + +// BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects. +message BrokerTemplateInstanceList { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1; + + // items is a list of BrokerTemplateInstances + repeated BrokerTemplateInstance items = 2; +} + +// BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance. +message BrokerTemplateInstanceSpec { + // templateinstance is a reference to a TemplateInstance object residing + // in a namespace. + optional k8s.io.kubernetes.pkg.api.v1.ObjectReference templateInstance = 1; + + // secret is a reference to a Secret object residing in a namespace, + // containing the necessary template parameters. + optional k8s.io.kubernetes.pkg.api.v1.ObjectReference secret = 2; + + // bindingids is a list of 'binding_id's provided during successive bind + // calls to the template service broker. + repeated string bindingIDs = 3; +} + // Parameter defines a name/value variable that is to be processed during // the Template to Config transformation. message Parameter { @@ -87,6 +121,78 @@ message Template { map labels = 5; } +// TemplateInstance requests and records the instantiation of a Template. +// TemplateInstance is part of an experimental API. +message TemplateInstance { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1; + + // spec describes the desired state of this TemplateInstance. + optional TemplateInstanceSpec spec = 2; + + // status describes the current state of this TemplateInstance. + optional TemplateInstanceStatus status = 3; +} + +// TemplateInstanceCondition contains condition information for a +// TemplateInstance. +message TemplateInstanceCondition { + // Type of the condition, currently Ready or InstantiateFailure. + optional string type = 1; + + // Status of the condition, one of True, False or Unknown. + optional string status = 2; + + // LastTransitionTime is the last time a condition status transitioned from + // one state to another. + optional k8s.io.kubernetes.pkg.api.unversioned.Time lastTransitionTime = 3; + + // Reason is a brief machine readable explanation for the condition's last + // transition. + optional string reason = 4; + + // Message is a human readable description of the details of the last + // transition, complementing reason. + optional string message = 5; +} + +// TemplateInstanceList is a list of TemplateInstance objects. +message TemplateInstanceList { + // Standard object metadata. + optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1; + + // items is a list of Templateinstances + repeated TemplateInstance items = 2; +} + +// TemplateInstanceRequestor holds the identity of an agent requesting a +// template instantiation. +message TemplateInstanceRequestor { + // username is the username of the agent requesting a template instantiation. + optional string username = 1; +} + +// TemplateInstanceSpec describes the desired state of a TemplateInstance. +message TemplateInstanceSpec { + // template is a full copy of the template for instantiation. + optional Template template = 1; + + // secret is a reference to a Secret object containing the necessary + // template parameters. + optional k8s.io.kubernetes.pkg.api.v1.LocalObjectReference secret = 2; + + // requestor holds the identity of the agent requesting the template + // instantiation. + optional TemplateInstanceRequestor requestor = 3; +} + +// TemplateInstanceStatus describes the current state of a TemplateInstance. +message TemplateInstanceStatus { + // conditions represent the latest available observations of a + // TemplateInstance's current state. + repeated TemplateInstanceCondition conditions = 1; +} + // TemplateList is a list of Template objects. message TemplateList { // Standard object's metadata. diff --git a/pkg/template/api/v1/register.go b/pkg/template/api/v1/register.go index 4ac3a0c9d910..3187a5db8529 100644 --- a/pkg/template/api/v1/register.go +++ b/pkg/template/api/v1/register.go @@ -29,6 +29,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { types := []runtime.Object{ &Template{}, &TemplateList{}, + &TemplateInstance{}, + &TemplateInstanceList{}, + &BrokerTemplateInstance{}, + &BrokerTemplateInstanceList{}, } scheme.AddKnownTypes(SchemeGroupVersion, append(types, diff --git a/pkg/template/api/v1/swagger_doc.go b/pkg/template/api/v1/swagger_doc.go index 5427e49e948e..0262d36500e4 100644 --- a/pkg/template/api/v1/swagger_doc.go +++ b/pkg/template/api/v1/swagger_doc.go @@ -5,6 +5,37 @@ package v1 // 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_BrokerTemplateInstance = map[string]string{ + "": "BrokerTemplateInstance holds the service broker-related state associated with a TemplateInstance. BrokerTemplateInstance is part of an experimental API.", + "metadata": "Standard object metadata.", + "spec": "spec describes the state of this BrokerTemplateInstance.", +} + +func (BrokerTemplateInstance) SwaggerDoc() map[string]string { + return map_BrokerTemplateInstance +} + +var map_BrokerTemplateInstanceList = map[string]string{ + "": "BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects.", + "metadata": "Standard object metadata.", + "items": "items is a list of BrokerTemplateInstances", +} + +func (BrokerTemplateInstanceList) SwaggerDoc() map[string]string { + return map_BrokerTemplateInstanceList +} + +var map_BrokerTemplateInstanceSpec = map[string]string{ + "": "BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance.", + "templateInstance": "templateinstance is a reference to a TemplateInstance object residing in a namespace.", + "secret": "secret is a reference to a Secret object residing in a namespace, containing the necessary template parameters.", + "bindingIDs": "bindingids is a list of 'binding_id's provided during successive bind calls to the template service broker.", +} + +func (BrokerTemplateInstanceSpec) SwaggerDoc() map[string]string { + return map_BrokerTemplateInstanceSpec +} + var map_Parameter = map[string]string{ "": "Parameter defines a name/value variable that is to be processed during the Template to Config transformation.", "name": "Name must be set and it can be referenced in Template Items using ${PARAMETER_NAME}. Required.", @@ -33,6 +64,69 @@ func (Template) SwaggerDoc() map[string]string { return map_Template } +var map_TemplateInstance = map[string]string{ + "": "TemplateInstance requests and records the instantiation of a Template. TemplateInstance is part of an experimental API.", + "metadata": "Standard object metadata.", + "spec": "spec describes the desired state of this TemplateInstance.", + "status": "status describes the current state of this TemplateInstance.", +} + +func (TemplateInstance) SwaggerDoc() map[string]string { + return map_TemplateInstance +} + +var map_TemplateInstanceCondition = map[string]string{ + "": "TemplateInstanceCondition contains condition information for a TemplateInstance.", + "type": "Type of the condition, currently Ready or InstantiateFailure.", + "status": "Status of the condition, one of True, False or Unknown.", + "lastTransitionTime": "LastTransitionTime is the last time a condition status transitioned from one state to another.", + "reason": "Reason is a brief machine readable explanation for the condition's last transition.", + "message": "Message is a human readable description of the details of the last transition, complementing reason.", +} + +func (TemplateInstanceCondition) SwaggerDoc() map[string]string { + return map_TemplateInstanceCondition +} + +var map_TemplateInstanceList = map[string]string{ + "": "TemplateInstanceList is a list of TemplateInstance objects.", + "metadata": "Standard object metadata.", + "items": "items is a list of Templateinstances", +} + +func (TemplateInstanceList) SwaggerDoc() map[string]string { + return map_TemplateInstanceList +} + +var map_TemplateInstanceRequestor = map[string]string{ + "": "TemplateInstanceRequestor holds the identity of an agent requesting a template instantiation.", + "username": "username is the username of the agent requesting a template instantiation.", +} + +func (TemplateInstanceRequestor) SwaggerDoc() map[string]string { + return map_TemplateInstanceRequestor +} + +var map_TemplateInstanceSpec = map[string]string{ + "": "TemplateInstanceSpec describes the desired state of a TemplateInstance.", + "template": "template is a full copy of the template for instantiation.", + "secret": "secret is a reference to a Secret object containing the necessary template parameters.", + "requestor": "requestor holds the identity of the agent requesting the template instantiation.", +} + +func (TemplateInstanceSpec) SwaggerDoc() map[string]string { + return map_TemplateInstanceSpec +} + +var map_TemplateInstanceStatus = map[string]string{ + "": "TemplateInstanceStatus describes the current state of a TemplateInstance.", + "conditions": "conditions represent the latest available observations of a TemplateInstance's current state.", +} + +func (TemplateInstanceStatus) SwaggerDoc() map[string]string { + return map_TemplateInstanceStatus +} + var map_TemplateList = map[string]string{ "": "TemplateList is a list of Template objects.", "metadata": "Standard object's metadata.", diff --git a/pkg/template/api/v1/types.go b/pkg/template/api/v1/types.go index f36d05da67f5..5d4d4257b12b 100644 --- a/pkg/template/api/v1/types.go +++ b/pkg/template/api/v1/types.go @@ -93,3 +93,127 @@ type Parameter struct { // Optional: Indicates the parameter must have a value. Defaults to false. Required bool `json:"required,omitempty" protobuf:"varint,7,opt,name=required"` } + +// +genclient=true + +// TemplateInstance requests and records the instantiation of a Template. +// TemplateInstance is part of an experimental API. +type TemplateInstance struct { + unversioned.TypeMeta `json:",inline"` + // Standard object metadata. + kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec describes the desired state of this TemplateInstance. + Spec TemplateInstanceSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // status describes the current state of this TemplateInstance. + Status TemplateInstanceStatus `json:"status" protobuf:"bytes,3,opt,name=status"` +} + +// TemplateInstanceSpec describes the desired state of a TemplateInstance. +type TemplateInstanceSpec struct { + // template is a full copy of the template for instantiation. + Template Template `json:"template" protobuf:"bytes,1,opt,name=template"` + + // secret is a reference to a Secret object containing the necessary + // template parameters. + Secret kapi.LocalObjectReference `json:"secret" protobuf:"bytes,2,opt,name=secret"` + + // requestor holds the identity of the agent requesting the template + // instantiation. + Requestor *TemplateInstanceRequestor `json:"requestor" protobuf:"bytes,3,opt,name=requestor"` +} + +// TemplateInstanceRequestor holds the identity of an agent requesting a +// template instantiation. +type TemplateInstanceRequestor struct { + // username is the username of the agent requesting a template instantiation. + Username string `json:"username" protobuf:"bytes,1,opt,name=username"` +} + +// TemplateInstanceStatus describes the current state of a TemplateInstance. +type TemplateInstanceStatus struct { + // conditions represent the latest available observations of a + // TemplateInstance's current state. + Conditions []TemplateInstanceCondition `json:"conditions" protobuf:"bytes,1,rep,name=conditions"` +} + +// TemplateInstanceCondition contains condition information for a +// TemplateInstance. +type TemplateInstanceCondition struct { + // Type of the condition, currently Ready or InstantiateFailure. + Type TemplateInstanceConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=TemplateInstanceConditionType"` + // Status of the condition, one of True, False or Unknown. + Status kapi.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"` + // LastTransitionTime is the last time a condition status transitioned from + // one state to another. + LastTransitionTime unversioned.Time `json:"lastTransitionTime" protobuf:"bytes,3,opt,name=lastTransitionTime"` + // Reason is a brief machine readable explanation for the condition's last + // transition. + Reason string `json:"reason" protobuf:"bytes,4,opt,name=reason"` + // Message is a human readable description of the details of the last + // transition, complementing reason. + Message string `json:"message" protobuf:"bytes,5,opt,name=message"` +} + +// TemplateInstanceConditionType is the type of condition pertaining to a +// TemplateInstance. +type TemplateInstanceConditionType string + +const ( + // TemplateInstanceReady indicates the readiness of the template + // instantiation. + TemplateInstanceReady TemplateInstanceConditionType = "Ready" + // TemplateInstanceInstantiateFailure indicates the failure of the template + // instantiation + TemplateInstanceInstantiateFailure TemplateInstanceConditionType = "InstantiateFailure" +) + +// TemplateInstanceList is a list of TemplateInstance objects. +type TemplateInstanceList struct { + unversioned.TypeMeta `json:",inline"` + // Standard object metadata. + unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is a list of Templateinstances + Items []TemplateInstance `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient=true +// +nonNamespaced=true + +// BrokerTemplateInstance holds the service broker-related state associated with +// a TemplateInstance. BrokerTemplateInstance is part of an experimental API. +type BrokerTemplateInstance struct { + unversioned.TypeMeta `json:",inline"` + // Standard object metadata. + kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // spec describes the state of this BrokerTemplateInstance. + Spec BrokerTemplateInstanceSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` +} + +// BrokerTemplateInstanceSpec describes the state of a BrokerTemplateInstance. +type BrokerTemplateInstanceSpec struct { + // templateinstance is a reference to a TemplateInstance object residing + // in a namespace. + TemplateInstance kapi.ObjectReference `json:"templateInstance" protobuf:"bytes,1,opt,name=templateInstance"` + + // secret is a reference to a Secret object residing in a namespace, + // containing the necessary template parameters. + Secret kapi.ObjectReference `json:"secret" protobuf:"bytes,2,opt,name=secret"` + + // bindingids is a list of 'binding_id's provided during successive bind + // calls to the template service broker. + BindingIDs []string `json:"bindingIDs" protobuf:"bytes,3,rep,name=bindingIDs"` +} + +// BrokerTemplateInstanceList is a list of BrokerTemplateInstance objects. +type BrokerTemplateInstanceList struct { + unversioned.TypeMeta `json:",inline"` + // Standard object metadata. + unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // items is a list of BrokerTemplateInstances + Items []BrokerTemplateInstance `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/pkg/template/api/v1/zz_generated.conversion.go b/pkg/template/api/v1/zz_generated.conversion.go index 181c33c5bbf0..660cf26d8666 100644 --- a/pkg/template/api/v1/zz_generated.conversion.go +++ b/pkg/template/api/v1/zz_generated.conversion.go @@ -6,6 +6,7 @@ package v1 import ( api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" api_v1 "k8s.io/kubernetes/pkg/api/v1" conversion "k8s.io/kubernetes/pkg/conversion" runtime "k8s.io/kubernetes/pkg/runtime" @@ -20,15 +21,131 @@ func init() { // Public to allow building arbitrary schemes. func RegisterConversions(scheme *runtime.Scheme) error { return scheme.AddGeneratedConversionFuncs( + Convert_v1_BrokerTemplateInstance_To_api_BrokerTemplateInstance, + Convert_api_BrokerTemplateInstance_To_v1_BrokerTemplateInstance, + Convert_v1_BrokerTemplateInstanceList_To_api_BrokerTemplateInstanceList, + Convert_api_BrokerTemplateInstanceList_To_v1_BrokerTemplateInstanceList, + Convert_v1_BrokerTemplateInstanceSpec_To_api_BrokerTemplateInstanceSpec, + Convert_api_BrokerTemplateInstanceSpec_To_v1_BrokerTemplateInstanceSpec, Convert_v1_Parameter_To_api_Parameter, Convert_api_Parameter_To_v1_Parameter, Convert_v1_Template_To_api_Template, Convert_api_Template_To_v1_Template, + Convert_v1_TemplateInstance_To_api_TemplateInstance, + Convert_api_TemplateInstance_To_v1_TemplateInstance, + Convert_v1_TemplateInstanceCondition_To_api_TemplateInstanceCondition, + Convert_api_TemplateInstanceCondition_To_v1_TemplateInstanceCondition, + Convert_v1_TemplateInstanceList_To_api_TemplateInstanceList, + Convert_api_TemplateInstanceList_To_v1_TemplateInstanceList, + Convert_v1_TemplateInstanceRequestor_To_api_TemplateInstanceRequestor, + Convert_api_TemplateInstanceRequestor_To_v1_TemplateInstanceRequestor, + Convert_v1_TemplateInstanceSpec_To_api_TemplateInstanceSpec, + Convert_api_TemplateInstanceSpec_To_v1_TemplateInstanceSpec, + Convert_v1_TemplateInstanceStatus_To_api_TemplateInstanceStatus, + Convert_api_TemplateInstanceStatus_To_v1_TemplateInstanceStatus, Convert_v1_TemplateList_To_api_TemplateList, Convert_api_TemplateList_To_v1_TemplateList, ) } +func autoConvert_v1_BrokerTemplateInstance_To_api_BrokerTemplateInstance(in *BrokerTemplateInstance, out *api.BrokerTemplateInstance, s conversion.Scope) error { + if err := api_v1.Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1_BrokerTemplateInstanceSpec_To_api_BrokerTemplateInstanceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +func Convert_v1_BrokerTemplateInstance_To_api_BrokerTemplateInstance(in *BrokerTemplateInstance, out *api.BrokerTemplateInstance, s conversion.Scope) error { + return autoConvert_v1_BrokerTemplateInstance_To_api_BrokerTemplateInstance(in, out, s) +} + +func autoConvert_api_BrokerTemplateInstance_To_v1_BrokerTemplateInstance(in *api.BrokerTemplateInstance, out *BrokerTemplateInstance, s conversion.Scope) error { + if err := api_v1.Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_api_BrokerTemplateInstanceSpec_To_v1_BrokerTemplateInstanceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +func Convert_api_BrokerTemplateInstance_To_v1_BrokerTemplateInstance(in *api.BrokerTemplateInstance, out *BrokerTemplateInstance, s conversion.Scope) error { + return autoConvert_api_BrokerTemplateInstance_To_v1_BrokerTemplateInstance(in, out, s) +} + +func autoConvert_v1_BrokerTemplateInstanceList_To_api_BrokerTemplateInstanceList(in *BrokerTemplateInstanceList, out *api.BrokerTemplateInstanceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]api.BrokerTemplateInstance, len(*in)) + for i := range *in { + if err := Convert_v1_BrokerTemplateInstance_To_api_BrokerTemplateInstance(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1_BrokerTemplateInstanceList_To_api_BrokerTemplateInstanceList(in *BrokerTemplateInstanceList, out *api.BrokerTemplateInstanceList, s conversion.Scope) error { + return autoConvert_v1_BrokerTemplateInstanceList_To_api_BrokerTemplateInstanceList(in, out, s) +} + +func autoConvert_api_BrokerTemplateInstanceList_To_v1_BrokerTemplateInstanceList(in *api.BrokerTemplateInstanceList, out *BrokerTemplateInstanceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BrokerTemplateInstance, len(*in)) + for i := range *in { + if err := Convert_api_BrokerTemplateInstance_To_v1_BrokerTemplateInstance(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_api_BrokerTemplateInstanceList_To_v1_BrokerTemplateInstanceList(in *api.BrokerTemplateInstanceList, out *BrokerTemplateInstanceList, s conversion.Scope) error { + return autoConvert_api_BrokerTemplateInstanceList_To_v1_BrokerTemplateInstanceList(in, out, s) +} + +func autoConvert_v1_BrokerTemplateInstanceSpec_To_api_BrokerTemplateInstanceSpec(in *BrokerTemplateInstanceSpec, out *api.BrokerTemplateInstanceSpec, s conversion.Scope) error { + if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(&in.TemplateInstance, &out.TemplateInstance, s); err != nil { + return err + } + if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(&in.Secret, &out.Secret, s); err != nil { + return err + } + out.BindingIDs = *(*[]string)(unsafe.Pointer(&in.BindingIDs)) + return nil +} + +func Convert_v1_BrokerTemplateInstanceSpec_To_api_BrokerTemplateInstanceSpec(in *BrokerTemplateInstanceSpec, out *api.BrokerTemplateInstanceSpec, s conversion.Scope) error { + return autoConvert_v1_BrokerTemplateInstanceSpec_To_api_BrokerTemplateInstanceSpec(in, out, s) +} + +func autoConvert_api_BrokerTemplateInstanceSpec_To_v1_BrokerTemplateInstanceSpec(in *api.BrokerTemplateInstanceSpec, out *BrokerTemplateInstanceSpec, s conversion.Scope) error { + if err := api_v1.Convert_api_ObjectReference_To_v1_ObjectReference(&in.TemplateInstance, &out.TemplateInstance, s); err != nil { + return err + } + if err := api_v1.Convert_api_ObjectReference_To_v1_ObjectReference(&in.Secret, &out.Secret, s); err != nil { + return err + } + out.BindingIDs = *(*[]string)(unsafe.Pointer(&in.BindingIDs)) + return nil +} + +func Convert_api_BrokerTemplateInstanceSpec_To_v1_BrokerTemplateInstanceSpec(in *api.BrokerTemplateInstanceSpec, out *BrokerTemplateInstanceSpec, s conversion.Scope) error { + return autoConvert_api_BrokerTemplateInstanceSpec_To_v1_BrokerTemplateInstanceSpec(in, out, s) +} + func autoConvert_v1_Parameter_To_api_Parameter(in *Parameter, out *api.Parameter, s conversion.Scope) error { out.Name = in.Name out.DisplayName = in.DisplayName @@ -109,6 +226,172 @@ func Convert_api_Template_To_v1_Template(in *api.Template, out *Template, s conv return autoConvert_api_Template_To_v1_Template(in, out, s) } +func autoConvert_v1_TemplateInstance_To_api_TemplateInstance(in *TemplateInstance, out *api.TemplateInstance, s conversion.Scope) error { + if err := api_v1.Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1_TemplateInstanceSpec_To_api_TemplateInstanceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_TemplateInstanceStatus_To_api_TemplateInstanceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_v1_TemplateInstance_To_api_TemplateInstance(in *TemplateInstance, out *api.TemplateInstance, s conversion.Scope) error { + return autoConvert_v1_TemplateInstance_To_api_TemplateInstance(in, out, s) +} + +func autoConvert_api_TemplateInstance_To_v1_TemplateInstance(in *api.TemplateInstance, out *TemplateInstance, s conversion.Scope) error { + if err := api_v1.Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_api_TemplateInstanceSpec_To_v1_TemplateInstanceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_api_TemplateInstanceStatus_To_v1_TemplateInstanceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func Convert_api_TemplateInstance_To_v1_TemplateInstance(in *api.TemplateInstance, out *TemplateInstance, s conversion.Scope) error { + return autoConvert_api_TemplateInstance_To_v1_TemplateInstance(in, out, s) +} + +func autoConvert_v1_TemplateInstanceCondition_To_api_TemplateInstanceCondition(in *TemplateInstanceCondition, out *api.TemplateInstanceCondition, s conversion.Scope) error { + out.Type = api.TemplateInstanceConditionType(in.Type) + out.Status = pkg_api.ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +func Convert_v1_TemplateInstanceCondition_To_api_TemplateInstanceCondition(in *TemplateInstanceCondition, out *api.TemplateInstanceCondition, s conversion.Scope) error { + return autoConvert_v1_TemplateInstanceCondition_To_api_TemplateInstanceCondition(in, out, s) +} + +func autoConvert_api_TemplateInstanceCondition_To_v1_TemplateInstanceCondition(in *api.TemplateInstanceCondition, out *TemplateInstanceCondition, s conversion.Scope) error { + out.Type = TemplateInstanceConditionType(in.Type) + out.Status = api_v1.ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +func Convert_api_TemplateInstanceCondition_To_v1_TemplateInstanceCondition(in *api.TemplateInstanceCondition, out *TemplateInstanceCondition, s conversion.Scope) error { + return autoConvert_api_TemplateInstanceCondition_To_v1_TemplateInstanceCondition(in, out, s) +} + +func autoConvert_v1_TemplateInstanceList_To_api_TemplateInstanceList(in *TemplateInstanceList, out *api.TemplateInstanceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]api.TemplateInstance, len(*in)) + for i := range *in { + if err := Convert_v1_TemplateInstance_To_api_TemplateInstance(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_v1_TemplateInstanceList_To_api_TemplateInstanceList(in *TemplateInstanceList, out *api.TemplateInstanceList, s conversion.Scope) error { + return autoConvert_v1_TemplateInstanceList_To_api_TemplateInstanceList(in, out, s) +} + +func autoConvert_api_TemplateInstanceList_To_v1_TemplateInstanceList(in *api.TemplateInstanceList, out *TemplateInstanceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TemplateInstance, len(*in)) + for i := range *in { + if err := Convert_api_TemplateInstance_To_v1_TemplateInstance(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func Convert_api_TemplateInstanceList_To_v1_TemplateInstanceList(in *api.TemplateInstanceList, out *TemplateInstanceList, s conversion.Scope) error { + return autoConvert_api_TemplateInstanceList_To_v1_TemplateInstanceList(in, out, s) +} + +func autoConvert_v1_TemplateInstanceRequestor_To_api_TemplateInstanceRequestor(in *TemplateInstanceRequestor, out *api.TemplateInstanceRequestor, s conversion.Scope) error { + out.Username = in.Username + return nil +} + +func Convert_v1_TemplateInstanceRequestor_To_api_TemplateInstanceRequestor(in *TemplateInstanceRequestor, out *api.TemplateInstanceRequestor, s conversion.Scope) error { + return autoConvert_v1_TemplateInstanceRequestor_To_api_TemplateInstanceRequestor(in, out, s) +} + +func autoConvert_api_TemplateInstanceRequestor_To_v1_TemplateInstanceRequestor(in *api.TemplateInstanceRequestor, out *TemplateInstanceRequestor, s conversion.Scope) error { + out.Username = in.Username + return nil +} + +func Convert_api_TemplateInstanceRequestor_To_v1_TemplateInstanceRequestor(in *api.TemplateInstanceRequestor, out *TemplateInstanceRequestor, s conversion.Scope) error { + return autoConvert_api_TemplateInstanceRequestor_To_v1_TemplateInstanceRequestor(in, out, s) +} + +func autoConvert_v1_TemplateInstanceSpec_To_api_TemplateInstanceSpec(in *TemplateInstanceSpec, out *api.TemplateInstanceSpec, s conversion.Scope) error { + if err := Convert_v1_Template_To_api_Template(&in.Template, &out.Template, s); err != nil { + return err + } + if err := api_v1.Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.Secret, &out.Secret, s); err != nil { + return err + } + out.Requestor = (*api.TemplateInstanceRequestor)(unsafe.Pointer(in.Requestor)) + return nil +} + +func Convert_v1_TemplateInstanceSpec_To_api_TemplateInstanceSpec(in *TemplateInstanceSpec, out *api.TemplateInstanceSpec, s conversion.Scope) error { + return autoConvert_v1_TemplateInstanceSpec_To_api_TemplateInstanceSpec(in, out, s) +} + +func autoConvert_api_TemplateInstanceSpec_To_v1_TemplateInstanceSpec(in *api.TemplateInstanceSpec, out *TemplateInstanceSpec, s conversion.Scope) error { + if err := Convert_api_Template_To_v1_Template(&in.Template, &out.Template, s); err != nil { + return err + } + if err := api_v1.Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.Secret, &out.Secret, s); err != nil { + return err + } + out.Requestor = (*TemplateInstanceRequestor)(unsafe.Pointer(in.Requestor)) + return nil +} + +func Convert_api_TemplateInstanceSpec_To_v1_TemplateInstanceSpec(in *api.TemplateInstanceSpec, out *TemplateInstanceSpec, s conversion.Scope) error { + return autoConvert_api_TemplateInstanceSpec_To_v1_TemplateInstanceSpec(in, out, s) +} + +func autoConvert_v1_TemplateInstanceStatus_To_api_TemplateInstanceStatus(in *TemplateInstanceStatus, out *api.TemplateInstanceStatus, s conversion.Scope) error { + out.Conditions = *(*[]api.TemplateInstanceCondition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +func Convert_v1_TemplateInstanceStatus_To_api_TemplateInstanceStatus(in *TemplateInstanceStatus, out *api.TemplateInstanceStatus, s conversion.Scope) error { + return autoConvert_v1_TemplateInstanceStatus_To_api_TemplateInstanceStatus(in, out, s) +} + +func autoConvert_api_TemplateInstanceStatus_To_v1_TemplateInstanceStatus(in *api.TemplateInstanceStatus, out *TemplateInstanceStatus, s conversion.Scope) error { + out.Conditions = *(*[]TemplateInstanceCondition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +func Convert_api_TemplateInstanceStatus_To_v1_TemplateInstanceStatus(in *api.TemplateInstanceStatus, out *TemplateInstanceStatus, s conversion.Scope) error { + return autoConvert_api_TemplateInstanceStatus_To_v1_TemplateInstanceStatus(in, out, s) +} + func autoConvert_v1_TemplateList_To_api_TemplateList(in *TemplateList, out *api.TemplateList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { diff --git a/pkg/template/api/v1/zz_generated.deepcopy.go b/pkg/template/api/v1/zz_generated.deepcopy.go index 872ca01d0ba3..f5daaf4fe2af 100644 --- a/pkg/template/api/v1/zz_generated.deepcopy.go +++ b/pkg/template/api/v1/zz_generated.deepcopy.go @@ -19,12 +19,74 @@ func init() { // to allow building arbitrary schemes. func RegisterDeepCopies(scheme *runtime.Scheme) error { return scheme.AddGeneratedDeepCopyFuncs( + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_BrokerTemplateInstance, InType: reflect.TypeOf(&BrokerTemplateInstance{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_BrokerTemplateInstanceList, InType: reflect.TypeOf(&BrokerTemplateInstanceList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_BrokerTemplateInstanceSpec, InType: reflect.TypeOf(&BrokerTemplateInstanceSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Parameter, InType: reflect.TypeOf(&Parameter{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Template, InType: reflect.TypeOf(&Template{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateInstance, InType: reflect.TypeOf(&TemplateInstance{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateInstanceCondition, InType: reflect.TypeOf(&TemplateInstanceCondition{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateInstanceList, InType: reflect.TypeOf(&TemplateInstanceList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateInstanceRequestor, InType: reflect.TypeOf(&TemplateInstanceRequestor{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateInstanceSpec, InType: reflect.TypeOf(&TemplateInstanceSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateInstanceStatus, InType: reflect.TypeOf(&TemplateInstanceStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TemplateList, InType: reflect.TypeOf(&TemplateList{})}, ) } +func DeepCopy_v1_BrokerTemplateInstance(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*BrokerTemplateInstance) + out := out.(*BrokerTemplateInstance) + out.TypeMeta = in.TypeMeta + if err := api_v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := DeepCopy_v1_BrokerTemplateInstanceSpec(&in.Spec, &out.Spec, c); err != nil { + return err + } + return nil + } +} + +func DeepCopy_v1_BrokerTemplateInstanceList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*BrokerTemplateInstanceList) + out := out.(*BrokerTemplateInstanceList) + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BrokerTemplateInstance, len(*in)) + for i := range *in { + if err := DeepCopy_v1_BrokerTemplateInstance(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil + } +} + +func DeepCopy_v1_BrokerTemplateInstanceSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*BrokerTemplateInstanceSpec) + out := out.(*BrokerTemplateInstanceSpec) + out.TemplateInstance = in.TemplateInstance + out.Secret = in.Secret + if in.BindingIDs != nil { + in, out := &in.BindingIDs, &out.BindingIDs + *out = make([]string, len(*in)) + copy(*out, *in) + } else { + out.BindingIDs = nil + } + return nil + } +} + func DeepCopy_v1_Parameter(in interface{}, out interface{}, c *conversion.Cloner) error { { in := in.(*Parameter) @@ -82,6 +144,105 @@ func DeepCopy_v1_Template(in interface{}, out interface{}, c *conversion.Cloner) } } +func DeepCopy_v1_TemplateInstance(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstance) + out := out.(*TemplateInstance) + out.TypeMeta = in.TypeMeta + if err := api_v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := DeepCopy_v1_TemplateInstanceSpec(&in.Spec, &out.Spec, c); err != nil { + return err + } + if err := DeepCopy_v1_TemplateInstanceStatus(&in.Status, &out.Status, c); err != nil { + return err + } + return nil + } +} + +func DeepCopy_v1_TemplateInstanceCondition(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceCondition) + out := out.(*TemplateInstanceCondition) + out.Type = in.Type + out.Status = in.Status + out.LastTransitionTime = in.LastTransitionTime.DeepCopy() + out.Reason = in.Reason + out.Message = in.Message + return nil + } +} + +func DeepCopy_v1_TemplateInstanceList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceList) + out := out.(*TemplateInstanceList) + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TemplateInstance, len(*in)) + for i := range *in { + if err := DeepCopy_v1_TemplateInstance(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil + } +} + +func DeepCopy_v1_TemplateInstanceRequestor(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceRequestor) + out := out.(*TemplateInstanceRequestor) + out.Username = in.Username + return nil + } +} + +func DeepCopy_v1_TemplateInstanceSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceSpec) + out := out.(*TemplateInstanceSpec) + if err := DeepCopy_v1_Template(&in.Template, &out.Template, c); err != nil { + return err + } + out.Secret = in.Secret + if in.Requestor != nil { + in, out := &in.Requestor, &out.Requestor + *out = new(TemplateInstanceRequestor) + **out = **in + } else { + out.Requestor = nil + } + return nil + } +} + +func DeepCopy_v1_TemplateInstanceStatus(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceStatus) + out := out.(*TemplateInstanceStatus) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]TemplateInstanceCondition, len(*in)) + for i := range *in { + if err := DeepCopy_v1_TemplateInstanceCondition(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil + } +} + func DeepCopy_v1_TemplateList(in interface{}, out interface{}, c *conversion.Cloner) error { { in := in.(*TemplateList) diff --git a/pkg/template/api/validation/validation.go b/pkg/template/api/validation/validation.go index ca43a0bb2562..b8a18242e530 100644 --- a/pkg/template/api/validation/validation.go +++ b/pkg/template/api/validation/validation.go @@ -4,15 +4,16 @@ import ( "fmt" "regexp" - "k8s.io/kubernetes/pkg/api/validation" - "k8s.io/kubernetes/pkg/util/validation/field" - oapi "github.com/openshift/origin/pkg/api" "github.com/openshift/origin/pkg/template/api" + uservalidation "github.com/openshift/origin/pkg/user/api/validation" + kapi "k8s.io/kubernetes/pkg/api" unversionedvalidation "k8s.io/kubernetes/pkg/api/unversioned/validation" + "k8s.io/kubernetes/pkg/api/validation" + "k8s.io/kubernetes/pkg/util/validation/field" ) -var parameterNameExp = regexp.MustCompile(`^[a-zA-Z0-9\_]+$`) +var ParameterNameRegexp = regexp.MustCompile(`^[a-zA-Z0-9_]+$`) // ValidateParameter tests if required fields in the Parameter are set. func ValidateParameter(param *api.Parameter, fldPath *field.Path) (allErrs field.ErrorList) { @@ -20,8 +21,8 @@ func ValidateParameter(param *api.Parameter, fldPath *field.Path) (allErrs field allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) return } - if !parameterNameExp.MatchString(param.Name) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), param.Name, fmt.Sprintf("does not match %v", parameterNameExp))) + if !ParameterNameRegexp.MatchString(param.Name) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), param.Name, fmt.Sprintf("does not match %v", ParameterNameRegexp))) } return } @@ -51,3 +52,98 @@ func validateTemplateBody(template *api.Template) (allErrs field.ErrorList) { allErrs = append(allErrs, unversionedvalidation.ValidateLabels(template.ObjectLabels, field.NewPath("labels"))...) return } + +// ValidateTemplateInstance tests if required fields in the TemplateInstance are set. +func ValidateTemplateInstance(templateInstance *api.TemplateInstance) (allErrs field.ErrorList) { + allErrs = validation.ValidateObjectMeta(&templateInstance.ObjectMeta, true, oapi.GetNameValidationFunc(validation.ValidatePodName), field.NewPath("metadata")) + for _, err := range ValidateTemplate(&templateInstance.Spec.Template) { + err.Field = "spec.template." + err.Field + allErrs = append(allErrs, err) + } + if templateInstance.Spec.Secret.Name != "" { + for _, msg := range oapi.GetNameValidationFunc(validation.ValidateSecretName)(templateInstance.Spec.Secret.Name, false) { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec.secret.name"), templateInstance.Spec.Secret.Name, msg)) + } + } + if templateInstance.Spec.Requestor == nil { + allErrs = append(allErrs, field.Required(field.NewPath("spec.requestor"), "")) + } else if templateInstance.Spec.Requestor.Username == "" { + allErrs = append(allErrs, field.Required(field.NewPath("spec.requestor.username"), "")) + } else { + for _, msg := range oapi.GetNameValidationFunc(uservalidation.ValidateUserName)(templateInstance.Spec.Requestor.Username, false) { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec.requestor.username"), templateInstance.Spec.Requestor.Username, msg)) + } + } + return +} + +// ValidateTemplateInstanceUpdate tests if required fields in the TemplateInstance are set during an update +func ValidateTemplateInstanceUpdate(templateInstance, oldTemplateInstance *api.TemplateInstance) (allErrs field.ErrorList) { + allErrs = validation.ValidateObjectMetaUpdate(&templateInstance.ObjectMeta, &oldTemplateInstance.ObjectMeta, field.NewPath("metadata")) + + if !kapi.Semantic.DeepEqual(templateInstance.Spec, oldTemplateInstance.Spec) { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec"), templateInstance.Spec, "field is immutable")) + } + return +} + +// ValidateBrokerTemplateInstance tests if required fields in the BrokerTemplateInstance are set. +func ValidateBrokerTemplateInstance(brokerTemplateInstance *api.BrokerTemplateInstance) (allErrs field.ErrorList) { + allErrs = validation.ValidateObjectMeta(&brokerTemplateInstance.ObjectMeta, false, oapi.GetNameValidationFunc(validation.ValidatePodName), field.NewPath("metadata")) + allErrs = append(allErrs, validateTemplateInstanceReference(&brokerTemplateInstance.Spec.TemplateInstance, field.NewPath("spec.templateInstance"), "TemplateInstance")...) + allErrs = append(allErrs, validateTemplateInstanceReference(&brokerTemplateInstance.Spec.Secret, field.NewPath("spec.secret"), "Secret")...) + for _, id := range brokerTemplateInstance.Spec.BindingIDs { + for _, msg := range nameIsUUID(id, false) { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec.bindingIDs"), id, msg)) + } + } + return +} + +// ValidateBrokerTemplateInstanceUpdate tests if required fields in the BrokerTemplateInstance are set during an update +func ValidateBrokerTemplateInstanceUpdate(brokerTemplateInstance, oldBrokerTemplateInstance *api.BrokerTemplateInstance) (allErrs field.ErrorList) { + allErrs = validation.ValidateObjectMetaUpdate(&brokerTemplateInstance.ObjectMeta, &oldBrokerTemplateInstance.ObjectMeta, field.NewPath("metadata")) + allErrs = append(allErrs, validateTemplateInstanceReference(&brokerTemplateInstance.Spec.TemplateInstance, field.NewPath("spec.templateInstance"), "TemplateInstance")...) + allErrs = append(allErrs, validateTemplateInstanceReference(&brokerTemplateInstance.Spec.Secret, field.NewPath("spec.secret"), "Secret")...) + for _, id := range brokerTemplateInstance.Spec.BindingIDs { + for _, msg := range nameIsUUID(id, false) { + allErrs = append(allErrs, field.Invalid(field.NewPath("spec.bindingIDs"), id, msg)) + } + } + return +} + +var uuidRegex = regexp.MustCompile("^(?i)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$") + +func nameIsUUID(name string, prefix bool) []string { + if uuidRegex.MatchString(name) { + return nil + } + return []string{"is not a valid UUID"} +} + +func validateTemplateInstanceReference(ref *kapi.ObjectReference, fldPath *field.Path, kind string) (allErrs field.ErrorList) { + if len(ref.Kind) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("kind"), "")) + } else if ref.Kind != kind { + allErrs = append(allErrs, field.Invalid(fldPath.Child("kind"), ref.Kind, "must be "+kind)) + } + + if len(ref.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "")) + } else { + for _, msg := range oapi.GetNameValidationFunc(validation.ValidatePodName)(ref.Name, false) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), ref.Name, msg)) + } + } + + if len(ref.Namespace) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), "")) + } else { + for _, msg := range oapi.GetNameValidationFunc(validation.ValidateNamespaceName)(ref.Namespace, false) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), ref.Namespace, msg)) + } + } + + return allErrs +} diff --git a/pkg/template/api/validation/validation_test.go b/pkg/template/api/validation/validation_test.go index a36f164cb96e..a77cb2ccedb8 100644 --- a/pkg/template/api/validation/validation_test.go +++ b/pkg/template/api/validation/validation_test.go @@ -9,6 +9,11 @@ import ( "github.com/openshift/origin/pkg/template/api" ) +const ( + validUUID = "0153ff2f-77ab-4560-ba59-785931cded5e" + validUUID2 = "7ee0204f-1ac5-40aa-a976-efcfca1b4b84" +) + func makeParameter(name, value string) *api.Parameter { return &api.Parameter{ Name: name, @@ -189,3 +194,635 @@ func TestValidateTemplate(t *testing.T) { } } } + +func TestValidateTemplateInstance(t *testing.T) { + var tests = []struct { + templateInstance api.TemplateInstance + isValidExpected bool + }{ + { + templateInstance: api.TemplateInstance{}, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + }, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Spec: api.TemplateInstanceSpec{}, + }, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Spec: api.TemplateInstanceSpec{ + Template: api.Template{}, + }, + }, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Spec: api.TemplateInstanceSpec{ + Template: api.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + }, + Requestor: &api.TemplateInstanceRequestor{ + Username: "test", + }, + }, + }, + isValidExpected: true, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Spec: api.TemplateInstanceSpec{ + Template: api.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Parameters: []api.Parameter{ + { + Name: "b@d", + }, + }, + }, + Requestor: &api.TemplateInstanceRequestor{ + Username: "test", + }, + }, + }, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Spec: api.TemplateInstanceSpec{ + Template: api.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + }, + Secret: kapi.LocalObjectReference{ + Name: "b@d", + }, + Requestor: &api.TemplateInstanceRequestor{ + Username: "test", + }, + }, + }, + }, + { + templateInstance: api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Spec: api.TemplateInstanceSpec{ + Template: api.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + }, + Secret: kapi.LocalObjectReference{ + Name: "test", + }, + Requestor: &api.TemplateInstanceRequestor{ + Username: "test", + }, + }, + }, + isValidExpected: true, + }, + } + + for i, test := range tests { + errs := ValidateTemplateInstance(&test.templateInstance) + if len(errs) != 0 && test.isValidExpected { + t.Errorf("%d: Unexpected non-empty error list: %v", i, errs.ToAggregate()) + } + if len(errs) == 0 && !test.isValidExpected { + t.Errorf("%d: Unexpected empty error list: %v", i, errs.ToAggregate()) + } + } +} + +func TestValidateTemplateInstanceUpdate(t *testing.T) { + oldTemplateInstance := &api.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + ResourceVersion: "1", + }, + Spec: api.TemplateInstanceSpec{ + Template: api.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + Namespace: "test", + }, + Parameters: []api.Parameter{ + { + Name: "test", + }, + }, + }, + Secret: kapi.LocalObjectReference{ + Name: "test", + }, + Requestor: &api.TemplateInstanceRequestor{ + Username: "test", + }, + }, + } + + var tests = []struct { + modifyTemplateInstance func(*api.TemplateInstance) + isValidExpected bool + }{ + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + }, + isValidExpected: true, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Name = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Namespace = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Name = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Name = "b@d" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Namespace = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Namespace = "b@d" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Parameters[0].Name = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Parameters[0].Name = "b@d" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Template.Parameters = nil + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Secret.Name = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Secret.Name = "b@d" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Secret.Name = "" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Requestor.Username = "new" + }, + }, + { + modifyTemplateInstance: func(new *api.TemplateInstance) { + new.Spec.Requestor.Username = "" + }, + }, + } + + for i, test := range tests { + newTemplateInstance, err := kapi.Scheme.DeepCopy(oldTemplateInstance) + if err != nil { + t.Fatal(err) + } + test.modifyTemplateInstance(newTemplateInstance.(*api.TemplateInstance)) + errs := ValidateTemplateInstanceUpdate(newTemplateInstance.(*api.TemplateInstance), oldTemplateInstance) + if len(errs) != 0 && test.isValidExpected { + t.Errorf("%d: Unexpected non-empty error list: %v", i, errs.ToAggregate()) + } + if len(errs) == 0 && !test.isValidExpected { + t.Errorf("%d: Unexpected empty error list: %v", i, errs.ToAggregate()) + } + } +} + +func TestValidateBrokerTemplateInstance(t *testing.T) { + var tests = []struct { + brokerTemplateInstance api.BrokerTemplateInstance + isValidExpected bool + }{ + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + BindingIDs: []string{ + validUUID, + }, + }, + }, + isValidExpected: true, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + }, + }, + isValidExpected: true, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + BindingIDs: []string{ + "b@d", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + Namespace: "test", + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "b@d", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "b@d", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "test", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "b@d", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "b@d", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "test", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + { + brokerTemplateInstance: api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + }, + Spec: api.BrokerTemplateInstanceSpec{ + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + }, + }, + }, + } + + for i, test := range tests { + errs := ValidateBrokerTemplateInstance(&test.brokerTemplateInstance) + if len(errs) != 0 && test.isValidExpected { + t.Errorf("%d: Unexpected non-empty error list: %v", i, errs.ToAggregate()) + } + if len(errs) == 0 && !test.isValidExpected { + t.Errorf("%d: Unexpected empty error list: %v", i, errs.ToAggregate()) + } + } +} + +func TestValidateBrokerTemplateInstanceUpdate(t *testing.T) { + oldBrokerTemplateInstance := &api.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: validUUID, + ResourceVersion: "1", + }, + Spec: api.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Name: "test", + Namespace: "test", + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Name: "test", + Namespace: "test", + }, + BindingIDs: []string{ + validUUID, + }, + }, + } + + var tests = []struct { + modifyBrokerTemplateInstance func(*api.BrokerTemplateInstance) + isValidExpected bool + }{ + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + }, + isValidExpected: true, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Name = "new" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Namespace = "new" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Kind = "new" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Kind = "" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Kind = "b@d" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Name = "new" + }, + isValidExpected: true, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Name = "" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Name = "b@d" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Namespace = "new" + }, + isValidExpected: true, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Namespace = "" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.TemplateInstance.Namespace = "b@d" + }, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.BindingIDs = []string{validUUID2} + }, + isValidExpected: true, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.BindingIDs = nil + }, + isValidExpected: true, + }, + { + modifyBrokerTemplateInstance: func(new *api.BrokerTemplateInstance) { + new.Spec.BindingIDs = []string{"bad"} + }, + }, + } + + for i, test := range tests { + newBrokerTemplateInstance, err := kapi.Scheme.DeepCopy(oldBrokerTemplateInstance) + if err != nil { + t.Fatal(err) + } + test.modifyBrokerTemplateInstance(newBrokerTemplateInstance.(*api.BrokerTemplateInstance)) + errs := ValidateBrokerTemplateInstanceUpdate(newBrokerTemplateInstance.(*api.BrokerTemplateInstance), oldBrokerTemplateInstance) + if len(errs) != 0 && test.isValidExpected { + t.Errorf("%d: Unexpected non-empty error list: %v", i, errs.ToAggregate()) + } + if len(errs) == 0 && !test.isValidExpected { + t.Errorf("%d: Unexpected empty error list: %v", i, errs.ToAggregate()) + } + } +} diff --git a/pkg/template/api/zz_generated.deepcopy.go b/pkg/template/api/zz_generated.deepcopy.go index 93bd5242b46a..1bbc39118c5e 100644 --- a/pkg/template/api/zz_generated.deepcopy.go +++ b/pkg/template/api/zz_generated.deepcopy.go @@ -19,12 +19,74 @@ func init() { // to allow building arbitrary schemes. func RegisterDeepCopies(scheme *runtime.Scheme) error { return scheme.AddGeneratedDeepCopyFuncs( + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_BrokerTemplateInstance, InType: reflect.TypeOf(&BrokerTemplateInstance{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_BrokerTemplateInstanceList, InType: reflect.TypeOf(&BrokerTemplateInstanceList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_BrokerTemplateInstanceSpec, InType: reflect.TypeOf(&BrokerTemplateInstanceSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Parameter, InType: reflect.TypeOf(&Parameter{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Template, InType: reflect.TypeOf(&Template{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateInstance, InType: reflect.TypeOf(&TemplateInstance{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateInstanceCondition, InType: reflect.TypeOf(&TemplateInstanceCondition{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateInstanceList, InType: reflect.TypeOf(&TemplateInstanceList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateInstanceRequestor, InType: reflect.TypeOf(&TemplateInstanceRequestor{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateInstanceSpec, InType: reflect.TypeOf(&TemplateInstanceSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateInstanceStatus, InType: reflect.TypeOf(&TemplateInstanceStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_TemplateList, InType: reflect.TypeOf(&TemplateList{})}, ) } +func DeepCopy_api_BrokerTemplateInstance(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*BrokerTemplateInstance) + out := out.(*BrokerTemplateInstance) + out.TypeMeta = in.TypeMeta + if err := pkg_api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := DeepCopy_api_BrokerTemplateInstanceSpec(&in.Spec, &out.Spec, c); err != nil { + return err + } + return nil + } +} + +func DeepCopy_api_BrokerTemplateInstanceList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*BrokerTemplateInstanceList) + out := out.(*BrokerTemplateInstanceList) + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BrokerTemplateInstance, len(*in)) + for i := range *in { + if err := DeepCopy_api_BrokerTemplateInstance(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil + } +} + +func DeepCopy_api_BrokerTemplateInstanceSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*BrokerTemplateInstanceSpec) + out := out.(*BrokerTemplateInstanceSpec) + out.TemplateInstance = in.TemplateInstance + out.Secret = in.Secret + if in.BindingIDs != nil { + in, out := &in.BindingIDs, &out.BindingIDs + *out = make([]string, len(*in)) + copy(*out, *in) + } else { + out.BindingIDs = nil + } + return nil + } +} + func DeepCopy_api_Parameter(in interface{}, out interface{}, c *conversion.Cloner) error { { in := in.(*Parameter) @@ -84,6 +146,105 @@ func DeepCopy_api_Template(in interface{}, out interface{}, c *conversion.Cloner } } +func DeepCopy_api_TemplateInstance(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstance) + out := out.(*TemplateInstance) + out.TypeMeta = in.TypeMeta + if err := pkg_api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := DeepCopy_api_TemplateInstanceSpec(&in.Spec, &out.Spec, c); err != nil { + return err + } + if err := DeepCopy_api_TemplateInstanceStatus(&in.Status, &out.Status, c); err != nil { + return err + } + return nil + } +} + +func DeepCopy_api_TemplateInstanceCondition(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceCondition) + out := out.(*TemplateInstanceCondition) + out.Type = in.Type + out.Status = in.Status + out.LastTransitionTime = in.LastTransitionTime.DeepCopy() + out.Reason = in.Reason + out.Message = in.Message + return nil + } +} + +func DeepCopy_api_TemplateInstanceList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceList) + out := out.(*TemplateInstanceList) + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TemplateInstance, len(*in)) + for i := range *in { + if err := DeepCopy_api_TemplateInstance(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil + } +} + +func DeepCopy_api_TemplateInstanceRequestor(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceRequestor) + out := out.(*TemplateInstanceRequestor) + out.Username = in.Username + return nil + } +} + +func DeepCopy_api_TemplateInstanceSpec(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceSpec) + out := out.(*TemplateInstanceSpec) + if err := DeepCopy_api_Template(&in.Template, &out.Template, c); err != nil { + return err + } + out.Secret = in.Secret + if in.Requestor != nil { + in, out := &in.Requestor, &out.Requestor + *out = new(TemplateInstanceRequestor) + **out = **in + } else { + out.Requestor = nil + } + return nil + } +} + +func DeepCopy_api_TemplateInstanceStatus(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*TemplateInstanceStatus) + out := out.(*TemplateInstanceStatus) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]TemplateInstanceCondition, len(*in)) + for i := range *in { + if err := DeepCopy_api_TemplateInstanceCondition(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil + } +} + func DeepCopy_api_TemplateList(in interface{}, out interface{}, c *conversion.Cloner) error { { in := in.(*TemplateList) diff --git a/pkg/template/clientset/internalclientset/clientset.go b/pkg/template/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..8b7c3361afbf --- /dev/null +++ b/pkg/template/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversiontemplate "github.com/openshift/origin/pkg/template/clientset/internalclientset/typed/template/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + Template() internalversiontemplate.TemplateInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversiontemplate.TemplateClient +} + +// Template retrieves the TemplateClient +func (c *Clientset) Template() internalversiontemplate.TemplateInterface { + if c == nil { + return nil + } + return c.TemplateClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.TemplateClient, err = internalversiontemplate.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.TemplateClient = internalversiontemplate.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.TemplateClient = internalversiontemplate.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/template/clientset/internalclientset/doc.go b/pkg/template/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..2c7a687fb613 --- /dev/null +++ b/pkg/template/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/template/clientset/internalclientset/fake/clientset_generated.go b/pkg/template/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..09bb037f3d54 --- /dev/null +++ b/pkg/template/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/template/clientset/internalclientset" + internalversiontemplate "github.com/openshift/origin/pkg/template/clientset/internalclientset/typed/template/internalversion" + fakeinternalversiontemplate "github.com/openshift/origin/pkg/template/clientset/internalclientset/typed/template/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// Template retrieves the TemplateClient +func (c *Clientset) Template() internalversiontemplate.TemplateInterface { + return &fakeinternalversiontemplate.FakeTemplate{Fake: &c.Fake} +} diff --git a/pkg/template/clientset/internalclientset/fake/doc.go b/pkg/template/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..912fd076cfc4 --- /dev/null +++ b/pkg/template/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/brokertemplateinstance.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/brokertemplateinstance.go new file mode 100644 index 000000000000..d32649da2d1f --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/brokertemplateinstance.go @@ -0,0 +1,126 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// BrokerTemplateInstancesGetter has a method to return a BrokerTemplateInstanceInterface. +// A group's client should implement this interface. +type BrokerTemplateInstancesGetter interface { + BrokerTemplateInstances() BrokerTemplateInstanceInterface +} + +// BrokerTemplateInstanceInterface has methods to work with BrokerTemplateInstance resources. +type BrokerTemplateInstanceInterface interface { + Create(*api.BrokerTemplateInstance) (*api.BrokerTemplateInstance, error) + Update(*api.BrokerTemplateInstance) (*api.BrokerTemplateInstance, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.BrokerTemplateInstance, error) + List(opts pkg_api.ListOptions) (*api.BrokerTemplateInstanceList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.BrokerTemplateInstance, err error) + BrokerTemplateInstanceExpansion +} + +// brokerTemplateInstances implements BrokerTemplateInstanceInterface +type brokerTemplateInstances struct { + client restclient.Interface +} + +// newBrokerTemplateInstances returns a BrokerTemplateInstances +func newBrokerTemplateInstances(c *TemplateClient) *brokerTemplateInstances { + return &brokerTemplateInstances{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a brokerTemplateInstance and creates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *brokerTemplateInstances) Create(brokerTemplateInstance *api.BrokerTemplateInstance) (result *api.BrokerTemplateInstance, err error) { + result = &api.BrokerTemplateInstance{} + err = c.client.Post(). + Resource("brokertemplateinstances"). + Body(brokerTemplateInstance). + Do(). + Into(result) + return +} + +// Update takes the representation of a brokerTemplateInstance and updates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *brokerTemplateInstances) Update(brokerTemplateInstance *api.BrokerTemplateInstance) (result *api.BrokerTemplateInstance, err error) { + result = &api.BrokerTemplateInstance{} + err = c.client.Put(). + Resource("brokertemplateinstances"). + Name(brokerTemplateInstance.Name). + Body(brokerTemplateInstance). + Do(). + Into(result) + return +} + +// Delete takes name of the brokerTemplateInstance and deletes it. Returns an error if one occurs. +func (c *brokerTemplateInstances) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Resource("brokertemplateinstances"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *brokerTemplateInstances) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Resource("brokertemplateinstances"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the brokerTemplateInstance, and returns the corresponding brokerTemplateInstance object, and an error if there is any. +func (c *brokerTemplateInstances) Get(name string) (result *api.BrokerTemplateInstance, err error) { + result = &api.BrokerTemplateInstance{} + err = c.client.Get(). + Resource("brokertemplateinstances"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BrokerTemplateInstances that match those selectors. +func (c *brokerTemplateInstances) List(opts pkg_api.ListOptions) (result *api.BrokerTemplateInstanceList, err error) { + result = &api.BrokerTemplateInstanceList{} + err = c.client.Get(). + Resource("brokertemplateinstances"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested brokerTemplateInstances. +func (c *brokerTemplateInstances) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("brokertemplateinstances"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched brokerTemplateInstance. +func (c *brokerTemplateInstances) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.BrokerTemplateInstance, err error) { + result = &api.BrokerTemplateInstance{} + err = c.client.Patch(pt). + Resource("brokertemplateinstances"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/doc.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/doc.go new file mode 100644 index 000000000000..3bdd3619c048 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/doc.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/doc.go new file mode 100644 index 000000000000..531af2cbfd1f --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_brokertemplateinstance.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_brokertemplateinstance.go new file mode 100644 index 000000000000..bdee148669da --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_brokertemplateinstance.go @@ -0,0 +1,93 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeBrokerTemplateInstances implements BrokerTemplateInstanceInterface +type FakeBrokerTemplateInstances struct { + Fake *FakeTemplate +} + +var brokertemplateinstancesResource = unversioned.GroupVersionResource{Group: "template.openshift.io", Version: "", Resource: "brokertemplateinstances"} + +func (c *FakeBrokerTemplateInstances) Create(brokerTemplateInstance *api.BrokerTemplateInstance) (result *api.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction(brokertemplateinstancesResource, brokerTemplateInstance), &api.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*api.BrokerTemplateInstance), err +} + +func (c *FakeBrokerTemplateInstances) Update(brokerTemplateInstance *api.BrokerTemplateInstance) (result *api.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction(brokertemplateinstancesResource, brokerTemplateInstance), &api.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*api.BrokerTemplateInstance), err +} + +func (c *FakeBrokerTemplateInstances) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction(brokertemplateinstancesResource, name), &api.BrokerTemplateInstance{}) + return err +} + +func (c *FakeBrokerTemplateInstances) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewRootDeleteCollectionAction(brokertemplateinstancesResource, listOptions) + + _, err := c.Fake.Invokes(action, &api.BrokerTemplateInstanceList{}) + return err +} + +func (c *FakeBrokerTemplateInstances) Get(name string) (result *api.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction(brokertemplateinstancesResource, name), &api.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*api.BrokerTemplateInstance), err +} + +func (c *FakeBrokerTemplateInstances) List(opts pkg_api.ListOptions) (result *api.BrokerTemplateInstanceList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction(brokertemplateinstancesResource, opts), &api.BrokerTemplateInstanceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.BrokerTemplateInstanceList{} + for _, item := range obj.(*api.BrokerTemplateInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested brokerTemplateInstances. +func (c *FakeBrokerTemplateInstances) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction(brokertemplateinstancesResource, opts)) +} + +// Patch applies the patch and returns the patched brokerTemplateInstance. +func (c *FakeBrokerTemplateInstances) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootPatchSubresourceAction(brokertemplateinstancesResource, name, data, subresources...), &api.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*api.BrokerTemplateInstance), err +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_template.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_template.go new file mode 100644 index 000000000000..01ea76390114 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_template.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeTemplates implements TemplateResourceInterface +type FakeTemplates struct { + Fake *FakeTemplate + ns string +} + +var templatesResource = unversioned.GroupVersionResource{Group: "template.openshift.io", Version: "", Resource: "templates"} + +func (c *FakeTemplates) Create(template *api.Template) (result *api.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(templatesResource, c.ns, template), &api.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Template), err +} + +func (c *FakeTemplates) Update(template *api.Template) (result *api.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(templatesResource, c.ns, template), &api.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Template), err +} + +func (c *FakeTemplates) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(templatesResource, c.ns, name), &api.Template{}) + + return err +} + +func (c *FakeTemplates) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(templatesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.TemplateList{}) + return err +} + +func (c *FakeTemplates) Get(name string) (result *api.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(templatesResource, c.ns, name), &api.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Template), err +} + +func (c *FakeTemplates) List(opts pkg_api.ListOptions) (result *api.TemplateList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(templatesResource, c.ns, opts), &api.TemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.TemplateList{} + for _, item := range obj.(*api.TemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *FakeTemplates) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(templatesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched template. +func (c *FakeTemplates) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(templatesResource, c.ns, name, data, subresources...), &api.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*api.Template), err +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_template_client.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_template_client.go new file mode 100644 index 000000000000..acf5bfc7cbc6 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_template_client.go @@ -0,0 +1,30 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/template/clientset/internalclientset/typed/template/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeTemplate struct { + *core.Fake +} + +func (c *FakeTemplate) BrokerTemplateInstances() internalversion.BrokerTemplateInstanceInterface { + return &FakeBrokerTemplateInstances{c} +} + +func (c *FakeTemplate) Templates(namespace string) internalversion.TemplateResourceInterface { + return &FakeTemplates{c, namespace} +} + +func (c *FakeTemplate) TemplateInstances(namespace string) internalversion.TemplateInstanceInterface { + return &FakeTemplateInstances{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTemplate) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_templateinstance.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_templateinstance.go new file mode 100644 index 000000000000..485f1796f7f2 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/fake/fake_templateinstance.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeTemplateInstances implements TemplateInstanceInterface +type FakeTemplateInstances struct { + Fake *FakeTemplate + ns string +} + +var templateinstancesResource = unversioned.GroupVersionResource{Group: "template.openshift.io", Version: "", Resource: "templateinstances"} + +func (c *FakeTemplateInstances) Create(templateInstance *api.TemplateInstance) (result *api.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(templateinstancesResource, c.ns, templateInstance), &api.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*api.TemplateInstance), err +} + +func (c *FakeTemplateInstances) Update(templateInstance *api.TemplateInstance) (result *api.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(templateinstancesResource, c.ns, templateInstance), &api.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*api.TemplateInstance), err +} + +func (c *FakeTemplateInstances) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(templateinstancesResource, c.ns, name), &api.TemplateInstance{}) + + return err +} + +func (c *FakeTemplateInstances) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(templateinstancesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.TemplateInstanceList{}) + return err +} + +func (c *FakeTemplateInstances) Get(name string) (result *api.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(templateinstancesResource, c.ns, name), &api.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*api.TemplateInstance), err +} + +func (c *FakeTemplateInstances) List(opts pkg_api.ListOptions) (result *api.TemplateInstanceList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(templateinstancesResource, c.ns, opts), &api.TemplateInstanceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.TemplateInstanceList{} + for _, item := range obj.(*api.TemplateInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templateInstances. +func (c *FakeTemplateInstances) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(templateinstancesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched templateInstance. +func (c *FakeTemplateInstances) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(templateinstancesResource, c.ns, name, data, subresources...), &api.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*api.TemplateInstance), err +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/generated_expansion.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/generated_expansion.go new file mode 100644 index 000000000000..6f8eefa22f87 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/generated_expansion.go @@ -0,0 +1,7 @@ +package internalversion + +type BrokerTemplateInstanceExpansion interface{} + +type TemplateResourceExpansion interface{} + +type TemplateInstanceExpansion interface{} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/template.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/template.go new file mode 100644 index 000000000000..08739b2619c5 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/template.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// TemplatesGetter has a method to return a TemplateResourceInterface. +// A group's client should implement this interface. +type TemplatesGetter interface { + Templates(namespace string) TemplateResourceInterface +} + +// TemplateResourceInterface has methods to work with TemplateResource resources. +type TemplateResourceInterface interface { + Create(*api.Template) (*api.Template, error) + Update(*api.Template) (*api.Template, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.Template, error) + List(opts pkg_api.ListOptions) (*api.TemplateList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Template, err error) + TemplateResourceExpansion +} + +// templates implements TemplateResourceInterface +type templates struct { + client restclient.Interface + ns string +} + +// newTemplates returns a Templates +func newTemplates(c *TemplateClient, namespace string) *templates { + return &templates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Create(template *api.Template) (result *api.Template, err error) { + result = &api.Template{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templates"). + Body(template). + Do(). + Into(result) + return +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Update(template *api.Template) (result *api.Template, err error) { + result = &api.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + Body(template). + Do(). + Into(result) + return +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *templates) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templates) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *templates) Get(name string) (result *api.Template, err error) { + result = &api.Template{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *templates) List(opts pkg_api.ListOptions) (result *api.TemplateList, err error) { + result = &api.TemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *templates) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched template. +func (c *templates) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Template, err error) { + result = &api.Template{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/template_client.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/template_client.go new file mode 100644 index 000000000000..3a21072daa35 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/template_client.go @@ -0,0 +1,93 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type TemplateInterface interface { + RESTClient() restclient.Interface + BrokerTemplateInstancesGetter + TemplatesGetter + TemplateInstancesGetter +} + +// TemplateClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type TemplateClient struct { + restClient restclient.Interface +} + +func (c *TemplateClient) BrokerTemplateInstances() BrokerTemplateInstanceInterface { + return newBrokerTemplateInstances(c) +} + +func (c *TemplateClient) Templates(namespace string) TemplateResourceInterface { + return newTemplates(c, namespace) +} + +func (c *TemplateClient) TemplateInstances(namespace string) TemplateInstanceInterface { + return newTemplateInstances(c, namespace) +} + +// NewForConfig creates a new TemplateClient for the given config. +func NewForConfig(c *restclient.Config) (*TemplateClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &TemplateClient{client}, nil +} + +// NewForConfigOrDie creates a new TemplateClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *TemplateClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TemplateClient for the given RESTClient. +func New(c restclient.Interface) *TemplateClient { + return &TemplateClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if template group is not registered, return an error + g, err := registered.Group("template.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TemplateClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/template/clientset/internalclientset/typed/template/internalversion/templateinstance.go b/pkg/template/clientset/internalclientset/typed/template/internalversion/templateinstance.go new file mode 100644 index 000000000000..9ca3ca4ac4e9 --- /dev/null +++ b/pkg/template/clientset/internalclientset/typed/template/internalversion/templateinstance.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/template/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// TemplateInstancesGetter has a method to return a TemplateInstanceInterface. +// A group's client should implement this interface. +type TemplateInstancesGetter interface { + TemplateInstances(namespace string) TemplateInstanceInterface +} + +// TemplateInstanceInterface has methods to work with TemplateInstance resources. +type TemplateInstanceInterface interface { + Create(*api.TemplateInstance) (*api.TemplateInstance, error) + Update(*api.TemplateInstance) (*api.TemplateInstance, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.TemplateInstance, error) + List(opts pkg_api.ListOptions) (*api.TemplateInstanceList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.TemplateInstance, err error) + TemplateInstanceExpansion +} + +// templateInstances implements TemplateInstanceInterface +type templateInstances struct { + client restclient.Interface + ns string +} + +// newTemplateInstances returns a TemplateInstances +func newTemplateInstances(c *TemplateClient, namespace string) *templateInstances { + return &templateInstances{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a templateInstance and creates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *templateInstances) Create(templateInstance *api.TemplateInstance) (result *api.TemplateInstance, err error) { + result = &api.TemplateInstance{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templateinstances"). + Body(templateInstance). + Do(). + Into(result) + return +} + +// Update takes the representation of a templateInstance and updates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *templateInstances) Update(templateInstance *api.TemplateInstance) (result *api.TemplateInstance, err error) { + result = &api.TemplateInstance{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templateinstances"). + Name(templateInstance.Name). + Body(templateInstance). + Do(). + Into(result) + return +} + +// Delete takes name of the templateInstance and deletes it. Returns an error if one occurs. +func (c *templateInstances) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templateinstances"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templateInstances) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the templateInstance, and returns the corresponding templateInstance object, and an error if there is any. +func (c *templateInstances) Get(name string) (result *api.TemplateInstance, err error) { + result = &api.TemplateInstance{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TemplateInstances that match those selectors. +func (c *templateInstances) List(opts pkg_api.ListOptions) (result *api.TemplateInstanceList, err error) { + result = &api.TemplateInstanceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templateInstances. +func (c *templateInstances) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched templateInstance. +func (c *templateInstances) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.TemplateInstance, err error) { + result = &api.TemplateInstance{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templateinstances"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/template/clientset/release_v3_6/clientset.go b/pkg/template/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..8fecbc687a44 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1template "github.com/openshift/origin/pkg/template/clientset/release_v3_6/typed/template/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + TemplateV1() v1template.TemplateV1Interface + // Deprecated: please explicitly pick a version if possible. + Template() v1template.TemplateV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1template.TemplateV1Client +} + +// TemplateV1 retrieves the TemplateV1Client +func (c *Clientset) TemplateV1() v1template.TemplateV1Interface { + if c == nil { + return nil + } + return c.TemplateV1Client +} + +// Deprecated: Template retrieves the default version of TemplateClient. +// Please explicitly pick a version. +func (c *Clientset) Template() v1template.TemplateV1Interface { + if c == nil { + return nil + } + return c.TemplateV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.TemplateV1Client, err = v1template.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.TemplateV1Client = v1template.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.TemplateV1Client = v1template.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/template/clientset/release_v3_6/doc.go b/pkg/template/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..63a692219209 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/v1] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/template/clientset/release_v3_6/fake/clientset_generated.go b/pkg/template/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..9962115c23a6 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/template/clientset/release_v3_6" + v1template "github.com/openshift/origin/pkg/template/clientset/release_v3_6/typed/template/v1" + fakev1template "github.com/openshift/origin/pkg/template/clientset/release_v3_6/typed/template/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// TemplateV1 retrieves the TemplateV1Client +func (c *Clientset) TemplateV1() v1template.TemplateV1Interface { + return &fakev1template.FakeTemplateV1{Fake: &c.Fake} +} + +// Template retrieves the TemplateV1Client +func (c *Clientset) Template() v1template.TemplateV1Interface { + return &fakev1template.FakeTemplateV1{Fake: &c.Fake} +} diff --git a/pkg/template/clientset/release_v3_6/fake/doc.go b/pkg/template/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..15ce9a899d1a --- /dev/null +++ b/pkg/template/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/v1] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/brokertemplateinstance.go b/pkg/template/clientset/release_v3_6/typed/template/v1/brokertemplateinstance.go new file mode 100644 index 000000000000..ceedd513d819 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/brokertemplateinstance.go @@ -0,0 +1,127 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/template/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// BrokerTemplateInstancesGetter has a method to return a BrokerTemplateInstanceInterface. +// A group's client should implement this interface. +type BrokerTemplateInstancesGetter interface { + BrokerTemplateInstances() BrokerTemplateInstanceInterface +} + +// BrokerTemplateInstanceInterface has methods to work with BrokerTemplateInstance resources. +type BrokerTemplateInstanceInterface interface { + Create(*v1.BrokerTemplateInstance) (*v1.BrokerTemplateInstance, error) + Update(*v1.BrokerTemplateInstance) (*v1.BrokerTemplateInstance, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.BrokerTemplateInstance, error) + List(opts api_v1.ListOptions) (*v1.BrokerTemplateInstanceList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.BrokerTemplateInstance, err error) + BrokerTemplateInstanceExpansion +} + +// brokerTemplateInstances implements BrokerTemplateInstanceInterface +type brokerTemplateInstances struct { + client restclient.Interface +} + +// newBrokerTemplateInstances returns a BrokerTemplateInstances +func newBrokerTemplateInstances(c *TemplateV1Client) *brokerTemplateInstances { + return &brokerTemplateInstances{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a brokerTemplateInstance and creates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *brokerTemplateInstances) Create(brokerTemplateInstance *v1.BrokerTemplateInstance) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Post(). + Resource("brokertemplateinstances"). + Body(brokerTemplateInstance). + Do(). + Into(result) + return +} + +// Update takes the representation of a brokerTemplateInstance and updates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *brokerTemplateInstances) Update(brokerTemplateInstance *v1.BrokerTemplateInstance) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Put(). + Resource("brokertemplateinstances"). + Name(brokerTemplateInstance.Name). + Body(brokerTemplateInstance). + Do(). + Into(result) + return +} + +// Delete takes name of the brokerTemplateInstance and deletes it. Returns an error if one occurs. +func (c *brokerTemplateInstances) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("brokertemplateinstances"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *brokerTemplateInstances) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Resource("brokertemplateinstances"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the brokerTemplateInstance, and returns the corresponding brokerTemplateInstance object, and an error if there is any. +func (c *brokerTemplateInstances) Get(name string) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Get(). + Resource("brokertemplateinstances"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BrokerTemplateInstances that match those selectors. +func (c *brokerTemplateInstances) List(opts api_v1.ListOptions) (result *v1.BrokerTemplateInstanceList, err error) { + result = &v1.BrokerTemplateInstanceList{} + err = c.client.Get(). + Resource("brokertemplateinstances"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested brokerTemplateInstances. +func (c *brokerTemplateInstances) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("brokertemplateinstances"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched brokerTemplateInstance. +func (c *brokerTemplateInstances) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Patch(pt). + Resource("brokertemplateinstances"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/doc.go b/pkg/template/clientset/release_v3_6/typed/template/v1/doc.go new file mode 100644 index 000000000000..11358315c3ad --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/v1] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/fake/doc.go b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/doc.go new file mode 100644 index 000000000000..8a136b595b32 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/template/clientset --go-header-file=hack/boilerplate.txt --group=template --input=[api/v1] --input-base=github.com/openshift/origin/pkg/template --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_brokertemplateinstance.go b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_brokertemplateinstance.go new file mode 100644 index 000000000000..ab47bb3a0f24 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_brokertemplateinstance.go @@ -0,0 +1,94 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/template/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeBrokerTemplateInstances implements BrokerTemplateInstanceInterface +type FakeBrokerTemplateInstances struct { + Fake *FakeTemplateV1 +} + +var brokertemplateinstancesResource = unversioned.GroupVersionResource{Group: "template.openshift.io", Version: "v1", Resource: "brokertemplateinstances"} + +func (c *FakeBrokerTemplateInstances) Create(brokerTemplateInstance *v1.BrokerTemplateInstance) (result *v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootCreateAction(brokertemplateinstancesResource, brokerTemplateInstance), &v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BrokerTemplateInstance), err +} + +func (c *FakeBrokerTemplateInstances) Update(brokerTemplateInstance *v1.BrokerTemplateInstance) (result *v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootUpdateAction(brokertemplateinstancesResource, brokerTemplateInstance), &v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BrokerTemplateInstance), err +} + +func (c *FakeBrokerTemplateInstances) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewRootDeleteAction(brokertemplateinstancesResource, name), &v1.BrokerTemplateInstance{}) + return err +} + +func (c *FakeBrokerTemplateInstances) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewRootDeleteCollectionAction(brokertemplateinstancesResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1.BrokerTemplateInstanceList{}) + return err +} + +func (c *FakeBrokerTemplateInstances) Get(name string) (result *v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootGetAction(brokertemplateinstancesResource, name), &v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BrokerTemplateInstance), err +} + +func (c *FakeBrokerTemplateInstances) List(opts api_v1.ListOptions) (result *v1.BrokerTemplateInstanceList, err error) { + obj, err := c.Fake. + Invokes(core.NewRootListAction(brokertemplateinstancesResource, opts), &v1.BrokerTemplateInstanceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.BrokerTemplateInstanceList{} + for _, item := range obj.(*v1.BrokerTemplateInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested brokerTemplateInstances. +func (c *FakeBrokerTemplateInstances) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewRootWatchAction(brokertemplateinstancesResource, opts)) +} + +// Patch applies the patch and returns the patched brokerTemplateInstance. +func (c *FakeBrokerTemplateInstances) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewRootPatchSubresourceAction(brokertemplateinstancesResource, name, data, subresources...), &v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BrokerTemplateInstance), err +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_template.go b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_template.go new file mode 100644 index 000000000000..469beb8d80d1 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_template.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/template/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeTemplates implements TemplateResourceInterface +type FakeTemplates struct { + Fake *FakeTemplateV1 + ns string +} + +var templatesResource = unversioned.GroupVersionResource{Group: "template.openshift.io", Version: "v1", Resource: "templates"} + +func (c *FakeTemplates) Create(template *v1.Template) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(templatesResource, c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +func (c *FakeTemplates) Update(template *v1.Template) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(templatesResource, c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +func (c *FakeTemplates) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(templatesResource, c.ns, name), &v1.Template{}) + + return err +} + +func (c *FakeTemplates) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(templatesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.TemplateList{}) + return err +} + +func (c *FakeTemplates) Get(name string) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(templatesResource, c.ns, name), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +func (c *FakeTemplates) List(opts api_v1.ListOptions) (result *v1.TemplateList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(templatesResource, c.ns, opts), &v1.TemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.TemplateList{} + for _, item := range obj.(*v1.TemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *FakeTemplates) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(templatesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched template. +func (c *FakeTemplates) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(templatesResource, c.ns, name, data, subresources...), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_template_client.go b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_template_client.go new file mode 100644 index 000000000000..6fddb7d21098 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_template_client.go @@ -0,0 +1,30 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/template/clientset/release_v3_6/typed/template/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeTemplateV1 struct { + *core.Fake +} + +func (c *FakeTemplateV1) BrokerTemplateInstances() v1.BrokerTemplateInstanceInterface { + return &FakeBrokerTemplateInstances{c} +} + +func (c *FakeTemplateV1) Templates(namespace string) v1.TemplateResourceInterface { + return &FakeTemplates{c, namespace} +} + +func (c *FakeTemplateV1) TemplateInstances(namespace string) v1.TemplateInstanceInterface { + return &FakeTemplateInstances{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTemplateV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_templateinstance.go b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_templateinstance.go new file mode 100644 index 000000000000..7fd21d9ca3ea --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/fake/fake_templateinstance.go @@ -0,0 +1,112 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/template/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeTemplateInstances implements TemplateInstanceInterface +type FakeTemplateInstances struct { + Fake *FakeTemplateV1 + ns string +} + +var templateinstancesResource = unversioned.GroupVersionResource{Group: "template.openshift.io", Version: "v1", Resource: "templateinstances"} + +func (c *FakeTemplateInstances) Create(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(templateinstancesResource, c.ns, templateInstance), &v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TemplateInstance), err +} + +func (c *FakeTemplateInstances) Update(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(templateinstancesResource, c.ns, templateInstance), &v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TemplateInstance), err +} + +func (c *FakeTemplateInstances) UpdateStatus(templateInstance *v1.TemplateInstance) (*v1.TemplateInstance, error) { + obj, err := c.Fake. + Invokes(core.NewUpdateSubresourceAction(templateinstancesResource, "status", c.ns, templateInstance), &v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TemplateInstance), err +} + +func (c *FakeTemplateInstances) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(templateinstancesResource, c.ns, name), &v1.TemplateInstance{}) + + return err +} + +func (c *FakeTemplateInstances) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(templateinstancesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.TemplateInstanceList{}) + return err +} + +func (c *FakeTemplateInstances) Get(name string) (result *v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(templateinstancesResource, c.ns, name), &v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TemplateInstance), err +} + +func (c *FakeTemplateInstances) List(opts api_v1.ListOptions) (result *v1.TemplateInstanceList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(templateinstancesResource, c.ns, opts), &v1.TemplateInstanceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.TemplateInstanceList{} + for _, item := range obj.(*v1.TemplateInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templateInstances. +func (c *FakeTemplateInstances) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(templateinstancesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched templateInstance. +func (c *FakeTemplateInstances) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(templateinstancesResource, c.ns, name, data, subresources...), &v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TemplateInstance), err +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/generated_expansion.go b/pkg/template/clientset/release_v3_6/typed/template/v1/generated_expansion.go new file mode 100644 index 000000000000..f68453f2f7c4 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/generated_expansion.go @@ -0,0 +1,7 @@ +package v1 + +type BrokerTemplateInstanceExpansion interface{} + +type TemplateResourceExpansion interface{} + +type TemplateInstanceExpansion interface{} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/template.go b/pkg/template/clientset/release_v3_6/typed/template/v1/template.go new file mode 100644 index 000000000000..f8fa0ae23266 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/template.go @@ -0,0 +1,137 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/template/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// TemplatesGetter has a method to return a TemplateResourceInterface. +// A group's client should implement this interface. +type TemplatesGetter interface { + Templates(namespace string) TemplateResourceInterface +} + +// TemplateResourceInterface has methods to work with TemplateResource resources. +type TemplateResourceInterface interface { + Create(*v1.Template) (*v1.Template, error) + Update(*v1.Template) (*v1.Template, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.Template, error) + List(opts api_v1.ListOptions) (*v1.TemplateList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Template, err error) + TemplateResourceExpansion +} + +// templates implements TemplateResourceInterface +type templates struct { + client restclient.Interface + ns string +} + +// newTemplates returns a Templates +func newTemplates(c *TemplateV1Client, namespace string) *templates { + return &templates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Create(template *v1.Template) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templates"). + Body(template). + Do(). + Into(result) + return +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Update(template *v1.Template) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + Body(template). + Do(). + Into(result) + return +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *templates) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templates) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *templates) Get(name string) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *templates) List(opts api_v1.ListOptions) (result *v1.TemplateList, err error) { + result = &v1.TemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *templates) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched template. +func (c *templates) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/template_client.go b/pkg/template/clientset/release_v3_6/typed/template/v1/template_client.go new file mode 100644 index 000000000000..daef0e39e227 --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/template_client.go @@ -0,0 +1,92 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type TemplateV1Interface interface { + RESTClient() restclient.Interface + BrokerTemplateInstancesGetter + TemplatesGetter + TemplateInstancesGetter +} + +// TemplateV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type TemplateV1Client struct { + restClient restclient.Interface +} + +func (c *TemplateV1Client) BrokerTemplateInstances() BrokerTemplateInstanceInterface { + return newBrokerTemplateInstances(c) +} + +func (c *TemplateV1Client) Templates(namespace string) TemplateResourceInterface { + return newTemplates(c, namespace) +} + +func (c *TemplateV1Client) TemplateInstances(namespace string) TemplateInstanceInterface { + return newTemplateInstances(c, namespace) +} + +// NewForConfig creates a new TemplateV1Client for the given config. +func NewForConfig(c *restclient.Config) (*TemplateV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &TemplateV1Client{client}, nil +} + +// NewForConfigOrDie creates a new TemplateV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *TemplateV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TemplateV1Client for the given RESTClient. +func New(c restclient.Interface) *TemplateV1Client { + return &TemplateV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("template.openshift.io/v1") + if err != nil { + return err + } + // if template.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("template.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TemplateV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/template/clientset/release_v3_6/typed/template/v1/templateinstance.go b/pkg/template/clientset/release_v3_6/typed/template/v1/templateinstance.go new file mode 100644 index 000000000000..411871fba25e --- /dev/null +++ b/pkg/template/clientset/release_v3_6/typed/template/v1/templateinstance.go @@ -0,0 +1,151 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/template/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// TemplateInstancesGetter has a method to return a TemplateInstanceInterface. +// A group's client should implement this interface. +type TemplateInstancesGetter interface { + TemplateInstances(namespace string) TemplateInstanceInterface +} + +// TemplateInstanceInterface has methods to work with TemplateInstance resources. +type TemplateInstanceInterface interface { + Create(*v1.TemplateInstance) (*v1.TemplateInstance, error) + Update(*v1.TemplateInstance) (*v1.TemplateInstance, error) + UpdateStatus(*v1.TemplateInstance) (*v1.TemplateInstance, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.TemplateInstance, error) + List(opts api_v1.ListOptions) (*v1.TemplateInstanceList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.TemplateInstance, err error) + TemplateInstanceExpansion +} + +// templateInstances implements TemplateInstanceInterface +type templateInstances struct { + client restclient.Interface + ns string +} + +// newTemplateInstances returns a TemplateInstances +func newTemplateInstances(c *TemplateV1Client, namespace string) *templateInstances { + return &templateInstances{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a templateInstance and creates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *templateInstances) Create(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templateinstances"). + Body(templateInstance). + Do(). + Into(result) + return +} + +// Update takes the representation of a templateInstance and updates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *templateInstances) Update(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templateinstances"). + Name(templateInstance.Name). + Body(templateInstance). + Do(). + Into(result) + return +} + +func (c *templateInstances) UpdateStatus(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templateinstances"). + Name(templateInstance.Name). + SubResource("status"). + Body(templateInstance). + Do(). + Into(result) + return +} + +// Delete takes name of the templateInstance and deletes it. Returns an error if one occurs. +func (c *templateInstances) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templateinstances"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templateInstances) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the templateInstance, and returns the corresponding templateInstance object, and an error if there is any. +func (c *templateInstances) Get(name string) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TemplateInstances that match those selectors. +func (c *templateInstances) List(opts api_v1.ListOptions) (result *v1.TemplateInstanceList, err error) { + result = &v1.TemplateInstanceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templateInstances. +func (c *templateInstances) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched templateInstance. +func (c *templateInstances) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templateinstances"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/template/controller/templateinstance_controller.go b/pkg/template/controller/templateinstance_controller.go new file mode 100644 index 000000000000..29d65462ac41 --- /dev/null +++ b/pkg/template/controller/templateinstance_controller.go @@ -0,0 +1,189 @@ +package controller + +import ( + "fmt" + "net/http" + + "github.com/openshift/origin/pkg/api/latest" + authclient "github.com/openshift/origin/pkg/auth/client" + "github.com/openshift/origin/pkg/client" + "github.com/openshift/origin/pkg/config/cmd" + templateapi "github.com/openshift/origin/pkg/template/api" + templateapiv1 "github.com/openshift/origin/pkg/template/api/v1" + templateclientset "github.com/openshift/origin/pkg/template/clientset/internalclientset" + kapi "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/meta" + "k8s.io/kubernetes/pkg/api/meta/metatypes" + "k8s.io/kubernetes/pkg/api/unversioned" + "k8s.io/kubernetes/pkg/auth/user" + "k8s.io/kubernetes/pkg/client/cache" + kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/kubernetes/pkg/client/restclient" + "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/runtime" + utilruntime "k8s.io/kubernetes/pkg/util/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +type TemplateInstanceController struct { + restconfig *restclient.Config + templateclient *templateclientset.Clientset + controller *cache.Controller +} + +func NewTemplateInstanceController(restconfig *restclient.Config) *TemplateInstanceController { + c := TemplateInstanceController{restconfig: restconfig, templateclient: templateclientset.NewForConfigOrDie(restconfig)} + + _, c.controller = cache.NewInformer( + &cache.ListWatch{ + ListFunc: func(options kapi.ListOptions) (runtime.Object, error) { + return c.templateclient.TemplateInstances(kapi.NamespaceAll).List(options) + }, + WatchFunc: func(options kapi.ListOptions) (watch.Interface, error) { + return c.templateclient.TemplateInstances(kapi.NamespaceAll).Watch(options) + }, + }, + &templateapi.TemplateInstance{}, + 0, + cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + c.handle(obj.(*templateapi.TemplateInstance)) + }, + UpdateFunc: func(_, obj interface{}) { + c.handle(obj.(*templateapi.TemplateInstance)) + }, + DeleteFunc: func(obj interface{}) { + }, + }, + ) + + return &c +} + +func (c *TemplateInstanceController) Run(stop <-chan struct{}) { + c.controller.Run(stop) +} + +func (c *TemplateInstanceController) handle(templateInstance *templateapi.TemplateInstance) error { + for _, condition := range templateInstance.Status.Conditions { + if condition.Type == templateapi.TemplateInstanceReady && condition.Status == kapi.ConditionTrue || + condition.Type == templateapi.TemplateInstanceInstantiateFailure && condition.Status == kapi.ConditionTrue { + return nil + } + } + + err := c.provision(templateInstance) + if err == nil { + templateInstance.Status.Conditions = []templateapi.TemplateInstanceCondition{ + { + Type: templateapi.TemplateInstanceReady, + Status: kapi.ConditionTrue, + LastTransitionTime: unversioned.Now(), + Reason: "Created", + }, + } + + } else { + templateInstance.Status.Conditions = []templateapi.TemplateInstanceCondition{ + { + Type: templateapi.TemplateInstanceInstantiateFailure, + Status: kapi.ConditionTrue, + LastTransitionTime: unversioned.Now(), + Reason: "Failed", + Message: err.Error(), + }, + } + } + + _, err = c.templateclient.TemplateInstances(templateInstance.Namespace).Update(templateInstance) + if err != nil { + utilruntime.HandleError(fmt.Errorf("TemplateInstance update failed: %v", err)) + } + return err +} + +func (c *TemplateInstanceController) provision(templateInstance *templateapi.TemplateInstance) error { + if templateInstance.Spec.Requestor == nil || templateInstance.Spec.Requestor.Username == "" { + return fmt.Errorf("spec.requestor.username not set") + } + + restconfigCopy := *c.restconfig + restconfigCopy.WrapTransport = func(rt http.RoundTripper) http.RoundTripper { + return authclient.NewImpersonatingRoundTripper(&user.DefaultInfo{Name: templateInstance.Spec.Requestor.Username}, c.restconfig.WrapTransport(rt)) + } + + impersonatedOC, err := client.New(&restconfigCopy) + if err != nil { + return err + } + + impersonatedKC, err := kclientset.NewForConfig(&restconfigCopy) + if err != nil { + return err + } + + secret, err := impersonatedKC.Secrets(templateInstance.Namespace).Get(templateInstance.Spec.Secret.Name) + if err != nil { + return err + } + + templateCopy, err := kapi.Scheme.DeepCopy(&templateInstance.Spec.Template) + if err != nil { + return err + } + template := templateCopy.(*templateapi.Template) + + if template.ObjectLabels == nil { + template.ObjectLabels = make(map[string]string) + } + template.ObjectLabels[templateapi.TemplateInstanceLabel] = templateInstance.Name + + for i, param := range template.Parameters { + if value, ok := secret.Data[param.Name]; ok { + template.Parameters[i].Value = string(value) + template.Parameters[i].Generate = "" + } + } + + template, err = impersonatedOC.TemplateConfigs(templateInstance.Namespace).Create(template) + if err != nil { + return err + } + + errs := runtime.DecodeList(template.Objects, kapi.Codecs.UniversalDecoder()) + if len(errs) > 0 { + return errs[0] + } + + for _, obj := range template.Objects { + meta, _ := meta.Accessor(obj) + ref := meta.GetOwnerReferences() + ref = append(ref, metatypes.OwnerReference{ + APIVersion: templateapiv1.SchemeGroupVersion.String(), + Kind: "TemplateInstance", + Name: templateInstance.Name, + UID: templateInstance.UID, + }) + meta.SetOwnerReferences(ref) + } + + bulk := cmd.Bulk{ + Mapper: &resource.Mapper{ + RESTMapper: client.DefaultMultiRESTMapper(), + ObjectTyper: kapi.Scheme, + ClientMapper: resource.ClientMapperFunc(func(mapping *meta.RESTMapping) (resource.RESTClient, error) { + if latest.OriginKind(mapping.GroupVersionKind) { + return impersonatedOC, nil + } + return impersonatedKC.CoreClient.RESTClient(), nil + }), + }, + Op: cmd.Create, + } + errs = bulk.Run(&kapi.List{Items: template.Objects}, templateInstance.Namespace) + if len(errs) > 0 { + return errs[0] + } + + return nil +} diff --git a/pkg/template/registry/brokertemplateinstance/etcd/etcd.go b/pkg/template/registry/brokertemplateinstance/etcd/etcd.go new file mode 100644 index 000000000000..dee017c8a038 --- /dev/null +++ b/pkg/template/registry/brokertemplateinstance/etcd/etcd.go @@ -0,0 +1,35 @@ +package etcd + +import ( + "github.com/openshift/origin/pkg/template/api" + "github.com/openshift/origin/pkg/template/registry/brokertemplateinstance" + "github.com/openshift/origin/pkg/util/restoptions" + "k8s.io/kubernetes/pkg/registry/generic/registry" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/storage" +) + +// REST implements a RESTStorage for brokertemplateinstances against etcd +type REST struct { + *registry.Store +} + +// NewREST returns a RESTStorage object that will work against brokertemplateinstances. +func NewREST(optsGetter restoptions.Getter) (*REST, error) { + store := ®istry.Store{ + NewFunc: func() runtime.Object { return &api.BrokerTemplateInstance{} }, + NewListFunc: func() runtime.Object { return &api.BrokerTemplateInstanceList{} }, + PredicateFunc: brokertemplateinstance.Matcher, + QualifiedResource: api.Resource("brokertemplateinstances"), + + CreateStrategy: brokertemplateinstance.Strategy, + UpdateStrategy: brokertemplateinstance.Strategy, + DeleteStrategy: brokertemplateinstance.Strategy, + } + + if err := restoptions.ApplyOptions(optsGetter, store, storage.NoTriggerPublisher); err != nil { + return nil, err + } + + return &REST{store}, nil +} diff --git a/pkg/template/registry/brokertemplateinstance/strategy.go b/pkg/template/registry/brokertemplateinstance/strategy.go new file mode 100644 index 000000000000..273b22105b00 --- /dev/null +++ b/pkg/template/registry/brokertemplateinstance/strategy.go @@ -0,0 +1,80 @@ +package brokertemplateinstance + +import ( + "fmt" + + "github.com/openshift/origin/pkg/template/api" + "github.com/openshift/origin/pkg/template/api/validation" + kapi "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/storage" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +// brokerTemplateInstanceStrategy implements behavior for Templates +type brokerTemplateInstanceStrategy struct { + runtime.ObjectTyper + kapi.NameGenerator +} + +// Strategy is the default logic that applies when creating and updating BrokerTemplateInstance +// objects via the REST API. +var Strategy = brokerTemplateInstanceStrategy{kapi.Scheme, kapi.SimpleNameGenerator} + +// NamespaceScoped is false for brokertemplateinstances. +func (brokerTemplateInstanceStrategy) NamespaceScoped() bool { + return false +} + +// PrepareForUpdate clears fields that are not allowed to be set by end users on update. +func (brokerTemplateInstanceStrategy) PrepareForUpdate(ctx kapi.Context, obj, old runtime.Object) { +} + +// Canonicalize normalizes the object after validation. +func (brokerTemplateInstanceStrategy) Canonicalize(obj runtime.Object) { +} + +// PrepareForCreate clears fields that are not allowed to be set by end users on creation. +func (brokerTemplateInstanceStrategy) PrepareForCreate(ctx kapi.Context, obj runtime.Object) { +} + +// Validate validates a new brokertemplateinstance. +func (brokerTemplateInstanceStrategy) Validate(ctx kapi.Context, obj runtime.Object) field.ErrorList { + return validation.ValidateBrokerTemplateInstance(obj.(*api.BrokerTemplateInstance)) +} + +// AllowCreateOnUpdate is false for brokertemplateinstances. +func (brokerTemplateInstanceStrategy) AllowCreateOnUpdate() bool { + return false +} + +func (brokerTemplateInstanceStrategy) AllowUnconditionalUpdate() bool { + return false +} + +// ValidateUpdate is the default update validation for an end user. +func (brokerTemplateInstanceStrategy) ValidateUpdate(ctx kapi.Context, obj, old runtime.Object) field.ErrorList { + return validation.ValidateBrokerTemplateInstanceUpdate(obj.(*api.BrokerTemplateInstance), old.(*api.BrokerTemplateInstance)) +} + +// Matcher returns a generic matcher for a given label and field selector. +func Matcher(label labels.Selector, field fields.Selector) storage.SelectionPredicate { + return storage.SelectionPredicate{ + Label: label, + Field: field, + GetAttrs: func(o runtime.Object) (labels.Set, fields.Set, error) { + obj, ok := o.(*api.BrokerTemplateInstance) + if !ok { + return nil, nil, fmt.Errorf("not a BrokerTemplateInstance") + } + return labels.Set(obj.Labels), SelectableFields(obj), nil + }, + } +} + +// SelectableFields returns a field set that can be used for filter selection +func SelectableFields(obj *api.BrokerTemplateInstance) fields.Set { + return api.BrokerTemplateInstanceToSelectableFields(obj) +} diff --git a/pkg/template/registry/templateinstance/etcd/etcd.go b/pkg/template/registry/templateinstance/etcd/etcd.go new file mode 100644 index 000000000000..5bc7dab90e3e --- /dev/null +++ b/pkg/template/registry/templateinstance/etcd/etcd.go @@ -0,0 +1,37 @@ +package etcd + +import ( + "github.com/openshift/origin/pkg/client" + "github.com/openshift/origin/pkg/template/api" + "github.com/openshift/origin/pkg/template/registry/templateinstance" + "github.com/openshift/origin/pkg/util/restoptions" + "k8s.io/kubernetes/pkg/registry/generic/registry" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/storage" +) + +// REST implements a RESTStorage for templateinstances against etcd +type REST struct { + *registry.Store +} + +// NewREST returns a RESTStorage object that will work against templateinstances. +func NewREST(optsGetter restoptions.Getter, oc *client.Client) (*REST, error) { + strategy := templateinstance.NewStrategy(oc) + + store := ®istry.Store{ + NewFunc: func() runtime.Object { return &api.TemplateInstance{} }, + NewListFunc: func() runtime.Object { return &api.TemplateInstanceList{} }, + PredicateFunc: templateinstance.Matcher, + QualifiedResource: api.Resource("templateinstances"), + + CreateStrategy: strategy, + UpdateStrategy: strategy, + } + + if err := restoptions.ApplyOptions(optsGetter, store, storage.NoTriggerPublisher); err != nil { + return nil, err + } + + return &REST{store}, nil +} diff --git a/pkg/template/registry/templateinstance/strategy.go b/pkg/template/registry/templateinstance/strategy.go new file mode 100644 index 000000000000..c02f74662049 --- /dev/null +++ b/pkg/template/registry/templateinstance/strategy.go @@ -0,0 +1,137 @@ +package templateinstance + +import ( + "errors" + "fmt" + + authorizationapi "github.com/openshift/origin/pkg/authorization/api" + "github.com/openshift/origin/pkg/client" + templateapi "github.com/openshift/origin/pkg/template/api" + "github.com/openshift/origin/pkg/template/api/validation" + userapi "github.com/openshift/origin/pkg/user/api" + kapi "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/auth/user" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/storage" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +// templateInstanceStrategy implements behavior for Templates +type templateInstanceStrategy struct { + runtime.ObjectTyper + kapi.NameGenerator + oc *client.Client +} + +func NewStrategy(oc *client.Client) *templateInstanceStrategy { + return &templateInstanceStrategy{kapi.Scheme, kapi.SimpleNameGenerator, oc} +} + +// NamespaceScoped is true for templateinstances. +func (templateInstanceStrategy) NamespaceScoped() bool { + return true +} + +// PrepareForUpdate clears fields that are not allowed to be set by end users on update. +func (templateInstanceStrategy) PrepareForUpdate(ctx kapi.Context, obj, old runtime.Object) { +} + +// Canonicalize normalizes the object after validation. +func (templateInstanceStrategy) Canonicalize(obj runtime.Object) { +} + +// PrepareForCreate clears fields that are not allowed to be set by end users on creation. +func (templateInstanceStrategy) PrepareForCreate(ctx kapi.Context, obj runtime.Object) { + templateInstance := obj.(*templateapi.TemplateInstance) + + if templateInstance.Spec.Requestor == nil { + user, _ := kapi.UserFrom(ctx) + templateInstance.Spec.Requestor = &templateapi.TemplateInstanceRequestor{ + Username: user.GetName(), + } + } +} + +// Validate validates a new templateinstance. +func (s *templateInstanceStrategy) Validate(ctx kapi.Context, obj runtime.Object) field.ErrorList { + user, ok := kapi.UserFrom(ctx) + if !ok { + return field.ErrorList{field.InternalError(field.NewPath(""), errors.New("user not found in context"))} + } + + templateInstance := obj.(*templateapi.TemplateInstance) + allErrs := validation.ValidateTemplateInstance(templateInstance) + allErrs = append(allErrs, s.validateImpersonation(templateInstance, user)...) + + return allErrs +} + +// AllowCreateOnUpdate is false for templateinstances. +func (templateInstanceStrategy) AllowCreateOnUpdate() bool { + return false +} + +func (templateInstanceStrategy) AllowUnconditionalUpdate() bool { + return false +} + +// ValidateUpdate is the default update validation for an end user. +func (s *templateInstanceStrategy) ValidateUpdate(ctx kapi.Context, obj, old runtime.Object) field.ErrorList { + user, ok := kapi.UserFrom(ctx) + if !ok { + return field.ErrorList{field.InternalError(field.NewPath(""), errors.New("user not found in context"))} + } + + templateInstance := obj.(*templateapi.TemplateInstance) + oldTemplateInstance := old.(*templateapi.TemplateInstance) + allErrs := validation.ValidateTemplateInstanceUpdate(templateInstance, oldTemplateInstance) + allErrs = append(allErrs, s.validateImpersonation(templateInstance, user)...) + + return allErrs +} + +// Matcher returns a generic matcher for a given label and field selector. +func Matcher(label labels.Selector, field fields.Selector) storage.SelectionPredicate { + return storage.SelectionPredicate{ + Label: label, + Field: field, + GetAttrs: func(o runtime.Object) (labels.Set, fields.Set, error) { + obj, ok := o.(*templateapi.TemplateInstance) + if !ok { + return nil, nil, fmt.Errorf("not a TemplateInstance") + } + return labels.Set(obj.Labels), SelectableFields(obj), nil + }, + } +} + +// SelectableFields returns a field set that can be used for filter selection +func SelectableFields(obj *templateapi.TemplateInstance) fields.Set { + return templateapi.TemplateInstanceToSelectableFields(obj) +} + +func (s *templateInstanceStrategy) validateImpersonation(templateInstance *templateapi.TemplateInstance, userinfo user.Info) field.ErrorList { + if templateInstance.Spec.Requestor == nil || templateInstance.Spec.Requestor.Username == "" { + return field.ErrorList{field.Required(field.NewPath("spec.requestor.username"), "")} + } + + if templateInstance.Spec.Requestor.Username != userinfo.GetName() { + sar := authorizationapi.AddUserToSAR(userinfo, + &authorizationapi.SubjectAccessReview{ + Action: authorizationapi.Action{ + Verb: "impersonate", + Group: userapi.GroupName, + Resource: authorizationapi.UserResource, + ResourceName: templateInstance.Spec.Requestor.Username, + }, + }) + resp, err := s.oc.SubjectAccessReviews().Create(sar) + if err != nil || resp == nil || !resp.Allowed { + return field.ErrorList{field.Forbidden(field.NewPath("spec.impersonateUser"), "impersonation forbidden")} + } + } + + return nil +} diff --git a/pkg/template/servicebroker/bind.go b/pkg/template/servicebroker/bind.go new file mode 100644 index 000000000000..ec80732271f0 --- /dev/null +++ b/pkg/template/servicebroker/bind.go @@ -0,0 +1,146 @@ +package servicebroker + +import ( + "errors" + "net/http" + "strconv" + "strings" + + "github.com/openshift/origin/pkg/openservicebroker/api" + templateapi "github.com/openshift/origin/pkg/template/api" + kapi "k8s.io/kubernetes/pkg/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" + kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/kubernetes/pkg/labels" + "k8s.io/kubernetes/pkg/selection" +) + +// copied from vendor/k8s.io/kubernetes/pkg/kubelet/envvars/envvars.go +// TODO: when the API for returning information from the bind call is cleaned up +// and we're no longer temporarily using the environment variable style, remove +// this. +func makeEnvVariableName(str string) string { + return strings.ToUpper(strings.Replace(str, "-", "_", -1)) +} + +func (b *Broker) getServices(impersonatedKC *kclientset.Clientset, namespace, instanceID string) (map[string]interface{}, *api.Response) { + requirement, _ := labels.NewRequirement(templateapi.TemplateInstanceLabel, selection.Equals, []string{instanceID}) + + serviceList, err := impersonatedKC.Services(namespace).List(kapi.ListOptions{LabelSelector: labels.NewSelector().Add(*requirement)}) + if err != nil { + return nil, api.InternalServerError(err) + } + + services := map[string]interface{}{} + for _, service := range serviceList.Items { + if !kapi.IsServiceIPSet(&service) || len(service.Spec.Ports) == 0 { + continue + } + + name := makeEnvVariableName(service.Name) + "_SERVICE_HOST" + services[name] = service.Spec.ClusterIP + + name = makeEnvVariableName(service.Name) + "_SERVICE_PORT" + services[name] = strconv.Itoa(int(service.Spec.Ports[0].Port)) + + for _, port := range service.Spec.Ports { + if port.Name != "" { + services[name+"_"+makeEnvVariableName(port.Name)] = strconv.Itoa(int(port.Port)) + } + } + } + + return services, nil +} + +func (b *Broker) getSecrets(impersonatedKC *kclientset.Clientset, namespace, instanceID string) (map[string]interface{}, *api.Response) { + requirement, _ := labels.NewRequirement(templateapi.TemplateInstanceLabel, selection.Equals, []string{instanceID}) + + secretList, err := impersonatedKC.Secrets(namespace).List(kapi.ListOptions{LabelSelector: labels.NewSelector().Add(*requirement)}) + if err != nil { + return nil, api.InternalServerError(err) + } + + secrets := map[string]interface{}{} + for _, secret := range secretList.Items { + if secret.Type != kapi.SecretTypeBasicAuth { + continue + } + + name := makeEnvVariableName(secret.Name + "_" + kapi.BasicAuthUsernameKey) + secrets[name] = string(secret.Data[kapi.BasicAuthUsernameKey]) + + name = makeEnvVariableName(secret.Name + "_" + kapi.BasicAuthPasswordKey) + secrets[name] = string(secret.Data[kapi.BasicAuthPasswordKey]) + } + + return secrets, nil +} + +func (b *Broker) Bind(instanceID, bindingID string, breq *api.BindRequest) *api.Response { + if errs := ValidateBindRequest(breq); len(errs) > 0 { + return api.BadRequest(errs.ToAggregate()) + } + + if len(breq.Parameters) != 1 { + return api.BadRequest(errors.New("parameters not supported on bind")) + } + + impersonate := breq.Parameters[templateapi.RequesterUsernameParameterKey] + + impersonatedKC, _, _, err := b.getClientsForUsername(impersonate) + if err != nil { + return api.InternalServerError(err) + } + + brokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Get(instanceID) + if err != nil { + if kerrors.IsNotFound(err) { + return api.BadRequest(err) + } + + return api.InternalServerError(err) + } + + templateInstance, err := b.templateclient.TemplateInstances(brokerTemplateInstance.Spec.TemplateInstance.Namespace).Get(brokerTemplateInstance.Spec.TemplateInstance.Name) + if err != nil { + return api.InternalServerError(err) + } + if breq.ServiceID != string(templateInstance.Spec.Template.UID) { + return api.BadRequest(errors.New("service_id does not match provisioned service")) + } + + namespace := brokerTemplateInstance.Spec.TemplateInstance.Namespace + + services, resp := b.getServices(impersonatedKC, namespace, instanceID) + if resp != nil { + return resp + } + + secrets, resp := b.getSecrets(impersonatedKC, namespace, instanceID) + if resp != nil { + return resp + } + + // TODO: this API may not currently be considered stable. + credentials := map[string]interface{}{} + credentials["services"] = services + credentials["secrets"] = secrets + + status := http.StatusCreated + for _, id := range brokerTemplateInstance.Spec.BindingIDs { + if id == bindingID { + status = http.StatusOK + break + } + } + if status == http.StatusCreated { + brokerTemplateInstance.Spec.BindingIDs = append(brokerTemplateInstance.Spec.BindingIDs, bindingID) + brokerTemplateInstance, err = b.templateclient.BrokerTemplateInstances().Update(brokerTemplateInstance) + if err != nil { + return api.InternalServerError(err) + } + } + + return api.NewResponse(status, &api.BindResponse{Credentials: credentials}, nil) +} diff --git a/pkg/template/servicebroker/catalog.go b/pkg/template/servicebroker/catalog.go new file mode 100644 index 000000000000..3ae93742f2ae --- /dev/null +++ b/pkg/template/servicebroker/catalog.go @@ -0,0 +1,54 @@ +package servicebroker + +import ( + "net/http" + "strings" + + oapi "github.com/openshift/origin/pkg/api" + "github.com/openshift/origin/pkg/openservicebroker/api" + templateapi "github.com/openshift/origin/pkg/template/api" +) + +var annotationMap = map[string]string{ + oapi.OpenShiftDisplayName: api.ServiceMetadataDisplayName, + templateapi.IconClassAnnotation: "imageIconClass", + templateapi.LongDescriptionAnnotation: api.ServiceMetadataLongDescription, + templateapi.ProviderDisplayNameAnnotation: api.ServiceMetadataProviderDisplayName, + templateapi.DocumentationURLAnnotation: api.ServiceMetadataDocumentationURL, + templateapi.SupportURLAnnotation: api.ServiceMetadataSupportURL, +} + +func serviceFromTemplate(template *templateapi.Template) *api.Service { + metadata := make(map[string]interface{}) + for srcname, dstname := range annotationMap { + if value, ok := template.Annotations[srcname]; ok { + metadata[dstname] = value + } + } + + // TODO: list template parameters (https://github.com/openservicebrokerapi/servicebroker/issues/59) + + return &api.Service{ + Name: template.Name, + ID: string(template.UID), + Description: template.Annotations["description"], + Tags: strings.Split(template.Annotations["tags"], ","), + Bindable: true, + Metadata: metadata, + Plans: plans, + } +} + +func (b *Broker) Catalog() *api.Response { + templates, err := b.lister.List() + if err != nil { + return api.InternalServerError(err) + } + + services := make([]*api.Service, len(templates)) + for i, template := range templates { + services[i] = serviceFromTemplate(template) + } + + return api.NewResponse(http.StatusOK, &api.CatalogResponse{Services: services}, nil) +} diff --git a/pkg/template/servicebroker/deprovision.go b/pkg/template/servicebroker/deprovision.go new file mode 100644 index 000000000000..131a5359e148 --- /dev/null +++ b/pkg/template/servicebroker/deprovision.go @@ -0,0 +1,40 @@ +package servicebroker + +import ( + "net/http" + + "github.com/openshift/origin/pkg/openservicebroker/api" + kapi "k8s.io/kubernetes/pkg/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" +) + +func (b *Broker) Deprovision(instanceID string) *api.Response { + brokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Get(instanceID) + if err != nil { + if kerrors.IsNotFound(err) { + return api.NewResponse(http.StatusGone, &api.DeprovisionResponse{}, nil) + } + return api.InternalServerError(err) + } + + err = b.templateclient.TemplateInstances(brokerTemplateInstance.Spec.TemplateInstance.Namespace).Delete(brokerTemplateInstance.Spec.TemplateInstance.Name, kapi.NewPreconditionDeleteOptions(string(brokerTemplateInstance.Spec.TemplateInstance.UID))) + if err != nil && !kerrors.IsNotFound(err) { + return api.InternalServerError(err) + } + + err = b.kc.Secrets(brokerTemplateInstance.Spec.Secret.Namespace).Delete(brokerTemplateInstance.Spec.Secret.Name, kapi.NewPreconditionDeleteOptions(string(brokerTemplateInstance.Spec.Secret.UID))) + if err != nil && !kerrors.IsNotFound(err) { + return api.InternalServerError(err) + } + + opts := kapi.NewPreconditionDeleteOptions(string(brokerTemplateInstance.UID)) + err = b.templateclient.BrokerTemplateInstances().Delete(instanceID, opts) + if err != nil { + if kerrors.IsNotFound(err) { + return api.NewResponse(http.StatusGone, &api.DeprovisionResponse{}, nil) + } + return api.InternalServerError(err) + } + + return api.NewResponse(http.StatusOK, &api.DeprovisionResponse{}, nil) +} diff --git a/pkg/template/servicebroker/lastoperation.go b/pkg/template/servicebroker/lastoperation.go new file mode 100644 index 000000000000..6adf9ac509b0 --- /dev/null +++ b/pkg/template/servicebroker/lastoperation.go @@ -0,0 +1,44 @@ +package servicebroker + +import ( + "errors" + "net/http" + + "github.com/openshift/origin/pkg/openservicebroker/api" + templateapi "github.com/openshift/origin/pkg/template/api" + kapi "k8s.io/kubernetes/pkg/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" +) + +func (b *Broker) LastOperation(instanceID string, operation api.Operation) *api.Response { + if operation != api.OperationProvisioning { + return api.BadRequest(errors.New("invalid operation")) + } + + brokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Get(instanceID) + if err != nil { + if kerrors.IsNotFound(err) { + return api.BadRequest(err) + } + return api.InternalServerError(err) + } + + templateInstance, err := b.templateclient.TemplateInstances(brokerTemplateInstance.Spec.TemplateInstance.Namespace).Get(brokerTemplateInstance.Spec.TemplateInstance.Name) + if err != nil { + return api.InternalServerError(err) + } + + state := api.LastOperationStateInProgress + for _, condition := range templateInstance.Status.Conditions { + if condition.Type == templateapi.TemplateInstanceReady && condition.Status == kapi.ConditionTrue { + state = api.LastOperationStateSucceeded + break + } + if condition.Type == templateapi.TemplateInstanceInstantiateFailure && condition.Status == kapi.ConditionTrue { + state = api.LastOperationStateFailed + break + } + } + + return api.NewResponse(http.StatusOK, &api.LastOperationResponse{State: state}, nil) +} diff --git a/pkg/template/servicebroker/provision.go b/pkg/template/servicebroker/provision.go new file mode 100644 index 000000000000..45f3dd6a724c --- /dev/null +++ b/pkg/template/servicebroker/provision.go @@ -0,0 +1,171 @@ +package servicebroker + +import ( + "net/http" + "reflect" + + "github.com/openshift/origin/pkg/openservicebroker/api" + templateapi "github.com/openshift/origin/pkg/template/api" + templateclientset "github.com/openshift/origin/pkg/template/clientset/internalclientset" + kapi "k8s.io/kubernetes/pkg/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" + kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" +) + +func (b *Broker) ensureSecret(impersonatedKC *kclientset.Clientset, namespace string, instanceID string, preq *api.ProvisionRequest, didWork *bool) (*kapi.Secret, *api.Response) { + secret := &kapi.Secret{ + ObjectMeta: kapi.ObjectMeta{Name: instanceID}, + Data: map[string][]byte{}, + } + + for k, v := range preq.Parameters { + if k != templateapi.NamespaceParameterKey && k != templateapi.RequesterUsernameParameterKey { + secret.Data[k] = []byte(v) + } + } + + createdSec, err := impersonatedKC.Secrets(namespace).Create(secret) + if err == nil { + *didWork = true + return createdSec, nil + } + + if kerrors.IsAlreadyExists(err) { + existingSec, err := impersonatedKC.Secrets(namespace).Get(secret.Name) + if err == nil && reflect.DeepEqual(secret.Data, existingSec.Data) { + return existingSec, nil + } + + return nil, api.NewResponse(http.StatusConflict, api.ProvisionResponse{}, nil) + } + + return nil, api.InternalServerError(err) +} + +func (b *Broker) ensureTemplateInstance(impersonatedTemplateclient *templateclientset.Clientset, namespace string, instanceID string, template *templateapi.Template, secret *kapi.Secret, impersonate string, didWork *bool) (*templateapi.TemplateInstance, *api.Response) { + templateInstance := &templateapi.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{Name: instanceID}, + Spec: templateapi.TemplateInstanceSpec{ + Template: *template, + Secret: kapi.LocalObjectReference{Name: secret.Name}, + Requestor: &templateapi.TemplateInstanceRequestor{ + Username: impersonate, + }, + }, + } + + createdTemplateInstance, err := impersonatedTemplateclient.TemplateInstances(namespace).Create(templateInstance) + if err == nil { + *didWork = true + return createdTemplateInstance, nil + } + + if kerrors.IsAlreadyExists(err) { + existingTemplateInstance, err := impersonatedTemplateclient.TemplateInstances(namespace).Get(templateInstance.Name) + if err == nil && reflect.DeepEqual(templateInstance.Spec, existingTemplateInstance.Spec) { + return existingTemplateInstance, nil + } + + return nil, api.NewResponse(http.StatusConflict, api.ProvisionResponse{}, nil) + } + + return nil, api.InternalServerError(err) +} + +func (b *Broker) ensureBrokerTemplateInstanceUIDs(brokerTemplateInstance *templateapi.BrokerTemplateInstance, secret *kapi.Secret, templateInstance *templateapi.TemplateInstance, didWork *bool) (*templateapi.BrokerTemplateInstance, *api.Response) { + brokerTemplateInstance.Spec.Secret.UID = secret.UID + brokerTemplateInstance.Spec.TemplateInstance.UID = templateInstance.UID + + brokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Update(brokerTemplateInstance) + if err == nil { + *didWork = true + return brokerTemplateInstance, nil + } + + return nil, api.InternalServerError(err) +} + +func (b *Broker) ensureBrokerTemplateInstance(namespace, instanceID string, didWork *bool) (*templateapi.BrokerTemplateInstance, *api.Response) { + brokerTemplateInstance := &templateapi.BrokerTemplateInstance{ + ObjectMeta: kapi.ObjectMeta{Name: instanceID}, + Spec: templateapi.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Namespace: namespace, + Name: instanceID, + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Namespace: namespace, + Name: instanceID, + }, + }, + } + + newBrokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Create(brokerTemplateInstance) + if err == nil { + *didWork = true + return newBrokerTemplateInstance, nil + } + + if kerrors.IsAlreadyExists(err) { + existingBrokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Get(brokerTemplateInstance.Name) + if err == nil && reflect.DeepEqual(brokerTemplateInstance.Spec, existingBrokerTemplateInstance.Spec) { + return existingBrokerTemplateInstance, nil + } + + return nil, api.NewResponse(http.StatusConflict, api.ProvisionResponse{}, nil) + } + + return nil, api.InternalServerError(err) +} + +func (b *Broker) Provision(instanceID string, preq *api.ProvisionRequest) *api.Response { + if errs := ValidateProvisionRequest(preq); len(errs) > 0 { + return api.BadRequest(errs.ToAggregate()) + } + + namespace := preq.Parameters[templateapi.NamespaceParameterKey] + impersonate := preq.Parameters[templateapi.RequesterUsernameParameterKey] + + impersonatedKC, _, impersonatedTemplateclient, err := b.getClientsForUsername(impersonate) + if err != nil { + return api.InternalServerError(err) + } + + template, err := b.lister.GetTemplateByUID(preq.ServiceID) + if err != nil { + return api.BadRequest(err) + } + if template == nil { + return api.BadRequest(kerrors.NewNotFound(templateapi.Resource("templates"), preq.ServiceID)) + } + + didWork := false + + brokerTemplateInstance, resp := b.ensureBrokerTemplateInstance(namespace, instanceID, &didWork) + if resp != nil { + return resp + } + + secret, resp := b.ensureSecret(impersonatedKC, namespace, instanceID, preq, &didWork) + if resp != nil { + return resp + } + + templateInstance, resp := b.ensureTemplateInstance(impersonatedTemplateclient, namespace, instanceID, template, secret, impersonate, &didWork) + if resp != nil { + return resp + } + + _, resp = b.ensureBrokerTemplateInstanceUIDs(brokerTemplateInstance, secret, templateInstance, &didWork) + if resp != nil { + return resp + } + + if didWork { + return api.NewResponse(http.StatusAccepted, api.ProvisionResponse{Operation: api.OperationProvisioning}, nil) + } + + return api.NewResponse(http.StatusOK, api.ProvisionResponse{Operation: api.OperationProvisioning}, nil) +} diff --git a/pkg/template/servicebroker/servicebroker.go b/pkg/template/servicebroker/servicebroker.go new file mode 100644 index 000000000000..192428ffd430 --- /dev/null +++ b/pkg/template/servicebroker/servicebroker.go @@ -0,0 +1,67 @@ +package servicebroker + +import ( + "net/http" + + authclient "github.com/openshift/origin/pkg/auth/client" + "github.com/openshift/origin/pkg/client" + "github.com/openshift/origin/pkg/client/cache" + "github.com/openshift/origin/pkg/controller/shared" + "github.com/openshift/origin/pkg/openservicebroker/api" + templateclientset "github.com/openshift/origin/pkg/template/clientset/internalclientset" + "k8s.io/kubernetes/pkg/auth/user" + kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/kubernetes/pkg/client/restclient" +) + +type Broker struct { + kc *kclientset.Clientset + templateclient *templateclientset.Clientset + restconfig *restclient.Config + lister cache.StoreToTemplateLister + templateNamespace string +} + +func NewBroker(restconfig *restclient.Config, kc *kclientset.Clientset, informers shared.InformerFactory, templateNamespace string) *Broker { + return &Broker{ + kc: kc, + templateclient: templateclientset.NewForConfigOrDie(restconfig), + restconfig: restconfig, + lister: informers.Templates().Lister(), + templateNamespace: templateNamespace, + } +} + +func (b *Broker) getClientsForUsername(username string) (*kclientset.Clientset, *client.Client, *templateclientset.Clientset, error) { + restconfigCopy := *b.restconfig + restconfigCopy.WrapTransport = func(rt http.RoundTripper) http.RoundTripper { + return authclient.NewImpersonatingRoundTripper(&user.DefaultInfo{Name: username}, b.restconfig.WrapTransport(rt)) + } + + oc, err := client.New(&restconfigCopy) + if err != nil { + return nil, nil, nil, err + } + + kc, err := kclientset.NewForConfig(&restconfigCopy) + if err != nil { + return nil, nil, nil, err + } + + templateclient, err := templateclientset.NewForConfig(&restconfigCopy) + if err != nil { + return nil, nil, nil, err + } + + return kc, oc, templateclient, nil +} + +// TODO: UUID should be unique per cluster +var plans = []api.Plan{ + { + ID: "7ae2bd88-9b8f-4a17-8014-41a5465c9e71", + Name: "default", + Description: "Default plan", + Free: true, + }, +} diff --git a/pkg/template/servicebroker/test-scripts/README.md b/pkg/template/servicebroker/test-scripts/README.md new file mode 100644 index 000000000000..fa93eaaac84c --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/README.md @@ -0,0 +1,8 @@ +oc create -f clusterrole.yaml + +./catalog.sh +./provision.sh +./lastoperation-provision.sh +./bind.sh +./unbind.sh +./deprovision.sh diff --git a/pkg/template/servicebroker/test-scripts/bind.sh b/pkg/template/servicebroker/test-scripts/bind.sh new file mode 100755 index 000000000000..0b1ea9d98f0d --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/bind.sh @@ -0,0 +1,22 @@ +#!/bin/bash -e + +. shared.sh + +serviceUUID=${serviceUUID-$(oc get template ruby-helloworld-sample -n openshift -o template --template '{{.metadata.uid}}')} + +req="{ + \"plan_id\": \"$planUUID\", + \"service_id\": \"$serviceUUID\", + \"parameters\": { + \"template.openshift.io/requester-username\": \"$requesterUsername\" + } +}" + +curl \ + -X PUT \ + -H 'X-Broker-API-Version: 2.9' \ + -H 'Content-Type: application/json' \ + -d "$req" \ + -v \ + $curlargs \ + $endpoint/v2/service_instances/$instanceUUID/service_bindings/$bindingUUID diff --git a/pkg/template/servicebroker/test-scripts/catalog.sh b/pkg/template/servicebroker/test-scripts/catalog.sh new file mode 100755 index 000000000000..6385c9cbf518 --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/catalog.sh @@ -0,0 +1,9 @@ +#!/bin/bash -e + +. shared.sh + +curl \ + -H 'X-Broker-API-Version: 2.9' \ + -v \ + $curlargs \ + $endpoint/v2/catalog diff --git a/pkg/template/servicebroker/test-scripts/clusterrole.yaml b/pkg/template/servicebroker/test-scripts/clusterrole.yaml new file mode 100644 index 000000000000..9b6a61e5b987 --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/clusterrole.yaml @@ -0,0 +1,12 @@ +kind: List +apiVersion: v1 +items: +- kind: ClusterRoleBinding + apiVersion: v1 + metadata: + name: templateservicebroker-client-binding + roleRef: + name: templateservicebroker-client + groupNames: + - system:unauthenticated + - system:authenticated diff --git a/pkg/template/servicebroker/test-scripts/deprovision.sh b/pkg/template/servicebroker/test-scripts/deprovision.sh new file mode 100755 index 000000000000..d3adc73f7c2e --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/deprovision.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e + +. shared.sh + +curl \ + -X DELETE \ + -H 'X-Broker-API-Version: 2.9' \ + -v \ + $curlargs \ + $endpoint/v2/service_instances/$instanceUUID'?accepts_incomplete=true' diff --git a/pkg/template/servicebroker/test-scripts/lastoperation-provision.sh b/pkg/template/servicebroker/test-scripts/lastoperation-provision.sh new file mode 100755 index 000000000000..899e238e6eac --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/lastoperation-provision.sh @@ -0,0 +1,9 @@ +#!/bin/bash -e + +. shared.sh + +curl \ + -H 'X-Broker-API-Version: 2.9' \ + -v \ + $curlargs \ + $endpoint/v2/service_instances/$instanceUUID/last_operation'?operation=provisioning' diff --git a/pkg/template/servicebroker/test-scripts/provision.sh b/pkg/template/servicebroker/test-scripts/provision.sh new file mode 100755 index 000000000000..acd137b4d804 --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/provision.sh @@ -0,0 +1,25 @@ +#!/bin/bash -e + +. shared.sh + +serviceUUID=${serviceUUID-$(oc get template ruby-helloworld-sample -n openshift -o template --template '{{.metadata.uid}}')} + +req="{ + \"plan_id\": \"$planUUID\", + \"service_id\": \"$serviceUUID\", + \"parameters\": { + \"MYSQL_USER\": \"username\", + \"template.openshift.io/namespace\": \"$namespace\", + \"template.openshift.io/requester-username\": \"$requesterUsername\" + }, + \"accepts_incomplete\": true +}" + +curl \ + -X PUT \ + -H 'X-Broker-API-Version: 2.9' \ + -H 'Content-Type: application/json' \ + -d "$req" \ + -v \ + $curlargs \ + $endpoint/v2/service_instances/$instanceUUID diff --git a/pkg/template/servicebroker/test-scripts/shared.sh b/pkg/template/servicebroker/test-scripts/shared.sh new file mode 100644 index 000000000000..0138bdc5fcd4 --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/shared.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e + +instanceUUID=${instanceUUID-a71f7ab8-e448-4826-8f05-32a185222dd7} +planUUID=${planUUID-7ae2bd88-9b8f-4a17-8014-41a5465c9e71} +bindingUUID=${bindingUUID-dde0226b-ff95-4f9d-af51-2e9ec06b1f02} + +endpoint=${endpoint-https://localhost:8443/brokers/template.openshift.io} +curlargs=${curlargs--k} +namespace=${namespace-demo} +requesterUsername=${requesterUsername-$(oc whoami)} diff --git a/pkg/template/servicebroker/test-scripts/unbind.sh b/pkg/template/servicebroker/test-scripts/unbind.sh new file mode 100755 index 000000000000..6e7ec2d57335 --- /dev/null +++ b/pkg/template/servicebroker/test-scripts/unbind.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e + +. shared.sh + +curl \ + -X DELETE \ + -H 'X-Broker-API-Version: 2.9' \ + -v \ + $curlargs \ + $endpoint/v2/service_instances/$instanceUUID/service_bindings/$bindingUUID diff --git a/pkg/template/servicebroker/unbind.go b/pkg/template/servicebroker/unbind.go new file mode 100644 index 000000000000..7d12440ac3cc --- /dev/null +++ b/pkg/template/servicebroker/unbind.go @@ -0,0 +1,35 @@ +package servicebroker + +import ( + "net/http" + + "github.com/openshift/origin/pkg/openservicebroker/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" +) + +func (b *Broker) Unbind(instanceID, bindingID string) *api.Response { + brokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Get(instanceID) + if err != nil { + if kerrors.IsNotFound(err) { + return api.BadRequest(err) + } + + return api.InternalServerError(err) + } + + status := http.StatusGone + for i := 0; i < len(brokerTemplateInstance.Spec.BindingIDs); i++ { + for i < len(brokerTemplateInstance.Spec.BindingIDs) && brokerTemplateInstance.Spec.BindingIDs[i] == bindingID { + brokerTemplateInstance.Spec.BindingIDs = append(brokerTemplateInstance.Spec.BindingIDs[:i], brokerTemplateInstance.Spec.BindingIDs[i+1:]...) + status = http.StatusOK + } + } + if status == http.StatusOK { + brokerTemplateInstance, err = b.templateclient.BrokerTemplateInstances().Update(brokerTemplateInstance) + if err != nil { + return api.InternalServerError(err) + } + } + + return api.NewResponse(status, &api.UnbindResponse{}, nil) +} diff --git a/pkg/template/servicebroker/validation.go b/pkg/template/servicebroker/validation.go new file mode 100644 index 000000000000..20292c050eb8 --- /dev/null +++ b/pkg/template/servicebroker/validation.go @@ -0,0 +1,58 @@ +package servicebroker + +import ( + "fmt" + + "github.com/openshift/origin/pkg/openservicebroker/api" + templateapi "github.com/openshift/origin/pkg/template/api" + templatevalidation "github.com/openshift/origin/pkg/template/api/validation" + uservalidation "github.com/openshift/origin/pkg/user/api/validation" + "k8s.io/kubernetes/pkg/api/validation" + "k8s.io/kubernetes/pkg/util/validation/field" +) + +func ValidateProvisionRequest(preq *api.ProvisionRequest) field.ErrorList { + var allErrs field.ErrorList + + for key := range preq.Parameters { + if !templatevalidation.ParameterNameRegexp.MatchString(key) && + key != templateapi.NamespaceParameterKey && + key != templateapi.RequesterUsernameParameterKey { + allErrs = append(allErrs, field.Invalid(field.NewPath("parameters."+key), key, fmt.Sprintf("does not match %v", templatevalidation.ParameterNameRegexp))) + } + } + + allErrs = append(allErrs, validateParameter(templateapi.NamespaceParameterKey, preq.Parameters[templateapi.NamespaceParameterKey], validation.ValidateNamespaceName)...) + allErrs = append(allErrs, validateParameter(templateapi.RequesterUsernameParameterKey, preq.Parameters[templateapi.RequesterUsernameParameterKey], uservalidation.ValidateUserName)...) + + return allErrs +} + +func ValidateBindRequest(breq *api.BindRequest) field.ErrorList { + var allErrs field.ErrorList + + for key := range breq.Parameters { + if !templatevalidation.ParameterNameRegexp.MatchString(key) && + key != templateapi.RequesterUsernameParameterKey { + allErrs = append(allErrs, field.Invalid(field.NewPath("parameters."+key), key, fmt.Sprintf("does not match %v", templatevalidation.ParameterNameRegexp))) + } + } + + allErrs = append(allErrs, validateParameter(templateapi.RequesterUsernameParameterKey, breq.Parameters[templateapi.RequesterUsernameParameterKey], uservalidation.ValidateUserName)...) + + return allErrs +} + +func validateParameter(key, value string, validator func(string, bool) []string) field.ErrorList { + var allErrs field.ErrorList + + if len(value) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("parameters", key), "")) + } else { + for _, err := range validator(value, false) { + allErrs = append(allErrs, field.Invalid(field.NewPath("parameters", key), value, err)) + } + } + + return allErrs +} diff --git a/pkg/template/servicebroker/validation_test.go b/pkg/template/servicebroker/validation_test.go new file mode 100644 index 000000000000..5bac390fdb8c --- /dev/null +++ b/pkg/template/servicebroker/validation_test.go @@ -0,0 +1,161 @@ +package servicebroker + +import ( + "fmt" + "testing" + + "github.com/openshift/origin/pkg/openservicebroker/api" + templateapi "github.com/openshift/origin/pkg/template/api" +) + +const validUUID = "4f8a47f7-900f-48b4-aad1-865760feaa04" + +func TestValidateProvisionRequest(t *testing.T) { + tests := []struct { + name string + preq api.ProvisionRequest + expectError string + }{ + { + name: "missing RequesterUsernameParameterKey key", + preq: api.ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + templateapi.NamespaceParameterKey: "test", + }, + }, + expectError: `parameters.` + templateapi.RequesterUsernameParameterKey + `: Required value`, + }, + { + name: "missing NamespaceParameterKey key", + preq: api.ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + templateapi.RequesterUsernameParameterKey: "test", + }, + }, + expectError: `parameters.` + templateapi.NamespaceParameterKey + `: Required value`, + }, + { + name: "bad key", + preq: api.ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + "b@d": "", + templateapi.NamespaceParameterKey: "test", + templateapi.RequesterUsernameParameterKey: "test", + }, + }, + expectError: `parameters.b@d: Invalid value: "b@d": does not match ^[a-zA-Z0-9_]+$`, + }, + { + name: "good", + preq: api.ProvisionRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + "azAZ09_": "", + templateapi.NamespaceParameterKey: "test", + templateapi.RequesterUsernameParameterKey: "test", + }, + }, + expectError: ``, + }, + } + + for _, test := range tests { + errors := ValidateProvisionRequest(&test.preq) + if test.expectError == "" { + if len(errors) > 0 { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } else { + found := false + for _, err := range errors { + if err.Error() == test.expectError { + found = true + break + } + } + if !found { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } + } +} + +func TestValidateBindRequest(t *testing.T) { + tests := []struct { + name string + breq api.BindRequest + expectError string + }{ + { + name: "missing RequesterUsernameParameterKey key", + breq: api.BindRequest{ + ServiceID: validUUID, + PlanID: validUUID, + }, + expectError: `parameters.` + templateapi.RequesterUsernameParameterKey + `: Required value`, + }, + { + name: "bad key 1", + breq: api.BindRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + "b@d": "", + templateapi.RequesterUsernameParameterKey: "test", + }, + }, + expectError: `parameters.b@d: Invalid value: "b@d": does not match ^[a-zA-Z0-9_]+$`, + }, + { + name: "bad key 2", + breq: api.BindRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + templateapi.NamespaceParameterKey: "test", + templateapi.RequesterUsernameParameterKey: "test", + }, + }, + expectError: fmt.Sprintf(`parameters.%[1]s: Invalid value: "%[1]s": does not match ^[a-zA-Z0-9_]+$`, templateapi.NamespaceParameterKey), + }, + { + name: "good", + breq: api.BindRequest{ + ServiceID: validUUID, + PlanID: validUUID, + Parameters: map[string]string{ + "azAZ09_": "", + templateapi.RequesterUsernameParameterKey: "test", + }, + }, + expectError: ``, + }, + } + + for _, test := range tests { + errors := ValidateBindRequest(&test.breq) + if test.expectError == "" { + if len(errors) > 0 { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } else { + found := false + for _, err := range errors { + if err.Error() == test.expectError { + found = true + break + } + } + if !found { + t.Errorf("%q: expectError was %q but errors was %q", test.name, test.expectError, errors) + } + } + } +} diff --git a/pkg/user/api/doc.go b/pkg/user/api/doc.go index 9f6c967cfa9e..aec17eb7ad1b 100644 --- a/pkg/user/api/doc.go +++ b/pkg/user/api/doc.go @@ -1,4 +1,5 @@ // +k8s:deepcopy-gen=package,register +// +groupName=user.openshift.io // Package api is the internal version of the API. package api diff --git a/pkg/user/api/v1/doc.go b/pkg/user/api/v1/doc.go index 2be72f281d28..1aea200f4348 100644 --- a/pkg/user/api/v1/doc.go +++ b/pkg/user/api/v1/doc.go @@ -3,5 +3,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +groupName=user.openshift.io // Package v1 is the v1 version of the API. package v1 diff --git a/pkg/user/clientset/internalclientset/clientset.go b/pkg/user/clientset/internalclientset/clientset.go new file mode 100644 index 000000000000..264fe1bcfff0 --- /dev/null +++ b/pkg/user/clientset/internalclientset/clientset.go @@ -0,0 +1,75 @@ +package internalclientset + +import ( + "github.com/golang/glog" + internalversionuser "github.com/openshift/origin/pkg/user/clientset/internalclientset/typed/user/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + User() internalversionuser.UserInterface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *internalversionuser.UserClient +} + +// User retrieves the UserClient +func (c *Clientset) User() internalversionuser.UserInterface { + if c == nil { + return nil + } + return c.UserClient +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.UserClient, err = internalversionuser.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.UserClient = internalversionuser.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.UserClient = internalversionuser.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/user/clientset/internalclientset/doc.go b/pkg/user/clientset/internalclientset/doc.go new file mode 100644 index 000000000000..1888bf6d0590 --- /dev/null +++ b/pkg/user/clientset/internalclientset/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. + +// This package has the automatically generated clientset. +package internalclientset diff --git a/pkg/user/clientset/internalclientset/fake/clientset_generated.go b/pkg/user/clientset/internalclientset/fake/clientset_generated.go new file mode 100644 index 000000000000..4f7dfc40909a --- /dev/null +++ b/pkg/user/clientset/internalclientset/fake/clientset_generated.go @@ -0,0 +1,52 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/user/clientset/internalclientset" + internalversionuser "github.com/openshift/origin/pkg/user/clientset/internalclientset/typed/user/internalversion" + fakeinternalversionuser "github.com/openshift/origin/pkg/user/clientset/internalclientset/typed/user/internalversion/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// User retrieves the UserClient +func (c *Clientset) User() internalversionuser.UserInterface { + return &fakeinternalversionuser.FakeUser{Fake: &c.Fake} +} diff --git a/pkg/user/clientset/internalclientset/fake/doc.go b/pkg/user/clientset/internalclientset/fake/doc.go new file mode 100644 index 000000000000..b89b35f179ec --- /dev/null +++ b/pkg/user/clientset/internalclientset/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/doc.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/doc.go new file mode 100644 index 000000000000..b7c76c624cdc --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. + +// This package has the automatically generated typed clients. +package internalversion diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/doc.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/doc.go new file mode 100644 index 000000000000..1a7ea293d750 --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=internalclientset --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/fake_user.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/fake_user.go new file mode 100644 index 000000000000..c60fbf60c56b --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/fake_user.go @@ -0,0 +1,101 @@ +package fake + +import ( + api "github.com/openshift/origin/pkg/user/api" + pkg_api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeUsers implements UserResourceInterface +type FakeUsers struct { + Fake *FakeUser + ns string +} + +var usersResource = unversioned.GroupVersionResource{Group: "user.openshift.io", Version: "", Resource: "users"} + +func (c *FakeUsers) Create(user *api.User) (result *api.User, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(usersResource, c.ns, user), &api.User{}) + + if obj == nil { + return nil, err + } + return obj.(*api.User), err +} + +func (c *FakeUsers) Update(user *api.User) (result *api.User, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(usersResource, c.ns, user), &api.User{}) + + if obj == nil { + return nil, err + } + return obj.(*api.User), err +} + +func (c *FakeUsers) Delete(name string, options *pkg_api.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(usersResource, c.ns, name), &api.User{}) + + return err +} + +func (c *FakeUsers) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + action := core.NewDeleteCollectionAction(usersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &api.UserList{}) + return err +} + +func (c *FakeUsers) Get(name string) (result *api.User, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(usersResource, c.ns, name), &api.User{}) + + if obj == nil { + return nil, err + } + return obj.(*api.User), err +} + +func (c *FakeUsers) List(opts pkg_api.ListOptions) (result *api.UserList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(usersResource, c.ns, opts), &api.UserList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &api.UserList{} + for _, item := range obj.(*api.UserList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested users. +func (c *FakeUsers) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(usersResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched user. +func (c *FakeUsers) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.User, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(usersResource, c.ns, name, data, subresources...), &api.User{}) + + if obj == nil { + return nil, err + } + return obj.(*api.User), err +} diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/fake_user_client.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/fake_user_client.go new file mode 100644 index 000000000000..b6759fd4847f --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/fake/fake_user_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + internalversion "github.com/openshift/origin/pkg/user/clientset/internalclientset/typed/user/internalversion" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeUser struct { + *core.Fake +} + +func (c *FakeUser) Users(namespace string) internalversion.UserResourceInterface { + return &FakeUsers{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeUser) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/generated_expansion.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/generated_expansion.go new file mode 100644 index 000000000000..d502b987ecdc --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/generated_expansion.go @@ -0,0 +1,3 @@ +package internalversion + +type UserResourceExpansion interface{} diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/user.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/user.go new file mode 100644 index 000000000000..528b9afda81f --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/user.go @@ -0,0 +1,136 @@ +package internalversion + +import ( + api "github.com/openshift/origin/pkg/user/api" + pkg_api "k8s.io/kubernetes/pkg/api" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// UsersGetter has a method to return a UserResourceInterface. +// A group's client should implement this interface. +type UsersGetter interface { + Users(namespace string) UserResourceInterface +} + +// UserResourceInterface has methods to work with UserResource resources. +type UserResourceInterface interface { + Create(*api.User) (*api.User, error) + Update(*api.User) (*api.User, error) + Delete(name string, options *pkg_api.DeleteOptions) error + DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error + Get(name string) (*api.User, error) + List(opts pkg_api.ListOptions) (*api.UserList, error) + Watch(opts pkg_api.ListOptions) (watch.Interface, error) + Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.User, err error) + UserResourceExpansion +} + +// users implements UserResourceInterface +type users struct { + client restclient.Interface + ns string +} + +// newUsers returns a Users +func newUsers(c *UserClient, namespace string) *users { + return &users{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a user and creates it. Returns the server's representation of the user, and an error, if there is any. +func (c *users) Create(user *api.User) (result *api.User, err error) { + result = &api.User{} + err = c.client.Post(). + Namespace(c.ns). + Resource("users"). + Body(user). + Do(). + Into(result) + return +} + +// Update takes the representation of a user and updates it. Returns the server's representation of the user, and an error, if there is any. +func (c *users) Update(user *api.User) (result *api.User, err error) { + result = &api.User{} + err = c.client.Put(). + Namespace(c.ns). + Resource("users"). + Name(user.Name). + Body(user). + Do(). + Into(result) + return +} + +// Delete takes name of the user and deletes it. Returns an error if one occurs. +func (c *users) Delete(name string, options *pkg_api.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("users"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *users) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("users"). + VersionedParams(&listOptions, pkg_api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the user, and returns the corresponding user object, and an error if there is any. +func (c *users) Get(name string) (result *api.User, err error) { + result = &api.User{} + err = c.client.Get(). + Namespace(c.ns). + Resource("users"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Users that match those selectors. +func (c *users) List(opts pkg_api.ListOptions) (result *api.UserList, err error) { + result = &api.UserList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("users"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested users. +func (c *users) Watch(opts pkg_api.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("users"). + VersionedParams(&opts, pkg_api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched user. +func (c *users) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.User, err error) { + result = &api.User{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("users"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/user/clientset/internalclientset/typed/user/internalversion/user_client.go b/pkg/user/clientset/internalclientset/typed/user/internalversion/user_client.go new file mode 100644 index 000000000000..bd4051ef505e --- /dev/null +++ b/pkg/user/clientset/internalclientset/typed/user/internalversion/user_client.go @@ -0,0 +1,83 @@ +package internalversion + +import ( + api "k8s.io/kubernetes/pkg/api" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" +) + +type UserInterface interface { + RESTClient() restclient.Interface + UsersGetter +} + +// UserClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type UserClient struct { + restClient restclient.Interface +} + +func (c *UserClient) Users(namespace string) UserResourceInterface { + return newUsers(c, namespace) +} + +// NewForConfig creates a new UserClient for the given config. +func NewForConfig(c *restclient.Config) (*UserClient, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &UserClient{client}, nil +} + +// NewForConfigOrDie creates a new UserClient for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *UserClient { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new UserClient for the given RESTClient. +func New(c restclient.Interface) *UserClient { + return &UserClient{c} +} + +func setConfigDefaults(config *restclient.Config) error { + // if user group is not registered, return an error + g, err := registered.Group("user.openshift.io") + if err != nil { + return err + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group { + copyGroupVersion := g.GroupVersion + config.GroupVersion = ©GroupVersion + } + config.NegotiatedSerializer = api.Codecs + + if config.QPS == 0 { + config.QPS = 5 + } + if config.Burst == 0 { + config.Burst = 10 + } + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *UserClient) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/user/clientset/release_v3_6/clientset.go b/pkg/user/clientset/release_v3_6/clientset.go new file mode 100644 index 000000000000..a71b1efe52c0 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/clientset.go @@ -0,0 +1,86 @@ +package release_v3_6 + +import ( + "github.com/golang/glog" + v1user "github.com/openshift/origin/pkg/user/clientset/release_v3_6/typed/user/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + discovery "k8s.io/kubernetes/pkg/client/typed/discovery" + "k8s.io/kubernetes/pkg/util/flowcontrol" + _ "k8s.io/kubernetes/plugin/pkg/client/auth" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + UserV1() v1user.UserV1Interface + // Deprecated: please explicitly pick a version if possible. + User() v1user.UserV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + *v1user.UserV1Client +} + +// UserV1 retrieves the UserV1Client +func (c *Clientset) UserV1() v1user.UserV1Interface { + if c == nil { + return nil + } + return c.UserV1Client +} + +// Deprecated: User retrieves the default version of UserClient. +// Please explicitly pick a version. +func (c *Clientset) User() v1user.UserV1Interface { + if c == nil { + return nil + } + return c.UserV1Client +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *restclient.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var clientset Clientset + var err error + clientset.UserV1Client, err = v1user.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &clientset, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *Clientset { + var clientset Clientset + clientset.UserV1Client = v1user.NewForConfigOrDie(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &clientset +} + +// New creates a new Clientset for the given RESTClient. +func New(c restclient.Interface) *Clientset { + var clientset Clientset + clientset.UserV1Client = v1user.New(c) + + clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &clientset +} diff --git a/pkg/user/clientset/release_v3_6/doc.go b/pkg/user/clientset/release_v3_6/doc.go new file mode 100644 index 000000000000..e0cf9154b54b --- /dev/null +++ b/pkg/user/clientset/release_v3_6/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/v1] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. --version=v1 + +// This package has the automatically generated clientset. +package release_v3_6 diff --git a/pkg/user/clientset/release_v3_6/fake/clientset_generated.go b/pkg/user/clientset/release_v3_6/fake/clientset_generated.go new file mode 100644 index 000000000000..0469c2a65dc4 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/fake/clientset_generated.go @@ -0,0 +1,57 @@ +package fake + +import ( + clientset "github.com/openshift/origin/pkg/user/clientset/release_v3_6" + v1user "github.com/openshift/origin/pkg/user/clientset/release_v3_6/typed/user/v1" + fakev1user "github.com/openshift/origin/pkg/user/clientset/release_v3_6/typed/user/v1/fake" + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/apimachinery/registered" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/client/typed/discovery" + fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/watch" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := core.Fake{} + fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper())) + + fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + core.Fake +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return &fakediscovery.FakeDiscovery{Fake: &c.Fake} +} + +var _ clientset.Interface = &Clientset{} + +// UserV1 retrieves the UserV1Client +func (c *Clientset) UserV1() v1user.UserV1Interface { + return &fakev1user.FakeUserV1{Fake: &c.Fake} +} + +// User retrieves the UserV1Client +func (c *Clientset) User() v1user.UserV1Interface { + return &fakev1user.FakeUserV1{Fake: &c.Fake} +} diff --git a/pkg/user/clientset/release_v3_6/fake/doc.go b/pkg/user/clientset/release_v3_6/fake/doc.go new file mode 100644 index 000000000000..d2497d3b1919 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/v1] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. --version=v1 + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/doc.go b/pkg/user/clientset/release_v3_6/typed/user/v1/doc.go new file mode 100644 index 000000000000..a1c4d2ef5d2f --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/v1] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. --version=v1 + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/fake/doc.go b/pkg/user/clientset/release_v3_6/typed/user/v1/fake/doc.go new file mode 100644 index 000000000000..a603bd43995a --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with arguments: --clientset-name=release_v3_6 --clientset-path=github.com/openshift/origin/pkg/user/clientset --go-header-file=hack/boilerplate.txt --group=user --input=[api/v1] --input-base=github.com/openshift/origin/pkg/user --output-base=../../.. --version=v1 + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/fake/fake_user.go b/pkg/user/clientset/release_v3_6/typed/user/v1/fake/fake_user.go new file mode 100644 index 000000000000..4dbff9fa9305 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/fake/fake_user.go @@ -0,0 +1,102 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/user/api/v1" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + core "k8s.io/kubernetes/pkg/client/testing/core" + labels "k8s.io/kubernetes/pkg/labels" + watch "k8s.io/kubernetes/pkg/watch" +) + +// FakeUsers implements UserResourceInterface +type FakeUsers struct { + Fake *FakeUserV1 + ns string +} + +var usersResource = unversioned.GroupVersionResource{Group: "user.openshift.io", Version: "v1", Resource: "users"} + +func (c *FakeUsers) Create(user *v1.User) (result *v1.User, err error) { + obj, err := c.Fake. + Invokes(core.NewCreateAction(usersResource, c.ns, user), &v1.User{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.User), err +} + +func (c *FakeUsers) Update(user *v1.User) (result *v1.User, err error) { + obj, err := c.Fake. + Invokes(core.NewUpdateAction(usersResource, c.ns, user), &v1.User{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.User), err +} + +func (c *FakeUsers) Delete(name string, options *api_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(core.NewDeleteAction(usersResource, c.ns, name), &v1.User{}) + + return err +} + +func (c *FakeUsers) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + action := core.NewDeleteCollectionAction(usersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1.UserList{}) + return err +} + +func (c *FakeUsers) Get(name string) (result *v1.User, err error) { + obj, err := c.Fake. + Invokes(core.NewGetAction(usersResource, c.ns, name), &v1.User{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.User), err +} + +func (c *FakeUsers) List(opts api_v1.ListOptions) (result *v1.UserList, err error) { + obj, err := c.Fake. + Invokes(core.NewListAction(usersResource, c.ns, opts), &v1.UserList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := core.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.UserList{} + for _, item := range obj.(*v1.UserList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested users. +func (c *FakeUsers) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(core.NewWatchAction(usersResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched user. +func (c *FakeUsers) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.User, err error) { + obj, err := c.Fake. + Invokes(core.NewPatchSubresourceAction(usersResource, c.ns, name, data, subresources...), &v1.User{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.User), err +} diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/fake/fake_user_client.go b/pkg/user/clientset/release_v3_6/typed/user/v1/fake/fake_user_client.go new file mode 100644 index 000000000000..3ea5e852cad6 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/fake/fake_user_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/origin/pkg/user/clientset/release_v3_6/typed/user/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + core "k8s.io/kubernetes/pkg/client/testing/core" +) + +type FakeUserV1 struct { + *core.Fake +} + +func (c *FakeUserV1) Users(namespace string) v1.UserResourceInterface { + return &FakeUsers{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeUserV1) RESTClient() restclient.Interface { + var ret *restclient.RESTClient + return ret +} diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/generated_expansion.go b/pkg/user/clientset/release_v3_6/typed/user/v1/generated_expansion.go new file mode 100644 index 000000000000..6f6fbbf9591b --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type UserResourceExpansion interface{} diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/user.go b/pkg/user/clientset/release_v3_6/typed/user/v1/user.go new file mode 100644 index 000000000000..3847e2cdb650 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/user.go @@ -0,0 +1,137 @@ +package v1 + +import ( + v1 "github.com/openshift/origin/pkg/user/api/v1" + api "k8s.io/kubernetes/pkg/api" + api_v1 "k8s.io/kubernetes/pkg/api/v1" + restclient "k8s.io/kubernetes/pkg/client/restclient" + watch "k8s.io/kubernetes/pkg/watch" +) + +// UsersGetter has a method to return a UserResourceInterface. +// A group's client should implement this interface. +type UsersGetter interface { + Users(namespace string) UserResourceInterface +} + +// UserResourceInterface has methods to work with UserResource resources. +type UserResourceInterface interface { + Create(*v1.User) (*v1.User, error) + Update(*v1.User) (*v1.User, error) + Delete(name string, options *api_v1.DeleteOptions) error + DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error + Get(name string) (*v1.User, error) + List(opts api_v1.ListOptions) (*v1.UserList, error) + Watch(opts api_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.User, err error) + UserResourceExpansion +} + +// users implements UserResourceInterface +type users struct { + client restclient.Interface + ns string +} + +// newUsers returns a Users +func newUsers(c *UserV1Client, namespace string) *users { + return &users{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a user and creates it. Returns the server's representation of the user, and an error, if there is any. +func (c *users) Create(user *v1.User) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Post(). + Namespace(c.ns). + Resource("users"). + Body(user). + Do(). + Into(result) + return +} + +// Update takes the representation of a user and updates it. Returns the server's representation of the user, and an error, if there is any. +func (c *users) Update(user *v1.User) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Put(). + Namespace(c.ns). + Resource("users"). + Name(user.Name). + Body(user). + Do(). + Into(result) + return +} + +// Delete takes name of the user and deletes it. Returns an error if one occurs. +func (c *users) Delete(name string, options *api_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("users"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *users) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("users"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the user, and returns the corresponding user object, and an error if there is any. +func (c *users) Get(name string) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Get(). + Namespace(c.ns). + Resource("users"). + Name(name). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Users that match those selectors. +func (c *users) List(opts api_v1.ListOptions) (result *v1.UserList, err error) { + result = &v1.UserList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("users"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested users. +func (c *users) Watch(opts api_v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("users"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched user. +func (c *users) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("users"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/user/clientset/release_v3_6/typed/user/v1/user_client.go b/pkg/user/clientset/release_v3_6/typed/user/v1/user_client.go new file mode 100644 index 000000000000..c7bde99c2ed1 --- /dev/null +++ b/pkg/user/clientset/release_v3_6/typed/user/v1/user_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + fmt "fmt" + api "k8s.io/kubernetes/pkg/api" + unversioned "k8s.io/kubernetes/pkg/api/unversioned" + registered "k8s.io/kubernetes/pkg/apimachinery/registered" + restclient "k8s.io/kubernetes/pkg/client/restclient" + serializer "k8s.io/kubernetes/pkg/runtime/serializer" +) + +type UserV1Interface interface { + RESTClient() restclient.Interface + UsersGetter +} + +// UserV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. +type UserV1Client struct { + restClient restclient.Interface +} + +func (c *UserV1Client) Users(namespace string) UserResourceInterface { + return newUsers(c, namespace) +} + +// NewForConfig creates a new UserV1Client for the given config. +func NewForConfig(c *restclient.Config) (*UserV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := restclient.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &UserV1Client{client}, nil +} + +// NewForConfigOrDie creates a new UserV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *restclient.Config) *UserV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new UserV1Client for the given RESTClient. +func New(c restclient.Interface) *UserV1Client { + return &UserV1Client{c} +} + +func setConfigDefaults(config *restclient.Config) error { + gv, err := unversioned.ParseGroupVersion("user.openshift.io/v1") + if err != nil { + return err + } + // if user.openshift.io/v1 is not enabled, return an error + if !registered.IsEnabledVersion(gv) { + return fmt.Errorf("user.openshift.io/v1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = restclient.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *UserV1Client) RESTClient() restclient.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/test/extended/extended_test.go b/test/extended/extended_test.go index db11c894d0d6..e439ca2a1103 100644 --- a/test/extended/extended_test.go +++ b/test/extended/extended_test.go @@ -19,6 +19,7 @@ import ( _ "github.com/openshift/origin/test/extended/registry" _ "github.com/openshift/origin/test/extended/router" _ "github.com/openshift/origin/test/extended/security" + _ "github.com/openshift/origin/test/extended/templates" exutil "github.com/openshift/origin/test/extended/util" ) diff --git a/test/extended/setup.sh b/test/extended/setup.sh index 25b7c1e2ad8d..cf01c5555b02 100644 --- a/test/extended/setup.sh +++ b/test/extended/setup.sh @@ -121,6 +121,9 @@ function os::test::extended::setup () { cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" openshift ex config patch "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" --patch="{\"auditConfig\": {\"enabled\": true}}" > "${SERVER_CONFIG_DIR}/master/master-config.yaml" + cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" + openshift ex config patch "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" --patch="{\"enableTemplateServiceBroker\": true}" > "${SERVER_CONFIG_DIR}/master/master-config.yaml" + # If the XFS volume dir mount point exists enable local storage quota in node-config.yaml so these tests can pass: if [[ -n "${LOCAL_STORAGE_QUOTA}" ]]; then # The ec2 images usually have ~5Gi of space defined for the xfs vol for the registry; want to give /registry a good chunk of that @@ -147,6 +150,9 @@ function os::test::extended::setup () { os::log::info "Creating image streams" oc create -n openshift -f "${OS_ROOT}/examples/image-streams/image-streams-centos7.json" --config="${ADMIN_KUBECONFIG}" + + os::log::info "Creating sample app" + oc create -n openshift -f "${OS_ROOT}/examples/sample-app/application-template-stibuild.json" --config="${ADMIN_KUBECONFIG}" } # Run extended tests or print out a list of tests that need to be run diff --git a/test/extended/templates/helpers.go b/test/extended/templates/helpers.go new file mode 100644 index 000000000000..5f76b17dc91b --- /dev/null +++ b/test/extended/templates/helpers.go @@ -0,0 +1,57 @@ +package templates + +import ( + "fmt" + + g "github.com/onsi/ginkgo" + o "github.com/onsi/gomega" + + authorizationapi "github.com/openshift/origin/pkg/authorization/api" + userapi "github.com/openshift/origin/pkg/user/api" + exutil "github.com/openshift/origin/test/extended/util" + kapi "k8s.io/kubernetes/pkg/api" +) + +func createUser(cli *exutil.CLI, name, role string) *userapi.User { + name = cli.Namespace() + "-" + name + + user, err := cli.AdminClient().Users().Create(&userapi.User{ + ObjectMeta: kapi.ObjectMeta{ + Name: name, + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + _, err = cli.AdminClient().RoleBindings(cli.Namespace()).Create(&authorizationapi.RoleBinding{ + ObjectMeta: kapi.ObjectMeta{ + Name: fmt.Sprintf("%s-%s-binding", name, role), + }, + RoleRef: kapi.ObjectReference{ + Name: role, + }, + Subjects: []kapi.ObjectReference{ + { + Kind: authorizationapi.UserKind, + Name: name, + }, + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + return user +} + +func deleteUser(cli *exutil.CLI, user *userapi.User) { + err := cli.AdminClient().Users().Delete(user.Name) + o.Expect(err).NotTo(o.HaveOccurred()) +} + +func setUser(cli *exutil.CLI, user *userapi.User) { + if user == nil { + g.By("testing as system:admin user") + *cli = *cli.AsAdmin() + } else { + g.By(fmt.Sprintf("testing as %s user", user.Name)) + cli.ChangeUser(user.Name) + } +} diff --git a/test/extended/templates/templateinstance_impersonation.go b/test/extended/templates/templateinstance_impersonation.go new file mode 100644 index 000000000000..3d83d96fc7ae --- /dev/null +++ b/test/extended/templates/templateinstance_impersonation.go @@ -0,0 +1,236 @@ +package templates + +import ( + g "github.com/onsi/ginkgo" + o "github.com/onsi/gomega" + + authorizationapi "github.com/openshift/origin/pkg/authorization/api" + "github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" + templateapi "github.com/openshift/origin/pkg/template/api" + userapi "github.com/openshift/origin/pkg/user/api" + exutil "github.com/openshift/origin/test/extended/util" + kapi "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/util/sets" +) + +// 1. Check that users can't create or update templateinstances unless they are, +// or can impersonate, the requestor. +// 2. Check that templateinstancespecs, particularly including +// requestor.username, are immutable. +var _ = g.Describe("[templates] templateinstance impersonation tests", func() { + defer g.GinkgoRecover() + + var ( + cli = exutil.NewCLI("templates", exutil.KubeConfigPath()) + + adminuser *userapi.User // project admin, but can't impersonate anyone + impersonateuser *userapi.User // project edit, and can impersonate edituser1 + edituser1 *userapi.User // project edit, can be impersonated by impersonateuser + edituser2 *userapi.User // project edit + viewuser *userapi.User // project view + + clusterrole *authorizationapi.ClusterRole + clusterrolebinding *authorizationapi.ClusterRoleBinding + + dummytemplateinstance *templateapi.TemplateInstance + + tests []struct { + user *userapi.User + expectCreateUpdateSuccess bool + expectDeleteSuccess bool + } + ) + + g.BeforeEach(func() { + var err error + + adminuser = createUser(cli, "adminuser", bootstrappolicy.AdminRoleName) + impersonateuser = createUser(cli, "impersonateuser", bootstrappolicy.EditRoleName) + edituser1 = createUser(cli, "edituser1", bootstrappolicy.EditRoleName) + edituser2 = createUser(cli, "edituser2", bootstrappolicy.EditRoleName) + viewuser = createUser(cli, "viewuser", bootstrappolicy.ViewRoleName) + + dummytemplateinstance = &templateapi.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "test", + }, + Spec: templateapi.TemplateInstanceSpec{ + Template: templateapi.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "template", + Namespace: "dummy", + }, + }, + // all the tests work with a templateinstance which is set up to + // impersonate edituser1 + Requestor: &templateapi.TemplateInstanceRequestor{ + Username: edituser1.Name, + }, + }, + // post the status to avoid kicking off the controller + Status: templateapi.TemplateInstanceStatus{ + Conditions: []templateapi.TemplateInstanceCondition{ + { + Type: templateapi.TemplateInstanceReady, + Status: kapi.ConditionTrue, + }, + }, + }, + } + + tests = []struct { + user *userapi.User + expectCreateUpdateSuccess bool + expectDeleteSuccess bool + }{ + { + user: nil, // system-admin + expectCreateUpdateSuccess: true, // can impersonate anyone + expectDeleteSuccess: true, + }, + { + user: adminuser, + expectCreateUpdateSuccess: false, // cannot impersonate edituser1 + expectDeleteSuccess: true, + }, + { + user: impersonateuser, + expectCreateUpdateSuccess: true, // can impersonate edituser1 + expectDeleteSuccess: true, + }, + { + user: edituser1, + expectCreateUpdateSuccess: true, // is edituser1 + expectDeleteSuccess: true, + }, + { + user: edituser2, + expectCreateUpdateSuccess: false, // cannot impersonate edituser1 + expectDeleteSuccess: true, + }, + { + user: viewuser, + expectCreateUpdateSuccess: false, // cannot create things and cannot impersonate edituser1 + expectDeleteSuccess: false, + }, + } + + // additional plumbing to enable impersonateuser to impersonate edituser1 + clusterrole, err = cli.AdminClient().ClusterRoles().Create(&authorizationapi.ClusterRole{ + ObjectMeta: kapi.ObjectMeta{ + Name: cli.Namespace() + "-impersonate", + }, + Rules: []authorizationapi.PolicyRule{ + { + Verbs: sets.NewString("impersonate"), + APIGroups: []string{userapi.GroupName}, + Resources: sets.NewString(authorizationapi.UserResource), + ResourceNames: sets.NewString(edituser1.Name), + }, + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + clusterrolebinding, err = cli.AdminClient().ClusterRoleBindings().Create(&authorizationapi.ClusterRoleBinding{ + ObjectMeta: kapi.ObjectMeta{ + Name: cli.Namespace() + "-impersonate", + }, + RoleRef: kapi.ObjectReference{ + Name: clusterrole.Name, + }, + Subjects: []kapi.ObjectReference{ + { + Kind: authorizationapi.UserKind, + Name: impersonateuser.Name, + }, + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + }) + + g.AfterEach(func() { + deleteUser(cli, adminuser) + deleteUser(cli, impersonateuser) + deleteUser(cli, edituser1) + deleteUser(cli, edituser2) + deleteUser(cli, viewuser) + + err := cli.AdminClient().ClusterRoles().Delete(clusterrole.Name) + o.Expect(err).NotTo(o.HaveOccurred()) + err = cli.AdminClient().ClusterRoleBindings().Delete(clusterrolebinding.Name) + o.Expect(err).NotTo(o.HaveOccurred()) + }) + + g.It("should pass impersonation creation tests", func() { + // check who can create TemplateInstances (anyone with project write access + // AND is/can impersonate spec.requestor.username) + for _, test := range tests { + setUser(cli, test.user) + + templateinstancecopy, err := kapi.Scheme.DeepCopy(dummytemplateinstance) + o.Expect(err).NotTo(o.HaveOccurred()) + templateinstance, err := cli.TemplateClient().TemplateInstances(cli.Namespace()).Create(templateinstancecopy.(*templateapi.TemplateInstance)) + + if !test.expectCreateUpdateSuccess { + o.Expect(err).To(o.HaveOccurred()) + } else { + o.Expect(err).NotTo(o.HaveOccurred()) + + err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Delete(templateinstance.Name, nil) + o.Expect(err).NotTo(o.HaveOccurred()) + } + } + }) + + g.It("should pass impersonation update tests", func() { + // check who can update TemplateInstances (anyone with project write access + // AND is/can impersonate spec.requestor.username) + for _, test := range tests { + setUser(cli, test.user) + + templateinstancecopy, err := kapi.Scheme.DeepCopy(dummytemplateinstance) + o.Expect(err).NotTo(o.HaveOccurred()) + templateinstance, err := cli.AdminTemplateClient().TemplateInstances(cli.Namespace()).Create(templateinstancecopy.(*templateapi.TemplateInstance)) + o.Expect(err).NotTo(o.HaveOccurred()) + + newtemplateinstance, err := cli.TemplateClient().TemplateInstances(cli.Namespace()).Update(templateinstance) + if !test.expectCreateUpdateSuccess { + o.Expect(err).To(o.HaveOccurred()) + } else { + o.Expect(err).NotTo(o.HaveOccurred()) + templateinstance = newtemplateinstance + } + + // ensure spec (particularly including spec.requestor.username) is + // immutable + templateinstance.Spec.Requestor.Username = edituser2.Name + _, err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Update(templateinstance) + o.Expect(err).To(o.HaveOccurred()) + + err = cli.AdminTemplateClient().TemplateInstances(cli.Namespace()).Delete(templateinstance.Name, nil) + o.Expect(err).NotTo(o.HaveOccurred()) + } + }) + + g.It("should pass impersonation deletion tests", func() { + // check who can delete TemplateInstances (anyone with project write access) + for _, test := range tests { + setUser(cli, test.user) + + templateinstancecopy, err := kapi.Scheme.DeepCopy(dummytemplateinstance) + o.Expect(err).NotTo(o.HaveOccurred()) + templateinstance, err := cli.AdminTemplateClient().TemplateInstances(cli.Namespace()).Create(templateinstancecopy.(*templateapi.TemplateInstance)) + o.Expect(err).NotTo(o.HaveOccurred()) + + err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Delete(templateinstance.Name, nil) + if test.expectDeleteSuccess { + o.Expect(err).NotTo(o.HaveOccurred()) + } else { + o.Expect(err).To(o.HaveOccurred()) + + err = cli.AdminTemplateClient().TemplateInstances(cli.Namespace()).Delete(templateinstance.Name, nil) + o.Expect(err).NotTo(o.HaveOccurred()) + } + } + }) +}) diff --git a/test/extended/templates/templateinstance_security.go b/test/extended/templates/templateinstance_security.go new file mode 100644 index 000000000000..51120562b28f --- /dev/null +++ b/test/extended/templates/templateinstance_security.go @@ -0,0 +1,184 @@ +package templates + +import ( + "time" + + g "github.com/onsi/ginkgo" + o "github.com/onsi/gomega" + + "github.com/openshift/origin/pkg/api/latest" + authorizationapi "github.com/openshift/origin/pkg/authorization/api" + "github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" + templateapi "github.com/openshift/origin/pkg/template/api" + userapi "github.com/openshift/origin/pkg/user/api" + exutil "github.com/openshift/origin/test/extended/util" + kapi "k8s.io/kubernetes/pkg/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" + "k8s.io/kubernetes/pkg/runtime" + "k8s.io/kubernetes/pkg/util/wait" +) + +// Check that objects created through the TemplateInstance mechanism are done +// impersonating the requestor, and that privilege escalation is not possible. +var _ = g.Describe("[templates] templateinstance security tests", func() { + defer g.GinkgoRecover() + + var ( + cli = exutil.NewCLI("templates", exutil.KubeConfigPath()) + + adminuser, edituser *userapi.User + + dummyservice = &kapi.Service{ + ObjectMeta: kapi.ObjectMeta{ + Name: "service", + Namespace: "${NAMESPACE}", + }, + Spec: kapi.ServiceSpec{ + Ports: []kapi.ServicePort{ + { + Port: 1, + }, + }, + }, + } + + dummyrolebinding = &authorizationapi.RoleBinding{ + ObjectMeta: kapi.ObjectMeta{ + Name: "rolebinding", + Namespace: "${NAMESPACE}", + }, + RoleRef: kapi.ObjectReference{ + Name: bootstrappolicy.AdminRoleName, + }, + } + ) + + g.BeforeEach(func() { + adminuser = createUser(cli, "adminuser", bootstrappolicy.AdminRoleName) + edituser = createUser(cli, "edituser", bootstrappolicy.EditRoleName) + }) + + g.AfterEach(func() { + deleteUser(cli, adminuser) + deleteUser(cli, edituser) + }) + + g.It("should pass security tests", func() { + tests := []struct { + by string + user *userapi.User + namespace string + objects []runtime.Object + expectCondition templateapi.TemplateInstanceConditionType + checkOK func(namespace string) bool + }{ + { + by: "checking edituser can create an object in a permitted namespace", + user: edituser, + namespace: cli.Namespace(), + objects: []runtime.Object{dummyservice}, + expectCondition: templateapi.TemplateInstanceReady, + checkOK: func(namespace string) bool { + _, err := cli.AdminKubeClient().Services(namespace).Get(dummyservice.Name) + return err == nil + }, + }, + { + by: "checking edituser can't create an object in a non-permitted namespace", + user: edituser, + namespace: "default", + objects: []runtime.Object{dummyservice}, + expectCondition: templateapi.TemplateInstanceInstantiateFailure, + checkOK: func(namespace string) bool { + _, err := cli.AdminKubeClient().Services(namespace).Get(dummyservice.Name) + return err != nil && kerrors.IsNotFound(err) + }, + }, + { + by: "checking edituser can't create a privileged object", + user: edituser, + namespace: cli.Namespace(), + objects: []runtime.Object{dummyrolebinding}, + expectCondition: templateapi.TemplateInstanceInstantiateFailure, + checkOK: func(namespace string) bool { + _, err := cli.AdminClient().RoleBindings(namespace).Get(dummyrolebinding.Name) + return err != nil && kerrors.IsNotFound(err) + }, + }, + { + by: "checking adminuser can create a privileged object", + user: adminuser, + namespace: cli.Namespace(), + objects: []runtime.Object{dummyrolebinding}, + expectCondition: templateapi.TemplateInstanceReady, + checkOK: func(namespace string) bool { + _, err := cli.AdminClient().RoleBindings(namespace).Get(dummyrolebinding.Name) + return err == nil + }, + }, + } + + for _, test := range tests { + g.By(test.by) + cli.ChangeUser(test.user.Name) + + secret, err := cli.KubeClient().Secrets(cli.Namespace()).Create(&kapi.Secret{ + ObjectMeta: kapi.ObjectMeta{ + Name: "secret", + }, + Data: map[string][]byte{ + "NAMESPACE": []byte(test.namespace), + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + templateinstance := &templateapi.TemplateInstance{ + ObjectMeta: kapi.ObjectMeta{ + Name: "templateinstance", + }, + Spec: templateapi.TemplateInstanceSpec{ + Template: templateapi.Template{ + ObjectMeta: kapi.ObjectMeta{ + Name: "template", + Namespace: cli.Namespace(), + }, + Parameters: []templateapi.Parameter{ + { + Name: "NAMESPACE", + Required: true, + }, + }, + }, + Secret: kapi.LocalObjectReference{ + Name: "secret", + }, + }, + } + + err = templateapi.AddObjectsToTemplate(&templateinstance.Spec.Template, test.objects, latest.Versions...) + o.Expect(err).NotTo(o.HaveOccurred()) + + templateinstance, err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Create(templateinstance) + o.Expect(err).NotTo(o.HaveOccurred()) + + err = wait.Poll(100*time.Millisecond, 1*time.Minute, func() (bool, error) { + templateinstance, err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Get(templateinstance.Name) + if err != nil { + return false, err + } + return len(templateinstance.Status.Conditions) != 0, nil + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + cond := &templateinstance.Status.Conditions[0] + o.Expect(cond.Status).To(o.Equal(kapi.ConditionTrue)) + o.Expect(cond.Type).To(o.Equal(test.expectCondition)) + o.Expect(test.checkOK(test.namespace)).To(o.BeTrue()) + + err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Delete(templateinstance.Name, nil) + o.Expect(err).NotTo(o.HaveOccurred()) + err = cli.KubeClient().Secrets(cli.Namespace()).Delete(secret.Name, nil) + o.Expect(err).NotTo(o.HaveOccurred()) + } + }) +}) diff --git a/test/extended/templates/templateservicebroker_e2e.go b/test/extended/templates/templateservicebroker_e2e.go new file mode 100644 index 000000000000..0d84b36dc6c0 --- /dev/null +++ b/test/extended/templates/templateservicebroker_e2e.go @@ -0,0 +1,220 @@ +package templates + +import ( + "crypto/tls" + "golang.org/x/net/context" + "net/http" + "strconv" + + g "github.com/onsi/ginkgo" + o "github.com/onsi/gomega" + "github.com/pborman/uuid" + + authorizationapi "github.com/openshift/origin/pkg/authorization/api" + "github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" + "github.com/openshift/origin/pkg/openservicebroker/api" + "github.com/openshift/origin/pkg/openservicebroker/client" + templateapi "github.com/openshift/origin/pkg/template/api" + templateapiv1 "github.com/openshift/origin/pkg/template/api/v1" + exutil "github.com/openshift/origin/test/extended/util" + testutil "github.com/openshift/origin/test/util" + kapi "k8s.io/kubernetes/pkg/api" + kerrors "k8s.io/kubernetes/pkg/api/errors" +) + +var _ = g.Describe("[templates] templateservicebroker end-to-end test", func() { + defer g.GinkgoRecover() + + var ( + cli = exutil.NewCLI("templates", exutil.KubeConfigPath()) + instanceID = uuid.NewRandom().String() + bindingID = uuid.NewRandom().String() + template *templateapi.Template + clusterrolebinding *authorizationapi.ClusterRoleBinding + brokercli client.Client + service *api.Service + plan *api.Plan + ) + + g.BeforeEach(func() { + var err error + + template, err = cli.Client().Templates("openshift").Get("ruby-helloworld-sample") + o.Expect(err).NotTo(o.HaveOccurred()) + + clusterrolebinding, err = cli.AdminClient().ClusterRoleBindings().Create(&authorizationapi.ClusterRoleBinding{ + ObjectMeta: kapi.ObjectMeta{ + Name: cli.Namespace() + "templateservicebroker-client-binding", + }, + RoleRef: kapi.ObjectReference{ + Name: bootstrappolicy.TemplateServiceBrokerClientRoleName, + }, + Subjects: []kapi.ObjectReference{ + { + Kind: authorizationapi.GroupKind, + Name: bootstrappolicy.UnauthenticatedGroup, + }, + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + adminClientConfig, err := testutil.GetClusterAdminClientConfig(exutil.KubeConfigPath()) + o.Expect(err).NotTo(o.HaveOccurred()) + + brokercli = client.NewClient(&http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}, adminClientConfig.Host+templateapi.ServiceBrokerRoot) + }) + + g.AfterEach(func() { + err := cli.AdminClient().ClusterRoleBindings().Delete(clusterrolebinding.Name) + o.Expect(err).NotTo(o.HaveOccurred()) + + cli.AdminTemplateClient().BrokerTemplateInstances().Delete(instanceID, nil) + }) + + catalog := func() { + g.By("returning a catalog") + catalog, err := brokercli.Catalog(context.Background()) + o.Expect(err).NotTo(o.HaveOccurred()) + + for _, service = range catalog.Services { + if service.ID == string(template.UID) { + o.Expect(service.Plans).NotTo(o.BeEmpty()) + plan = &service.Plans[0] + break + } + } + o.Expect(service.ID).To(o.BeEquivalentTo(template.UID)) + } + + provision := func() { + g.By("provisioning a service") + _, err := brokercli.Provision(context.Background(), instanceID, &api.ProvisionRequest{ + ServiceID: service.ID, + PlanID: plan.ID, + Parameters: map[string]string{ + templateapi.NamespaceParameterKey: cli.Namespace(), + templateapi.RequesterUsernameParameterKey: cli.Username(), + "MYSQL_USER": "test", + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + brokerTemplateInstance, err := cli.AdminTemplateClient().BrokerTemplateInstances().Get(instanceID) + o.Expect(err).NotTo(o.HaveOccurred()) + templateInstance, err := cli.TemplateClient().TemplateInstances(cli.Namespace()).Get(instanceID) + o.Expect(err).NotTo(o.HaveOccurred()) + secret, err := cli.KubeClient().Secrets(cli.Namespace()).Get(instanceID) + o.Expect(err).NotTo(o.HaveOccurred()) + + o.Expect(brokerTemplateInstance.Spec).To(o.Equal(templateapi.BrokerTemplateInstanceSpec{ + TemplateInstance: kapi.ObjectReference{ + Kind: "TemplateInstance", + Namespace: cli.Namespace(), + Name: templateInstance.Name, + UID: templateInstance.UID, + }, + Secret: kapi.ObjectReference{ + Kind: "Secret", + Namespace: cli.Namespace(), + Name: secret.Name, + UID: secret.UID, + }, + })) + + o.Expect(templateInstance.Spec).To(o.Equal(templateapi.TemplateInstanceSpec{ + Template: *template, + Secret: kapi.LocalObjectReference{ + Name: secret.Name, + }, + Requestor: &templateapi.TemplateInstanceRequestor{ + Username: cli.Username(), + }, + })) + + o.Expect(templateInstance.Status.Conditions).To(o.HaveLen(1)) + o.Expect(templateInstance.Status.Conditions[0].Type).To(o.Equal(templateapi.TemplateInstanceReady)) + o.Expect(templateInstance.Status.Conditions[0].Status).To(o.Equal(kapi.ConditionTrue)) + + o.Expect(secret.Type).To(o.Equal(kapi.SecretTypeOpaque)) + o.Expect(secret.Data).To(o.Equal(map[string][]byte{ + "MYSQL_USER": []byte("test"), + })) + + dbsecret, err := cli.KubeClient().Secrets(cli.Namespace()).Get("dbsecret") + o.Expect(err).NotTo(o.HaveOccurred()) + + o.Expect(dbsecret.Labels[templateapi.TemplateInstanceLabel]).To(o.Equal(instanceID)) + o.Expect(dbsecret.OwnerReferences).To(o.ContainElement(kapi.OwnerReference{ + APIVersion: templateapiv1.SchemeGroupVersion.String(), + Kind: "TemplateInstance", + Name: templateInstance.Name, + UID: templateInstance.UID, + })) + o.Expect(dbsecret.Data["mysql-user"]).To(o.BeEquivalentTo("test")) + o.Expect(dbsecret.Data["mysql-password"]).To(o.MatchRegexp("^[a-zA-Z0-9]{8}$")) + } + + bind := func() { + g.By("binding to a service") + bind, err := brokercli.Bind(context.Background(), instanceID, bindingID, &api.BindRequest{ + ServiceID: service.ID, + PlanID: plan.ID, + Parameters: map[string]string{ + templateapi.RequesterUsernameParameterKey: cli.Username(), + }, + }) + o.Expect(err).NotTo(o.HaveOccurred()) + + brokerTemplateInstance, err := cli.AdminTemplateClient().BrokerTemplateInstances().Get(instanceID) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(brokerTemplateInstance.Spec.BindingIDs).To(o.Equal([]string{bindingID})) + + services := bind.Credentials["services"].(map[string]interface{}) + + service, err := cli.KubeClient().Services(cli.Namespace()).Get("database") + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(services["DATABASE_SERVICE_HOST"]).To(o.Equal(service.Spec.ClusterIP)) + o.Expect(services["DATABASE_SERVICE_PORT"]).To(o.Equal(strconv.Itoa(int(service.Spec.Ports[0].Port)))) + } + + unbind := func() { + g.By("unbinding from a service") + err := brokercli.Unbind(context.Background(), instanceID, bindingID) + o.Expect(err).NotTo(o.HaveOccurred()) + + brokerTemplateInstance, err := cli.AdminTemplateClient().BrokerTemplateInstances().Get(instanceID) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(brokerTemplateInstance.Spec.BindingIDs).To(o.HaveLen(0)) + } + + deprovision := func() { + g.By("deprovisioning a service") + err := brokercli.Deprovision(context.Background(), instanceID) + o.Expect(err).NotTo(o.HaveOccurred()) + + _, err = cli.AdminTemplateClient().BrokerTemplateInstances().Get(instanceID) + o.Expect(err).To(o.HaveOccurred()) + o.Expect(kerrors.IsNotFound(err)).To(o.BeTrue()) + + _, err = cli.TemplateClient().TemplateInstances(cli.Namespace()).Get(instanceID) + o.Expect(err).To(o.HaveOccurred()) + o.Expect(kerrors.IsNotFound(err)).To(o.BeTrue()) + + _, err = cli.KubeClient().Secrets(cli.Namespace()).Get(instanceID) + o.Expect(err).To(o.HaveOccurred()) + o.Expect(kerrors.IsNotFound(err)).To(o.BeTrue()) + + _, err = cli.KubeClient().Secrets(cli.Namespace()).Get("dbsecret") + // TODO: uncomment when GC is enabled + // o.Expect(err).To(o.HaveOccurred()) + // o.Expect(kerrors.IsNotFound(err)).To(o.BeTrue()) + } + + g.It("should pass an end-to-end test", func() { + catalog() + provision() + bind() + unbind() + deprovision() + }) +}) diff --git a/test/extended/util/cli.go b/test/extended/util/cli.go index 90e279e33f63..72d30c7c6111 100644 --- a/test/extended/util/cli.go +++ b/test/extended/util/cli.go @@ -27,6 +27,7 @@ import ( "github.com/openshift/origin/pkg/cmd/cli/config" configapi "github.com/openshift/origin/pkg/cmd/server/api" projectapi "github.com/openshift/origin/pkg/project/api" + templateclientset "github.com/openshift/origin/pkg/template/clientset/internalclientset" testutil "github.com/openshift/origin/test/util" ) @@ -200,6 +201,27 @@ func (c *CLI) AdminClient() *client.Client { return osClient } +// Client provides an OpenShift client for the current user. If the user is not +// set, then it provides client for the cluster admin user +func (c *CLI) TemplateClient() *templateclientset.Clientset { + _, clientConfig, err := configapi.GetKubeClient(c.configPath, nil) + client, err := templateclientset.NewForConfig(clientConfig) + if err != nil { + FatalErr(err) + } + return client +} + +// AdminClient provides an OpenShift client for the cluster admin user. +func (c *CLI) AdminTemplateClient() *templateclientset.Clientset { + _, clientConfig, err := configapi.GetKubeClient(c.adminConfigPath, nil) + client, err := templateclientset.NewForConfig(clientConfig) + if err != nil { + FatalErr(err) + } + return client +} + // KubeClient provides a Kubernetes client for the current namespace func (c *CLI) KubeClient() *kclientset.Clientset { kubeClient, _, err := configapi.GetKubeClient(c.configPath, nil) diff --git a/test/integration/etcd_storage_path_test.go b/test/integration/etcd_storage_path_test.go index 5ae253026e5f..3136a6fb52f2 100644 --- a/test/integration/etcd_storage_path_test.go +++ b/test/integration/etcd_storage_path_test.go @@ -306,6 +306,14 @@ var etcdStorageData = map[unversioned.GroupVersionResource]struct { expectedEtcdPath: "openshift.io/templates/etcdstoragepathtestnamespace/template1g", expectedGVK: gvkP("", "v1", "Template"), // expect the legacy group to be persisted }, + gvr("template.openshift.io", "v1", "templateinstances"): { + stub: `{"metadata": {"name": "templateinstance1"}, "spec": {"template": {"metadata": {"name": "template1", "namespace": "etcdstoragepathtestnamespace"}}, "requestor": {"username": "test"}}}`, + expectedEtcdPath: "openshift.io/templateinstances/etcdstoragepathtestnamespace/templateinstance1", + }, + gvr("template.openshift.io", "v1", "brokertemplateinstances"): { + stub: `{"metadata": {"name": "brokertemplateinstance1"}, "spec": {"templateInstance": {"kind": "TemplateInstance", "name": "templateinstance1", "namespace": "etcdstoragepathtestnamespace"}, "secret": {"kind": "Secret", "name": "secret1", "namespace": "etcdstoragepathtestnamespace"}}}`, + expectedEtcdPath: "openshift.io/brokertemplateinstances/brokertemplateinstance1", + }, // -- // github.com/openshift/origin/pkg/user/api/v1 @@ -740,6 +748,7 @@ func TestEtcdStoragePath(t *testing.T) { t.Fatalf("error getting master config: %#v", err) } masterConfig.AdmissionConfig.PluginOrderOverride = []string{"PodNodeSelector"} // remove most admission checks to make testing easier + masterConfig.EnableTemplateServiceBroker = true kubeConfigFile, err := testserver.StartConfiguredMaster(masterConfig) if err != nil { diff --git a/test/integration/unprivileged_newproject_test.go b/test/integration/unprivileged_newproject_test.go index 5e08643a5ad6..a264ea43e6ab 100644 --- a/test/integration/unprivileged_newproject_test.go +++ b/test/integration/unprivileged_newproject_test.go @@ -15,8 +15,34 @@ import ( "github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" "github.com/openshift/origin/pkg/cmd/util/tokencmd" projectapi "github.com/openshift/origin/pkg/project/api" + projectclient "github.com/openshift/origin/pkg/project/clientset/internalclientset" testutil "github.com/openshift/origin/test/util" testserver "github.com/openshift/origin/test/util/server" + + // make sure all generated clients compile + // these are only here because it's the spot I chose to use a generated clientset for a test + _ "github.com/openshift/origin/pkg/authorization/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/authorization/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/build/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/build/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/deploy/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/deploy/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/image/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/image/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/oauth/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/oauth/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/project/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/project/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/quota/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/quota/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/route/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/route/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/sdn/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/sdn/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/template/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/template/clientset/release_v3_6" + _ "github.com/openshift/origin/pkg/user/clientset/internalclientset" + _ "github.com/openshift/origin/pkg/user/clientset/release_v3_6" ) func TestUnprivilegedNewProject(t *testing.T) { @@ -47,6 +73,7 @@ func TestUnprivilegedNewProject(t *testing.T) { } valerieClientConfig.BearerToken = accessToken + valerieProjectClient := projectclient.NewForConfigOrDie(&valerieClientConfig) valerieOpenshiftClient, err := client.New(&valerieClientConfig) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -76,7 +103,7 @@ func TestUnprivilegedNewProject(t *testing.T) { waitForProject(t, valerieOpenshiftClient, "new-project", 5*time.Second, 10) - actualProject, err := valerieOpenshiftClient.Projects().Get("new-project") + actualProject, err := valerieProjectClient.Projects().Get("new-project") if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml b/test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml index 18a6ada22c87..869805f6d9f4 100644 --- a/test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml +++ b/test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml @@ -312,6 +312,7 @@ items: resources: - processedtemplates - templateconfigs + - templateinstances - templates verbs: - get @@ -930,6 +931,7 @@ items: resources: - processedtemplates - templateconfigs + - templateinstances - templates verbs: - create @@ -1300,6 +1302,7 @@ items: resources: - processedtemplates - templateconfigs + - templateinstances - templates verbs: - create @@ -1547,6 +1550,7 @@ items: resources: - processedtemplates - templateconfigs + - templateinstances - templates verbs: - get @@ -2724,6 +2728,24 @@ items: - projects verbs: - get +- apiVersion: v1 + kind: ClusterRole + metadata: + annotations: + authorization.openshift.io/system-only: "true" + creationTimestamp: null + name: templateservicebroker-client + rules: + - apiGroups: null + attributeRestrictions: null + nonResourceURLs: + - /brokers/template.openshift.io/* + resources: [] + verbs: + - delete + - get + - put + - update - apiVersion: v1 kind: ClusterRole metadata: diff --git a/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/client_generator.go b/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/client_generator.go index 11e7833c3af2..dc3a66d655cf 100644 --- a/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/client_generator.go +++ b/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/client_generator.go @@ -40,8 +40,31 @@ func NameSystems() namer.NameSystems { "SecurityContextConstraints": "SecurityContextConstraints", } + + publicNamer := &ExceptionNamer{ + Exceptions: map[string]string{ + // these exceptions are used to deconflict the generated code + "github.com/openshift/origin/pkg/build/api/v1.Build": "BuildResource", + "github.com/openshift/origin/pkg/build/api.Build": "BuildResource", + "github.com/openshift/origin/pkg/image/api/v1.Image": "ImageResource", + "github.com/openshift/origin/pkg/image/api.Image": "ImageResource", + "github.com/openshift/origin/pkg/project/api/v1.Project": "ProjectResource", + "github.com/openshift/origin/pkg/project/api.Project": "ProjectResource", + "github.com/openshift/origin/pkg/route/api/v1.Route": "RouteResource", + "github.com/openshift/origin/pkg/route/api.Route": "RouteResource", + "github.com/openshift/origin/pkg/template/api/v1.Template": "TemplateResource", + "github.com/openshift/origin/pkg/template/api.Template": "TemplateResource", + "github.com/openshift/origin/pkg/user/api/v1.User": "UserResource", + "github.com/openshift/origin/pkg/user/api.User": "UserResource", + }, + KeyFunc: func(t *types.Type) string { + return t.Name.Package + "." + t.Name.Name + }, + Delegate: namer.NewPublicNamer(0), + } + return namer.NameSystems{ - "public": namer.NewPublicNamer(0), + "public": publicNamer, "private": namer.NewPrivateNamer(0), "raw": namer.NewRawNamer("", nil), "publicPlural": namer.NewPublicPluralNamer(pluralExceptions), @@ -50,6 +73,22 @@ func NameSystems() namer.NameSystems { } } +type ExceptionNamer struct { + Exceptions map[string]string + KeyFunc func(*types.Type) string + + Delegate namer.Namer +} + +func (n *ExceptionNamer) Name(t *types.Type) string { + key := n.KeyFunc(t) + if exception, ok := n.Exceptions[key]; ok { + return exception + } + + return n.Delegate.Name(t) +} + // DefaultNameSystem returns the default name system for ordering the types to be // processed by the generators in this package. func DefaultNameSystem() string { diff --git a/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/main.go b/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/main.go index de157773cbd9..b4087903ca92 100644 --- a/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/main.go +++ b/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/main.go @@ -56,6 +56,11 @@ var ( fakeClient = flag.Bool("fake-clientset", true, "when set, client-gen will generate the fake clientset that can be used in tests") ) +var ( + groupFlag = flag.String("group", "", "specifies the group you want") + versionFlag = flag.String("version", "", "specifies the version you want") +) + func versionToPath(gvPath string, group string, version string) (path string) { // special case for the core group if group == "api" { @@ -126,6 +131,26 @@ func parseInputVersions() (paths []string, groups []types.GroupVersions, gvToPat return paths, groups, gvToPath, nil } +// specifiedInputVersions is a temporary measure to generate working clients for openshift with our non-standard package layout +func specifiedInputVersions() (paths []string, groups []types.GroupVersions, gvToPath map[types.GroupVersion]string, err error) { + gv, err := types.ToGroupVersion(*groupFlag + "/" + *versionFlag) + if err != nil { + return nil, nil, nil, err + } + path := filepath.Join(*basePath, (*inputVersions)[0]) + paths = append(paths, path) + + group := types.GroupVersions{ + Group: gv.Group, + Versions: []types.Version{gv.Version}, + } + groups = append(groups, group) + + gvToPath = map[types.GroupVersion]string{} + gvToPath[gv] = path + + return paths, groups, gvToPath, nil +} func parseIncludedTypesOverrides() (map[types.GroupVersion][]string, error) { overrides := make(map[types.GroupVersion][]string) for _, input := range *includedTypesOverrides { @@ -182,7 +207,16 @@ func main() { CmdArgs: cmdArgs, } } else { - inputPath, groups, gvToPath, err := parseInputVersions() + var inputPath []string + var groups []types.GroupVersions + var gvToPath map[types.GroupVersion]string + var err error + + if len(*inputVersions) == 1 && len(*groupFlag) > 0 { + inputPath, groups, gvToPath, err = specifiedInputVersions() + } else { + inputPath, groups, gvToPath, err = parseInputVersions() + } if err != nil { glog.Fatalf("Error: %v", err) }