Skip to content

Commit

Permalink
Adds HumioUsers CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
cs-gschofield committed Jun 30, 2023
1 parent 676f876 commit 584db1a
Show file tree
Hide file tree
Showing 20 changed files with 881 additions and 2 deletions.
95 changes: 95 additions & 0 deletions api/v1alpha1/humiouser_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
Copyright 2020 Humio https://humio.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// HumioUserStateUnknown is the Unknown state of the user
HumioUserStateUnknown = "Unknown"
// HumioUserStateExists is the Exists state of the user
HumioUserStateExists = "Exists"
// HumioUserStateNotFound is the NotFound state of the user
HumioUserStateNotFound = "NotFound"
// HumioUserStateConfigError is the state of the user when user-provided specification results in configuration error, such as non-existent humio cluster
HumioUserStateConfigError = "ConfigError"
)

// HumioUserSpec defines the desired state of HumioUser
type HumioUserSpec 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"`
// Username of the user in humio
Username string `json:"username,omitempty"`
// User ID of the user in humio
ID string `json:"id,omitempty"`
// FullName is the full name of the user
FullName string `json:"fullName,omitempty"`
// Email is the email of the user
Email string `json:"email,omitempty"`
// Company is the compnay of the user
Company string `json:"company,omitempty"`
// CountryCode is the compnay of the user
CountryCode string `json:"countryCode,omitempty"`
// Picture is the url to the user's profile picture
Picture string `json:"picture,omitempty"`
// IsRoot is the root setting for the user
IsRoot bool `json:"isRoot,omitempty"`
// CreatedAt is date when the user was created
CreatedAt string `json:"createdat,omitempty"`
}

// HumioUserStatus defines the observed state of HumioUser
type HumioUserStatus struct {
// State reflects the current state of the HumioUser
State string `json:"state,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=humiousers,scope=Namespaced
//+kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The state of the user"
//+operator-sdk:gen-csv:customresourcedefinitions.displayName="Humio User"

// HumioUser is the Schema for the humiousers API
type HumioUser struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HumioUserSpec `json:"spec,omitempty"`
Status HumioUserStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// HumioUserList contains a list of HumioUser
type HumioUserList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []HumioUser `json:"items"`
}

func init() {
SchemeBuilder.Register(&HumioUser{}, &HumioUserList{})
}
90 changes: 89 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

105 changes: 105 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humiousers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: humiousers.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.19.0'
spec:
group: core.humio.com
names:
kind: HumioUser
listKind: HumioUserList
plural: humiousers
singular: humiouser
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The state of the user
jsonPath: .status.state
name: State
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: HumioUser is the Schema for the humiousers 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: HumioUserSpec defines the desired state of HumioUser
properties:
company:
description: Company is the compnay of the user
type: string
countryCode:
description: CountryCode is the compnay of the user
type: string
createdat:
description: CreatedAt is date when the user was created
type: string
email:
description: Email is the email of the user
type: string
externalClusterName:
description: ExternalClusterName refers to an object of type HumioExternalCluster
where the Humio resources should be created. This conflicts with
ManagedClusterName.
type: string
fullName:
description: FullName is the full name of the user
type: string
id:
description: User ID of the user in humio
type: string
isRoot:
description: IsRoot is the root setting for the user
type: boolean
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
picture:
description: Picture is the url to the user's profile picture
type: string
username:
description: Username of the user in humio
type: string
type: object
status:
description: HumioUserStatus defines the observed state of HumioUser
properties:
state:
description: State reflects the current state of the HumioUser
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
6 changes: 6 additions & 0 deletions charts/humio-operator/templates/operator-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ rules:
- humiorepositories
- humiorepositories/finalizers
- humiorepositories/status
- humiousers
- humiousers/finalizers
- humiousers/status
- humioviews
- humioviews/finalizers
- humioviews/status
Expand Down Expand Up @@ -225,6 +228,9 @@ rules:
- humiorepositories
- humiorepositories/finalizers
- humiorepositories/status
- humiousers
- humiousers/finalizers
- humiousers/status
- humioviews
- humioviews/finalizers
- humioviews/status
Expand Down
Loading

0 comments on commit 584db1a

Please sign in to comment.