这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ bin/
testbin/
*-junit.xml
.envrc
tmp/**
tmp/**
humio-operator.iml
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.28.2
0.28.3
83 changes: 83 additions & 0 deletions api/v1alpha1/humiogroup_types.go
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"
Copy link
Contributor

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?

Copy link
Contributor Author

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

// 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{})
}
114 changes: 114 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.

4 changes: 2 additions & 2 deletions charts/humio-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: humio-operator
version: 0.28.2
appVersion: 0.28.2
version: 0.28.3
appVersion: 0.28.3
home: https://github.com/humio/humio-operator
description: |
Kubernetes Operator for running Humio on top of Kubernetes
Expand Down
106 changes: 106 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humiogroups.yaml
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want validation to make sure they're not both provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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: {}
8 changes: 8 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ func main() {
ctrl.Log.Error(err, "unable to create controller", "controller", "HumioView")
os.Exit(1)
}
if err = (&controller.HumioGroupReconciler{
Client: mgr.GetClient(),
HumioClient: humio.NewClient(log, userAgent),
BaseLogger: log,
}).SetupWithManager(mgr); err != nil {
ctrl.Log.Error(err, "unable to create controller", "controller", "HumioGroup")
os.Exit(1)
}
// +kubebuilder:scaffold:builder

if metricsCertWatcher != nil {
Expand Down
Loading
Loading