kubesphere.io/api@v0.0.0-20231107125330-c9a03957060c/types/v1beta1/federatedworkspacerolebinding_types.go (about)

     1  /*
     2  Copyright 2020 KubeSphere Authors
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8       http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1beta1
    18  
    19  import (
    20  	rbacv1 "k8s.io/api/rbac/v1"
    21  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    22  )
    23  
    24  const (
    25  	ResourcePluralFederatedWorkspaceRoleBinding   = "federatedworkspacerolebindings"
    26  	ResourceSingularFederatedWorkspaceRoleBinding = "federatedworkspacerolebinding"
    27  	FederatedWorkspaceRoleBindingKind             = "FederatedWorkspaceRoleBinding"
    28  )
    29  
    30  // +kubebuilder:object:root=true
    31  // +k8s:openapi-gen=true
    32  type FederatedWorkspaceRoleBinding struct {
    33  	metav1.TypeMeta   `json:",inline"`
    34  	metav1.ObjectMeta `json:"metadata,omitempty"`
    35  	Spec              FederatedWorkspaceRoleBindingSpec `json:"spec"`
    36  
    37  	Status *GenericFederatedStatus `json:"status,omitempty"`
    38  }
    39  
    40  type FederatedWorkspaceRoleBindingSpec struct {
    41  	Template  WorkspaceRoleBindingTemplate `json:"template"`
    42  	Placement GenericPlacementFields       `json:"placement"`
    43  	Overrides []GenericOverrideItem        `json:"overrides,omitempty"`
    44  }
    45  
    46  type WorkspaceRoleBindingTemplate struct {
    47  	metav1.ObjectMeta `json:"metadata,omitempty"`
    48  	// Subjects holds references to the objects the role applies to.
    49  	// +optional
    50  	Subjects []rbacv1.Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"`
    51  
    52  	// RoleRef can only reference a WorkspaceRole.
    53  	// If the RoleRef cannot be resolved, the Authorizer must return an error.
    54  	RoleRef rbacv1.RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"`
    55  }
    56  
    57  // +kubebuilder:object:root=true
    58  
    59  // FederatedWorkspaceRoleBindingList contains a list of FederatedWorkspaceRoleBinding
    60  type FederatedWorkspaceRoleBindingList struct {
    61  	metav1.TypeMeta `json:",inline"`
    62  	metav1.ListMeta `json:"metadata,omitempty"`
    63  	Items           []FederatedWorkspaceRoleBinding `json:"items"`
    64  }