Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-48511

How can I set labels on a new project I create as a non-admin user?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • 4.17, 4.18, 4.19
    • oc
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Important
    • None
    • None
    • None
    • Rejected
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

          Hello! Is my understanding correct that when non-admin users use:
      $ oc new-project -h
      Create a new project for yourself.
      
       If your administrator allows self-service, this command will create a new project for you and assign you as the project
      admin.
      
       After your project is created it will become the default project in your config.
      
      Examples:
        # Create a new project with minimal information
        oc new-project web-team-dev
        
        # Create a new project with a display name and description
        oc new-project web-team-dev --display-name="Web Team Development" --description="Development project for the web
      team."
      
      Options:
          --description='':
      	Project description
      
          --display-name='':
      	Project display name
      
          --skip-config-write=false:
      	If true, the project will not be set as a cluster entry in kubeconfig after being created
      
      Usage:
        oc new-project NAME [--display-name=DISPLAYNAME] [--description=DESCRIPTION] [flags] [options]
      
      Use "oc options" for a list of global command-line options (applies to all commands).

      they can't add labels at the time of creation?

      I see an inconsistency when I do:

      $ oc new-project or-test2 
      Now using project "or-test2" on server "https://api.uit-418-001.rhos-psi.cnv-qe.rhood.us:6443".
      
      You can add applications to this project with the 'new-app' command. For example, try:
      
          oc new-app rails-postgresql-example
      
      to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:
      
          kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.43 -- /agnhost serve-hostnameI am a "test" user non-admin 

      I am a "test" user non-admin v/s

      $ cat p
      apiVersion: project.openshift.io/v1
      kind: Project
      metadata:
        name: test34
      $ oc apply -f p
      Error from server (Forbidden): error when retrieving current configuration of:
      Resource: "project.openshift.io/v1, Resource=projects", GroupVersionKind: "project.openshift.io/v1, Kind=Project"
      Name: "test34", Namespace: ""
      from server for: "p": projects.project.openshift.io "test34" is forbidden: User "test" cannot get resource "projects" in API group "project.openshift.io" in the namespace "test34"
      [omergi@omergi-thinkpadp1gen4i ~]$  

      where I cannot do the same apply for the same project CR. Same results when using oc create -f or oc apply -f.

      How can a non-admin add labels using oc project create so that the namespace has the right labels?

              aos-workloads-staff Workloads Team Bot Account
              sseethar Surya Seetharaman
              None
              None
              Ying Zhou Ying Zhou
              None
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: