Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP/PoC] builds api group #12868

Closed
wants to merge 9 commits into from
Closed

[WIP/PoC] builds api group #12868

wants to merge 9 commits into from

Conversation

sttts
Copy link
Contributor

@sttts sttts commented Feb 8, 2017

/cc @mfojtik

@sttts sttts force-pushed the apigroups branch 2 times, most recently from 0029088 to 27aaa6f Compare February 9, 2017 09:32
@soltysh
Copy link
Contributor

soltysh commented Feb 9, 2017

/cc

"builds": storage["builds"],
"builds/clone": storage["builds/clone"],
"builds/log": storage["builds/log"],
"builds/details": storage["builds/details"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need buildConfigs, etc. I wonder if we want to move this somewhere more visible or have a test that checks if we did this for all storage endpoints (in case you add new endpoint and forged to register it).

@mfojtik
Copy link
Contributor

mfojtik commented Feb 9, 2017

@deads2k guess if we have this for all groups, we can drop the legacy /oapi hack from clientset generator and generate clientsets just by using the new APi groups?

@deads2k
Copy link
Contributor

deads2k commented Feb 9, 2017

@deads2k guess if we have this for all groups, we can drop the legacy /oapi hack from clientset generator and generate clientsets just by using the new APi groups?

I think it depends on how we deal with the controllers, but probably.

jenkinsEnabled: boolptr(true),
validateClients: noAction,
},
{
name: "subresource",
attributes: admission.NewAttributesRecord(enableBuild, nil, unversioned.GroupVersionKind{}, "namespace", "name", buildapi.SchemeGroupVersion.WithResource("builds"), "subresource", admission.Create, &user.DefaultInfo{}),
attributes: admission.NewAttributesRecord(enableBuild, nil, unversioned.GroupVersionKind{}, "namespace", "name", buildapi.LegacySchemeGroupVersion.WithResource("builds"), "subresource", admission.Create, &user.DefaultInfo{}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means we'll need a sweep of admission plugins to make sure they aren't skipping resources they should check based on group.

"github.com/openshift/origin/pkg/build/api/v1"
)

const importPrefix = "github.com/openshift/origin/pkg/build/api"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may end up being a two stage process. As I recall, some of the client generators freak out when the last step of the package isn't the group

const GroupName = ""
const FutureGroupName = "build.openshift.io"
const LegacyGroupName = ""
const GroupName = "build.openshift.io"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely to have interesting effects on bootstrap policy. I think we actually get away with for reconciliation purposes since new clusters won't care and old clusters will be additive only. @liggitt that's neat, isn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, currently only cluster admin can create resources in group... we will have to duplicate bootstrap policy for all grouped resources?

@@ -50,7 +50,7 @@ var (
securityGroup = securityapi.GroupName
storageGroup = storage.GroupName
authzGroup = authorizationapi.GroupName
buildGroup = buildapi.GroupName
buildGroup = buildapi.LegacyGroupName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, you want both. Might make buildGroups and use it below. Groups(buildGroups...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a rename now. We know that we have to duplicate the rules there.

@@ -200,7 +202,8 @@ func (c *MasterConfig) RunInProxyMode(proxy *kubernetes.ProxyConfig, assetConfig
messages = append(messages, fmt.Sprintf("Started OpenAPI Schema at %%s%s", openAPIServePath))

// install origin handlers
c.InstallProtectedAPI(container)
// REBASE: delete proxy mode or make the following work
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton we get to remove it, right? Never produced a reliable cluster and no the direction we want to proceed in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

// initialize OpenShift API
storage := c.GetRestStorage()

apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(buildapi.GroupName)
//if apiResourceConfigSource.AnyResourcesForVersionEnabled(rbacapiv1alpha1.SchemeGroupVersion) {
apiGroupInfo.VersionedResourcesStorageMap[buildapiv1.SchemeGroupVersion.Version] = map[string]rest.Storage{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that this has to do it, but I like the pattern I made upstream with these being built closer to the registry. I don't want the interface I made for it (that was a mistake), but the code locality worked out nicely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we should follow the upstream pattern here. This was just the easiest way to get the PoC going without refactoring half of origin.

@deads2k
Copy link
Contributor

deads2k commented Feb 9, 2017

does this actually work? It's a lot cleaner than I would have expected.

@mfojtik
Copy link
Contributor

mfojtik commented Feb 9, 2017

@deads2k it does (but need bootstrap updates)... i mean the "builds" created by build controller are in the new api group;..... also oc get builds hit the new endpoint and all builds returned have new api group in version.

@sttts sttts force-pushed the apigroups branch 2 times, most recently from 7622e50 to e2fb448 Compare February 10, 2017 10:39
@sttts
Copy link
Contributor Author

sttts commented Feb 10, 2017

@liggitt @smarterclayton ptal. Do we miss anything if we go this route?

@liggitt
Copy link
Contributor

liggitt commented Feb 10, 2017

oc get builds hit the new endpoint

does oc get builds hit the old endpoint against an old server?

all builds returned have new api group in version

only when returned from the new API, right?

do we serialize buildconfigs into build annotations? which api version are they serialized as?

@mfojtik
Copy link
Contributor

mfojtik commented Feb 10, 2017

@liggitt yes, only against old server and yes.

we do serialize them (as well as deployment configs in RC)... I checked DC in RC and it was using "legacy" version. (I think we can change that)

@liggitt
Copy link
Contributor

liggitt commented Feb 10, 2017

(I think we can change that)

If we do, we break old clients, right?

@mfojtik
Copy link
Contributor

mfojtik commented Feb 10, 2017

@liggitt yes. we don't have to.

@openshift-bot
Copy link
Contributor

Origin Action Required: Pull request cannot be automatically merged, please rebase your branch from latest HEAD and push again

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 14, 2017
@mfojtik
Copy link
Contributor

mfojtik commented Feb 23, 2017

Closing this in favor of: #12986

@mfojtik mfojtik closed this Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants