Skip to content

Commit

Permalink
Support bind group to policy/role and fix list subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
yadzhang authored and choujimmy committed Dec 25, 2019
1 parent cba0676 commit ebaf710
Show file tree
Hide file tree
Showing 42 changed files with 3,499 additions and 506 deletions.
28 changes: 20 additions & 8 deletions api/auth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,12 @@ type PolicyStatus struct {
Phase PolicyPhase

// +optional
// Subjects represents the objects the policy applies to.
Subjects []Subject
// Users represents the users the policy applies to.
Users []Subject

// +optional
// Groups represents the groups the policy applies to.
Groups []Subject
}

const (
Expand Down Expand Up @@ -411,9 +415,13 @@ type RuleSpec struct {
type Binding struct {
metav1.TypeMeta

// Subjects holds references to the objects the policy applies to.
// Users holds references to the objects the policy applies to.
// +optional
Users []Subject

// Groups holds references to the groups the policy applies to.
// +optional
Subjects []Subject
Groups []Subject
}

// Subject references a user can specify by id or name.
Expand Down Expand Up @@ -477,8 +485,12 @@ type RoleStatus struct {
// +optional
Phase RolePhase

// Subjects represents the members of the group.
Subjects []Subject
// Users represents the users of the applies to.
Users []Subject

// +optional
// Groups represents the groups the policy applies to.
Groups []Subject
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -545,8 +557,8 @@ type GroupStatus struct {
// +optional
Phase GroupPhase

// Subjects represents the members of the group.
Subjects []Subject
// Users represents the members of the group.
Users []Subject
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
603 changes: 392 additions & 211 deletions api/auth/v1/generated.pb.go

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions api/auth/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions api/auth/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,11 @@ type PolicyStatus struct {
// +optional
Phase PolicyPhase `json:"phase" protobuf:"bytes,1,opt,name=phase,casttype=PolicyPhase"`
// +optional
// Subjects represents the objects the policy applies to.
Subjects []Subject `json:"subjects" protobuf:"bytes,2,rep,name=subjects"`
// Users represents the users the policy applies to.
Users []Subject `json:"users" protobuf:"bytes,2,rep,name=users"`

// Groups represents the groups the policy applies to.
Groups []Subject `protobuf:"bytes,3,rep,name=groups"`
}

const (
Expand Down Expand Up @@ -443,9 +446,13 @@ type RuleSpec struct {
type Binding struct {
metav1.TypeMeta `json:",inline"`

// Subjects holds references to the objects the policy applies to.
// Users holds references to the objects the policy applies to.
// +optional
Users []Subject `json:"users, omitempty" protobuf:"bytes,1,rep,name=users"`

// Groups holds references to the groups the policy applies to.
// +optional
Subjects []Subject `json:"subjects" protobuf:"bytes,1,rep,name=subject"`
Groups []Subject `json:"groups,omitempty" protobuf:"bytes,2,rep,name=groups"`
}

// Subject references a user can specify by id or name.
Expand Down Expand Up @@ -509,8 +516,12 @@ type RoleStatus struct {
// +optional
Phase RolePhase `protobuf:"bytes,1,opt,name=phase,casttype=RolePhase"`

// Subjects represents the members of the group.
Subjects []Subject `protobuf:"bytes,2,rep,name=subjects"`
// Users represents the users the role applies to.
Users []Subject `protobuf:"bytes,2,rep,name=users"`

// +optional
// Groups represents the groups the role applies to.
Groups []Subject `protobuf:"bytes,3,rep,name=groups"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -577,8 +588,8 @@ type GroupStatus struct {
// +optional
Phase GroupPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=GroupPhase"`

// Subjects represents the members of the group.
Subjects []Subject `json:"subjects" protobuf:"bytes,2,rep,name=subjects"`
// Users represents the members of the group.
Users []Subject `json:"users" protobuf:"bytes,2,rep,name=users"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
19 changes: 11 additions & 8 deletions api/auth/v1/types_swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions api/auth/v1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 23 additions & 8 deletions api/auth/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ebaf710

Please sign in to comment.