Documentation ¶
Index ¶
Constants ¶
View Source
const TestNamespace = "etcdstoragepathtestnamespace"
namespace used for all tests, do not change this
Variables ¶
View Source
var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") )
View Source
var OpenshiftEtcdStorageData = map[schema.GroupVersionResource]etcddata.StorageData{ gvr("authorization.openshift.io", "v1", "roles"): { Stub: `{"metadata": {"name": "r1b1o2"}, "rules": [{"verbs": ["create"], "apiGroups": ["authorization.k8s.io"], "resources": ["selfsubjectaccessreviews"]}]}`, ExpectedEtcdPath: "kubernetes.io/roles/etcdstoragepathtestnamespace/r1b1o2", ExpectedGVK: gvkP("rbac.authorization.k8s.io", "v1", "Role"), }, gvr("authorization.openshift.io", "v1", "clusterroles"): { Stub: `{"metadata": {"name": "cr1a1o2"}, "rules": [{"verbs": ["create"], "apiGroups": ["authorization.k8s.io"], "resources": ["selfsubjectaccessreviews"]}]}`, ExpectedEtcdPath: "kubernetes.io/clusterroles/cr1a1o2", ExpectedGVK: gvkP("rbac.authorization.k8s.io", "v1", "ClusterRole"), }, gvr("authorization.openshift.io", "v1", "rolebindings"): { Stub: `{"metadata": {"name": "rb1a1o2"}, "subjects": [{"kind": "Group", "name": "system:authenticated"}], "roleRef": {"kind": "Role", "name": "r1a1"}}`, ExpectedEtcdPath: "kubernetes.io/rolebindings/etcdstoragepathtestnamespace/rb1a1o2", ExpectedGVK: gvkP("rbac.authorization.k8s.io", "v1", "RoleBinding"), }, gvr("authorization.openshift.io", "v1", "clusterrolebindings"): { Stub: `{"metadata": {"name": "crb1a1o2"}, "subjects": [{"kind": "Group", "name": "system:authenticated"}], "roleRef": {"kind": "ClusterRole", "name": "cr1a1"}}`, ExpectedEtcdPath: "kubernetes.io/clusterrolebindings/crb1a1o2", ExpectedGVK: gvkP("rbac.authorization.k8s.io", "v1", "ClusterRoleBinding"), }, gvr("build.openshift.io", "v1", "builds"): { Stub: `{"metadata": {"name": "build1g"}, "spec": {"source": {"dockerfile": "Dockerfile1"}, "strategy": {"dockerStrategy": {"noCache": true}}}}`, ExpectedEtcdPath: "openshift.io/builds/etcdstoragepathtestnamespace/build1g", }, gvr("build.openshift.io", "v1", "buildconfigs"): { Stub: `{"metadata": {"name": "bc1g"}, "spec": {"source": {"dockerfile": "Dockerfile0"}, "strategy": {"dockerStrategy": {"noCache": true}}}}`, ExpectedEtcdPath: "openshift.io/buildconfigs/etcdstoragepathtestnamespace/bc1g", }, gvr("apps.openshift.io", "v1", "deploymentconfigs"): { Stub: `{"metadata": {"name": "dc1g"}, "spec": {"selector": {"d": "c"}, "template": {"metadata": {"labels": {"d": "c"}}, "spec": {"containers": [{"image": "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest", "name": "container2"}]}}}}`, ExpectedEtcdPath: "openshift.io/deploymentconfigs/etcdstoragepathtestnamespace/dc1g", }, gvr("image.openshift.io", "v1", "imagestreams"): { Stub: `{"metadata": {"name": "is1g"}, "spec": {"dockerImageRepository": "docker"}}`, ExpectedEtcdPath: "openshift.io/imagestreams/etcdstoragepathtestnamespace/is1g", }, gvr("image.openshift.io", "v1", "images"): { Stub: `{"dockerImageReference": "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest", "metadata": {"name": "image1g"}}`, ExpectedEtcdPath: "openshift.io/images/image1g", }, gvr("oauth.openshift.io", "v1", "oauthclientauthorizations"): { Stub: `{"clientName": "system:serviceaccount:etcdstoragepathtestnamespace:clientg", "metadata": {"name": "user:system:serviceaccount:etcdstoragepathtestnamespace:clientg"}, "scopes": ["user:info"], "userName": "user", "userUID": "cannot be empty"}`, ExpectedEtcdPath: "openshift.io/oauth/clientauthorizations/user:system:serviceaccount:etcdstoragepathtestnamespace:clientg", Prerequisites: []etcddata.Prerequisite{ { GvrData: gvr("", "v1", "serviceaccounts"), Stub: `{"metadata": {"annotations": {"serviceaccounts.openshift.io/oauth-redirecturi.foo": "http://bar"}, "name": "clientg"}}`, }, { GvrData: gvr("", "v1", "secrets"), Stub: `{"metadata": {"annotations": {"kubernetes.io/service-account.name": "clientg"}, "generateName": "clientg"}, "type": "kubernetes.io/service-account-token"}`, }, }, }, gvr("oauth.openshift.io", "v1", "oauthaccesstokens"): { Stub: `{"clientName": "client1g", "metadata": {"name": "tokenneedstobelongenoughelseitwontworkg"}, "userName": "user", "scopes": ["user:info"], "redirectURI": "https://something.com/", "userUID": "cannot be empty"}`, ExpectedEtcdPath: "openshift.io/oauth/accesstokens/tokenneedstobelongenoughelseitwontworkg", Prerequisites: []etcddata.Prerequisite{ { GvrData: gvr("oauth.openshift.io", "v1", "oauthclients"), Stub: `{"metadata": {"name": "client1g"}, "grantMethod": "prompt"}`, }, }, }, gvr("oauth.openshift.io", "v1", "oauthauthorizetokens"): { Stub: `{"clientName": "client0g", "metadata": {"name": "tokenneedstobelongenoughelseitwontworkg"}, "userName": "user", "scopes": ["user:info"], "redirectURI": "https://something.com/", "userUID": "cannot be empty", "expiresIn": 86400}`, ExpectedEtcdPath: "openshift.io/oauth/authorizetokens/tokenneedstobelongenoughelseitwontworkg", Prerequisites: []etcddata.Prerequisite{ { GvrData: gvr("oauth.openshift.io", "v1", "oauthclients"), Stub: `{"metadata": {"name": "client0g"}, "grantMethod": "auto"}`, }, }, }, gvr("oauth.openshift.io", "v1", "oauthclients"): { Stub: `{"metadata": {"name": "clientg"}, "grantMethod": "prompt"}`, ExpectedEtcdPath: "openshift.io/oauth/clients/clientg", }, gvr("project.openshift.io", "v1", "projects"): { Stub: `{"metadata": {"name": "namespace2g"}, "spec": {"finalizers": ["kubernetes", "openshift.io/origin"]}}`, ExpectedEtcdPath: "kubernetes.io/namespaces/namespace2g", ExpectedGVK: gvkP("", "v1", "Namespace"), }, gvr("route.openshift.io", "v1", "routes"): { Stub: `{"metadata": {"name": "route1g"}, "spec": {"host": "hostname1.com", "to": {"name": "service1"}}}`, ExpectedEtcdPath: "openshift.io/routes/etcdstoragepathtestnamespace/route1g", }, gvr("security.openshift.io", "v1", "rangeallocations"): { Stub: `{"metadata": {"name": "scc2"}, "range": "", "data": ""}`, ExpectedEtcdPath: "openshift.io/rangeallocations/scc2", }, gvr("template.openshift.io", "v1", "templates"): { Stub: `{"message": "Jenkins template", "metadata": {"name": "template1g"}}`, ExpectedEtcdPath: "openshift.io/templates/etcdstoragepathtestnamespace/template1g", }, gvr("template.openshift.io", "v1", "templateinstances"): { Stub: `{"metadata": {"name": "templateinstance1"}, "spec": {"template": {"metadata": {"name": "template1", "namespace": "etcdstoragepathtestnamespace"}}, "requester": {"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", }, gvr("user.openshift.io", "v1", "groups"): { Stub: `{"metadata": {"name": "groupg"}, "users": ["user1", "user2"]}`, ExpectedEtcdPath: "openshift.io/groups/groupg", }, gvr("user.openshift.io", "v1", "users"): { Stub: `{"fullName": "user1g", "metadata": {"name": "user1g"}}`, ExpectedEtcdPath: "openshift.io/users/user1g", }, gvr("user.openshift.io", "v1", "identities"): { Stub: `{"metadata": {"name": "github:user2g"}, "providerName": "github", "providerUserName": "user2g"}`, ExpectedEtcdPath: "openshift.io/useridentities/github:user2g", }, }
Etcd data for all persisted OpenShift objects.
Functions ¶
func JSONToUnstructured ¶
func JSONToUnstructured(stub, namespace string, mapping *meta.RESTMapping, dynamicClient dynamic.Interface) (dynamic.ResourceInterface, *unstructured.Unstructured, error)
JSONToUnstructured converts a JSON stub to unstructured.Unstructured and returns a dynamic resource client that can be used to interact with it
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.