From 72cc714dd4987b80720f6f1461d477e7417509b4 Mon Sep 17 00:00:00 2001 From: James Kim <33760507+jameskim0987@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:16:55 -0400 Subject: [PATCH] [ISSUE-5] fix docs; add missing descriptions (#6) * add TODO comment placeholders Signed-off-by: James Kim * testing commit Signed-off-by: James Kim * testing commit Signed-off-by: James Kim * add missing field descriptions Signed-off-by: James Kim * add missing field descriptions Signed-off-by: James Kim * remove TODO comments Signed-off-by: James Kim * add comments for structs Signed-off-by: James Kim * modify description strings Signed-off-by: James Kim * add struct field comments for Rule (Resource, Verbs, Objects) Signed-off-by: James Kim * add comments to structs and fields, make manifests & make install Signed-off-by: James Kim * fix misplaced description fields, modify to multiline string as needed Signed-off-by: James Kim --------- Signed-off-by: James Kim --- api/v1alpha1/argocdrole_types.go | 12 +++++++++--- api/v1alpha1/argocdrolebinding_types.go | 4 ++++ ...operator.argoproj-labs.io_argocdrolebindings.yaml | 5 +++++ .../rbac-operator.argoproj-labs.io_argocdroles.yaml | 9 +++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/api/v1alpha1/argocdrole_types.go b/api/v1alpha1/argocdrole_types.go index cdb0911..a651a86 100644 --- a/api/v1alpha1/argocdrole_types.go +++ b/api/v1alpha1/argocdrole_types.go @@ -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"` } diff --git a/api/v1alpha1/argocdrolebinding_types.go b/api/v1alpha1/argocdrolebinding_types.go index 723a9a9..b32c98a 100644 --- a/api/v1alpha1/argocdrolebinding_types.go +++ b/api/v1alpha1/argocdrolebinding_types.go @@ -24,10 +24,12 @@ 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"` @@ -35,6 +37,7 @@ type Subject struct { 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"` @@ -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"` } diff --git a/config/crd/bases/rbac-operator.argoproj-labs.io_argocdrolebindings.yaml b/config/crd/bases/rbac-operator.argoproj-labs.io_argocdrolebindings.yaml index 9d05cb7..6cf23af 100644 --- a/config/crd/bases/rbac-operator.argoproj-labs.io_argocdrolebindings.yaml +++ b/config/crd/bases/rbac-operator.argoproj-labs.io_argocdrolebindings.yaml @@ -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:" @@ -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 @@ -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: diff --git a/config/crd/bases/rbac-operator.argoproj-labs.io_argocdroles.yaml b/config/crd/bases/rbac-operator.argoproj-labs.io_argocdroles.yaml index ed9445e..f89df91 100644 --- a/config/crd/bases/rbac-operator.argoproj-labs.io_argocdroles.yaml +++ b/config/crd/bases/rbac-operator.argoproj-labs.io_argocdroles.yaml @@ -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 @@ -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 @@ -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: