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

OpenShiftClient: add support for ProjectRequest template parameters #2311

Closed
Obirah opened this issue Jun 24, 2020 · 3 comments · Fixed by #2376
Closed

OpenShiftClient: add support for ProjectRequest template parameters #2311

Obirah opened this issue Jun 24, 2020 · 3 comments · Fixed by #2376
Assignees

Comments

@Obirah
Copy link

Obirah commented Jun 24, 2020

When creating a ProjectRequest, the OpenShift API substitutes the five parameters

  • "PROJECT_NAME"
  • "PROJECT_DESCRIPTION"
  • "PROJECT_DISPLAYNAME"
  • "PROJECT_ADMIN_USER"
  • "PROJECT_REQUESTING_USER"

into the corresponding template, see docs: https://docs.openshift.com/container-platform/3.11/admin_guide/managing_projects.html#modifying-the-template-for-new-projects

So far I have not found a way to set the PROJECT_ADMIN_USER and PROJECT_REQUESTING_USER in the client, when creating a ProjectRequest with the ProjectRequestBuilder.

It would be cool to have support for that, because right now I have to work around it by getting the template from the API, processing it in my code and then creating all the resources from a KubernetesList.

If I have just overlooked the feature and there's a way to do it, please let me know and I'll close the issue.

@rohanKanojia rohanKanojia self-assigned this Jul 29, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jul 29, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jul 31, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jul 31, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 7, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
@rohanKanojia
Copy link
Member

rohanKanojia commented Aug 7, 2020

@Obirah: I've added a method in projects() in #2376 with which you can create a project with specified parameters. Do you think this would match your use case:

try (OpenShiftClient client = new DefaultOpenShiftClient()) {
    client.projects().createProjectAndRoleBindings("rokumar", "Rohan Kumar", "rokumar", "developer", "developer");
}

rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 10, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 10, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 10, 2020
Just like `oc adm create-bootstrap-project-template` generates a template yaml for
project request resources to be created; OpenShiftClient should be able to
generate + Apply resources based upon project request name, description, display name,
requesting user and admin user. It should create the following resources:

- Project (actual project to be created)
- RoleBinding system:deployers
- RoleBinding system:image-builders
- RoleBinding system:image-pullers
- RoleBinding admin
@Obirah
Copy link
Author

Obirah commented Aug 26, 2020

Hi @rohanKanojia,

thank you very much for your addition! :) I'm sure it is useful to a lot of people, but unfortunately it does not solve my use case. We're using a customized ProjectRequest template that - amongst other additional resources - contains more than just the four RoleBindings that "createProjectAndRoleBindings" creates.

We replaced the template "project-request" in the "default" namespace. Therefore, with the oc client, whenenver we do "oc new-project" our template is being used correctly.

In order to reflect that in the fabric8 client, I think one would need to adapt the "client.projectrequests()" portion and also the "ProjectRequestBuilder" but I'm not entirely sure if that's possible or if my workaround by processing the complete template in my code is the way to go.

Maybe you can give your thoughts on that.

@rohanKanojia
Copy link
Member

rohanKanojia commented Aug 27, 2020

I'm not sure I fully understand your use case. Could you please elaborate? We can make changes in projectrequests(), but not inProjectRequestBuilder since it is a generated resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants