-
Notifications
You must be signed in to change notification settings - Fork 34
Add support for managing HumioGroup and roles assignment to groups in HumioOperator #964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
375434e
dc602b4
95e0b91
af8b477
df649ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,4 +84,5 @@ bin/ | |
| testbin/ | ||
| *-junit.xml | ||
| .envrc | ||
| tmp/** | ||
| tmp/** | ||
| humio-operator.iml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0.28.2 | ||
| 0.28.3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| const ( | ||
| // HumioGroupStateUnknown is the Unknown state of the group | ||
| HumioGroupStateUnknown = "Unknown" | ||
| // HumioGroupStateExists is the Exists state of the group | ||
| HumioGroupStateExists = "Exists" | ||
| // HumioGroupStateNotFound is the NotFound state of the group | ||
| HumioGroupStateNotFound = "NotFound" | ||
| // HumioGroupStateConfigError is the state of the group when user-provided specification results in configuration error, such as non-existent humio cluster | ||
| HumioGroupStateConfigError = "ConfigError" | ||
| ) | ||
|
|
||
| // HumioGroupRoleAssignment represents a role assignment for a group | ||
| type HumioGroupRoleAssignment struct { | ||
| // RoleName contains the name of the role to assign | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +required | ||
| RoleName string `json:"roleName"` | ||
| // ViewName contains the name of the view to associate the group with | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +required | ||
| ViewName string `json:"viewName"` | ||
| } | ||
|
|
||
| // HumioGroupSpec defines the desired state of HumioGroup. | ||
| type HumioGroupSpec struct { | ||
| // ManagedClusterName refers to an object of type HumioCluster that is managed by the operator where the Humio | ||
| // resources should be created. | ||
| // This conflicts with ExternalClusterName. | ||
| ManagedClusterName string `json:"managedClusterName,omitempty"` | ||
| // ExternalClusterName refers to an object of type HumioExternalCluster where the Humio resources should be created. | ||
| // This conflicts with ManagedClusterName. | ||
| ExternalClusterName string `json:"externalClusterName,omitempty"` | ||
| // DisplayName is the display name of the HumioGroup | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +required | ||
| DisplayName string `json:"displayName"` | ||
| // LookupName is the lookup name of the HumioGroup | ||
| // +optional | ||
| LookupName *string `json:"lookupName,omitempty"` | ||
| // Assignments contains the list of role assignments for the group | ||
| // +optional | ||
| Assignments []HumioGroupRoleAssignment `json:"assignments,omitempty"` | ||
| } | ||
|
|
||
| // HumioGroupStatus defines the observed state of HumioGroup. | ||
| type HumioGroupStatus struct { | ||
| // State reflects the current state of the HumioGroup | ||
| State string `json:"state,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:path=humiogroups,scope=Namespaced | ||
| // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The state of the group" | ||
| // +operator-sdk:gen-csv:customresourcedefinitions.displayName="Humio Group" | ||
|
|
||
| // HumioGroup is the Schema for the humiogroups API | ||
| type HumioGroup struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec HumioGroupSpec `json:"spec,omitempty"` | ||
| Status HumioGroupStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // HumioGroupList contains a list of HumioGroup | ||
| type HumioGroupList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []HumioGroup `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&HumioGroup{}, &HumioGroupList{}) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| --- | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| annotations: | ||
| controller-gen.kubebuilder.io/version: v0.17.0 | ||
| name: humiogroups.core.humio.com | ||
| labels: | ||
| app: 'humio-operator' | ||
| app.kubernetes.io/name: 'humio-operator' | ||
| app.kubernetes.io/instance: 'humio-operator' | ||
| app.kubernetes.io/managed-by: 'Helm' | ||
| helm.sh/chart: 'humio-operator-0.28.2' | ||
| spec: | ||
| group: core.humio.com | ||
| names: | ||
| kind: HumioGroup | ||
| listKind: HumioGroupList | ||
| plural: humiogroups | ||
| singular: humiogroup | ||
| scope: Namespaced | ||
| versions: | ||
| - additionalPrinterColumns: | ||
| - description: The state of the group | ||
| jsonPath: .status.state | ||
| name: State | ||
| type: string | ||
| name: v1alpha1 | ||
| schema: | ||
| openAPIV3Schema: | ||
| description: HumioGroup is the Schema for the humiogroups API | ||
| properties: | ||
| apiVersion: | ||
| description: |- | ||
| APIVersion defines the versioned schema of this representation of an object. | ||
| Servers should convert recognized schemas to the latest internal value, and | ||
| may reject unrecognized values. | ||
| More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
| type: string | ||
| kind: | ||
| description: |- | ||
| Kind is a string value representing the REST resource this object represents. | ||
| Servers may infer this from the endpoint the client submits requests to. | ||
| Cannot be updated. | ||
| In CamelCase. | ||
| More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
| type: string | ||
| metadata: | ||
| type: object | ||
| spec: | ||
| description: HumioGroupSpec defines the desired state of HumioGroup. | ||
| properties: | ||
| assignments: | ||
| description: Assignments contains the list of role assignments for | ||
| the group | ||
| items: | ||
| description: HumioGroupRoleAssignment represents a role assignment | ||
| for a group | ||
| properties: | ||
| roleName: | ||
| description: RoleName contains the name of the role to assign | ||
| minLength: 1 | ||
| type: string | ||
| viewName: | ||
| description: ViewName contains the name of the view to associate | ||
| the group with | ||
| minLength: 1 | ||
| type: string | ||
| required: | ||
| - roleName | ||
| - viewName | ||
| type: object | ||
| type: array | ||
| displayName: | ||
| description: DisplayName is the display name of the HumioGroup | ||
| minLength: 1 | ||
| type: string | ||
| externalClusterName: | ||
| description: |- | ||
| ExternalClusterName refers to an object of type HumioExternalCluster where the Humio resources should be created. | ||
| This conflicts with ManagedClusterName. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want validation to make sure they're not both provided?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| type: string | ||
| lookupName: | ||
| description: LookupName is the lookup name of the HumioGroup | ||
| type: string | ||
| managedClusterName: | ||
| description: |- | ||
| ManagedClusterName refers to an object of type HumioCluster that is managed by the operator where the Humio | ||
| resources should be created. | ||
| This conflicts with ExternalClusterName. | ||
| type: string | ||
| required: | ||
| - displayName | ||
| type: object | ||
| status: | ||
| description: HumioGroupStatus defines the observed state of HumioGroup. | ||
| properties: | ||
| state: | ||
| description: State reflects the current state of the HumioGroup | ||
| type: string | ||
| type: object | ||
| type: object | ||
| served: true | ||
| storage: true | ||
| subresources: | ||
| status: {} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea how we get this state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 116 in the controller code sets this state, looks like its from generic API errors