Skip to content

Commit

Permalink
[ISSUE-5] fix docs; add missing descriptions (#6)
Browse files Browse the repository at this point in the history
* add TODO comment placeholders

Signed-off-by: James Kim <[email protected]>

* testing commit

Signed-off-by: James Kim <[email protected]>

* testing commit

Signed-off-by: James Kim <[email protected]>

* add missing field descriptions

Signed-off-by: James Kim <[email protected]>

* add missing field descriptions

Signed-off-by: James Kim <[email protected]>

* remove TODO comments

Signed-off-by: James Kim <[email protected]>

* add comments for structs

Signed-off-by: James Kim <[email protected]>

* modify description strings

Signed-off-by: James Kim <[email protected]>

* add struct field comments for Rule (Resource, Verbs, Objects)

Signed-off-by: James Kim <[email protected]>

* add comments to structs and fields, make manifests & make install

Signed-off-by: James Kim <[email protected]>

* fix misplaced description fields, modify to multiline string as needed

Signed-off-by: James Kim <[email protected]>

---------

Signed-off-by: James Kim <[email protected]>
  • Loading branch information
jameskim0987 authored Oct 4, 2024
1 parent 38ded83 commit 72cc714
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
12 changes: 9 additions & 3 deletions api/v1alpha1/argocdrole_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,25 @@ type ArgoCDRoleSpec struct {
Rules []Rule `json:"rules"`
}

// Rules define the desired set of permissions.
type Rule struct {
// +kubebuilder:validation:Enum=clusters;projects;applications;applicationsets;repositories;certificates;accounts;gpgkeys;logs;exec;extensions
// +kubebuilder:validation:example=clusters
Resource string `json:"resource"`
Verbs []string `json:"verbs"`
Objects []string `json:"objects"`
// Target resource type.
Resource string `json:"resource"`
// Verbs define the operations that are being performed on the resource.
Verbs []string `json:"verbs"`
// List of resource's objects the permissions are granted for.
Objects []string `json:"objects"`
}

// ArgoCDRoleStatus defines the observed state of Role
type ArgoCDRoleStatus struct {
// argocdRoleBindingRef defines the reference to the ArgoCDRoleBinding Resource.
ArgoCDRoleBindingRef string `json:"argocdRoleBindingRef,omitempty"`
// +listType=map
// +listMapKey=type
// Conditions defines the list of conditions.
Conditions []Condition `json:"conditions,omitempty"`
}

Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/argocdrolebinding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ import (

// ArgoCDRoleBindingSpec defines the desired state of ArgoCDRoleBinding
type ArgoCDRoleBindingSpec struct {
// List of subjects being bound to ArgoCDRole (argocdRoleRef).
Subjects []Subject `json:"subjects"`
ArgoCDRoleRef ArgoCDRoleRef `json:"argocdRoleRef"`
}

// Kind of the subject (sso, local).
type Subject struct {
// +kubebuilder:validation:Enum=sso;local;role
Kind string `json:"kind"`
// Name of the subject. If Kind is "role", it shouldn't start with "role:"
Name string `json:"name"`
}

// argocdRoleRef defines the reference to the role being granted.
type ArgoCDRoleRef struct {
// Name of the ArgoCDRole. Should not start with "role:"
Name string `json:"name"`
Expand All @@ -44,6 +47,7 @@ type ArgoCDRoleRef struct {
type ArgoCDRoleBindingStatus struct {
// +listType=map
// +listMapKey=type
// Conditions defines the list of conditions.
Conditions []Condition `json:"conditions,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ spec:
description: ArgoCDRoleBindingSpec defines the desired state of ArgoCDRoleBinding
properties:
argocdRoleRef:
description: |-
argocdRoleRef defines the reference to the role being granted.
properties:
name:
description: Name of the ArgoCDRole. Should not start with "role:"
Expand All @@ -48,9 +50,11 @@ spec:
- name
type: object
subjects:
description: List of subjects being bound to ArgoCDRole (argocdRoleRef).
items:
properties:
kind:
description: Kind of the subject (sso, local).
enum:
- sso
- local
Expand All @@ -73,6 +77,7 @@ spec:
description: ArgoCDRoleBindingStatus defines the observed state of ArgoCDRoleBinding
properties:
conditions:
description: Conditions defines the list of conditions.
items:
description: A Condition that may apply to a resource.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ spec:
description: ArgoCDRoleSpec defines the desired state of Role
properties:
rules:
description: Rules define the desired set of permissions.
items:
properties:
objects:
description: |-
List of resource's objects the permissions are granted for.
items:
type: string
type: array
resource:
description: Target resource type.
enum:
- clusters
- projects
Expand All @@ -61,6 +65,8 @@ spec:
- extensions
type: string
verbs:
description: |-
Verbs define the operations that are being performed on the resource.
items:
type: string
type: array
Expand All @@ -77,8 +83,11 @@ spec:
description: ArgoCDRoleStatus defines the observed state of Role
properties:
argocdRoleBindingRef:
description: |-
argocdRoleBindingRef defines the reference to the ArgoCDRoleBinding Resource.
type: string
conditions:
description: Conditions defines the list of conditions.
items:
description: A Condition that may apply to a resource.
properties:
Expand Down

0 comments on commit 72cc714

Please sign in to comment.