Skip to content
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

Adds HumioUsers CRD #711

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,13 @@ resources:
kind: HumioView
path: github.com/humio/humio-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: humio.com
group: core
kind: HumioUser
path: github.com/humio/humio-operator/api/v1alpha1
version: v1alpha1
version: "3"
93 changes: 93 additions & 0 deletions api/v1alpha1/humiouser_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
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"`
}

// 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{})
}
89 changes: 89 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

100 changes: 100 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,100 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
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.23.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
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: {}
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 @@ -234,6 +237,9 @@ rules:
- humiorepositories
- humiorepositories/finalizers
- humiorepositories/status
- humiousers
- humiousers/finalizers
- humiousers/status
- humioviews
- humioviews/finalizers
- humioviews/status
Expand Down
Loading
Loading